dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20673
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9576: sharing for datadictionary
------------------------------------------------------------
revno: 9576
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-01-22 13:09:12 +0100
message:
sharing for datadictionary
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataDictionary.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-01-21 14:47:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-01-22 12:09:12 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.datadictionary.DataDictionary;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.report.Report;
@@ -69,6 +70,10 @@
SUPPORTED_TYPES.put( "dataSet", DataSet.class );
PUBLIC_AUTHORITIES.put( DataSet.class, "F_DATASET_PUBLIC_ADD" );
PRIVATE_AUTHORITIES.put( DataSet.class, "F_DATASET_PRIVATE_ADD" );
+
+ SUPPORTED_TYPES.put( "dataDictionary", DataDictionary.class );
+ PUBLIC_AUTHORITIES.put( DataDictionary.class, "F_DATADICTIONARY_PUBLIC_ADD" );
+ PRIVATE_AUTHORITIES.put( DataDictionary.class, "F_DATADICTIONARY_PRIVATE_ADD" );
}
public static boolean isSupported( String type )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-01-21 14:03:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-01-22 12:09:12 +0000
@@ -484,6 +484,7 @@
executeSql( "UPDATE userroleauthorities SET authority='F_REPORT_PUBLIC_ADD' WHERE authority='F_REPORT_ADD'" );
executeSql( "UPDATE userroleauthorities SET authority='F_REPORTTABLE_PUBLIC_ADD' WHERE authority='F_REPORTTABLE_ADD'" );
executeSql( "UPDATE userroleauthorities SET authority='F_DATASET_PUBLIC_ADD' WHERE authority='F_DATASET_ADD'" );
+ executeSql( "UPDATE userroleauthorities SET authority='F_DATADICTIONARY_PUBLIC_ADD' WHERE authority='F_DATADICTIONARY_ADD'" );
log.info( "Tables updated" );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml 2013-01-22 12:09:12 +0000
@@ -3,7 +3,7 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
[<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
->
+ >
<hibernate-mapping>
<class name="org.hisp.dhis.datadictionary.DataDictionary" table="datadictionary">
@@ -14,14 +14,15 @@
<generator class="native" />
</id>
&identifiableProperties;
-
+
<property name="description" type="text" />
<property name="region" />
<set name="dataElements" table="datadictionarydataelements">
<key column="datadictionaryid" foreign-key="fk_datadictionarydataelements_datadictionaryid" />
- <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_datadictionarydataelements_dataelementid" />
+ <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
+ foreign-key="fk_datadictionarydataelements_dataelementid" />
</set>
<set name="indicators" table="datadictionaryindicators">
@@ -29,5 +30,16 @@
<many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_datadictionaryindicators_indicatorid" />
</set>
+ <!-- Access properties -->
+ <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_datadictionary_userid" />
+
+ <property name="publicAccess" length="8" />
+
+ <set name="userGroupAccesses" table="datadictionaryusergroupaccesses">
+ <cache usage="read-write" />
+ <key column="datadictionaryid" />
+ <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
+ </set>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-01-21 14:47:55 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-01-22 12:09:12 +0000
@@ -216,7 +216,7 @@
throw new AccessDeniedException( "You do not have write access to object" );
}
- if ( SharingUtils.isSupported( clazz ) && currentUserService.getCurrentUser() != null )
+ if ( currentUserService.getCurrentUser() != null && SharingUtils.isSupported( clazz ) )
{
BaseIdentifiableObject identifiableObject = (BaseIdentifiableObject) object;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2012-10-31 06:45:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2013-01-22 12:09:12 +0000
@@ -538,12 +538,12 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-datadictionary/addDataDictionaryForm.vm</param>
<param name="javascripts">javascript/dataDictionary.js</param>
- <param name="requiredAuthorities">F_DATADICTIONARY_ADD</param>
+ <param name="anyAuthorities">F_DATADICTIONARY_PUBLIC_ADD, F_DATADICTIONARY_PRIVATE_ADD</param>
</action>
<action name="addDataDictionary" class="org.hisp.dhis.dd.action.datadictionary.AddDataDictionaryAction">
<result name="success" type="redirect">dataDictionary.action</result>
- <param name="requiredAuthorities">F_DATADICTIONARY_ADD</param>
+ <param name="anyAuthorities">F_DATADICTIONARY_PUBLIC_ADD, F_DATADICTIONARY_PRIVATE_ADD</param>
</action>
<action name="showUpdateDataDictionaryForm" class="org.hisp.dhis.dd.action.datadictionary.GetDataDictionaryMembersAction">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataDictionary.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataDictionary.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataDictionary.vm 2013-01-22 12:09:12 +0000
@@ -1,3 +1,6 @@
+
+#sharingDialog()
+
<script type="text/javascript">
jQuery(document).ready(function(){
tableSorter( 'listTable' );
@@ -22,7 +25,7 @@
</table>
<table class="listTable" id="listTable">
<col/>
- <col width="120px"/>
+ <col width="145px"/>
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
@@ -31,15 +34,39 @@
</thead>
<tbody id="list">
#foreach( $dataDictionary in $dataDictionaries )
+
<tr id="tr${dataDictionary.id}">
<td onclick="showDataDictionaryDetails( $dataDictionary.id )">$encoder.htmlEncode( $dataDictionary.name )</td>
<td style="text-align:right">
- <a href="showUpdateDataDictionaryForm.action?id=$dataDictionary.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
- <a href="javascript:translate( 'DataDictionary', '$dataDictionary.id' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- <a href="javascript:removeDataDictionary( $dataDictionary.id, '$encoder.jsEncode( $dataDictionary.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+
+ #if ( $security.canManage( $dataDictionary ) )
+ <a href="javascript:showSharingDialog('dataDictionary', '$dataDictionary.uid');"><img src="../images/relationship.png" alt="$i18n.getString( 'sharing_settings' )"></a>
+ #else
+ <img src="../images/relationship-denied.png">
+ #end
+
+ #if( $security.canUpdate( $dataDictionary ) )
+ <a href="showUpdateDataDictionaryForm.action?id=$dataDictionary.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ #else
+ <img src="../images/edit-denied.png">
+ #end
+
+ #if( $security.canUpdate( $dataDictionary ) )
+ <a href="javascript:translate( 'DataDictionary', '$dataDictionary.id' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ #else
+ <img src="../images/i18n-denied.png">
+ #end
+
+ #if( $security.canDelete( $dataDictionary ) )
+ <a href="javascript:removeDataDictionary( $dataDictionary.id, '$encoder.jsEncode( $dataDictionary.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ #else
+ <img src="../images/delete-denied.png">
+ #end
+
<a href="javascript:showDataDictionaryDetails( $dataDictionary.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
</td>
</tr>
+
#end
</tbody>
</table>