dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21497
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10181: added sharing to chart, map. upgraded db to set public read-only where system chart/map was used....
------------------------------------------------------------
revno: 10181
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-03-13 22:03:10 +0700
message:
added sharing to chart, map. upgraded db to set public read-only where system chart/map was used. added F_MAP_PUBLIC_ADD/F_CHART_PUBLIC_ADD for creating public maps/charts.
modified:
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/mapping/hibernate/Map.hbm.xml
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml
--
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-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-03-12 09:49:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-03-13 15:03:10 +0000
@@ -534,6 +534,10 @@
executeSql( "UPDATE dataelementgroupset SET userid=NULL WHERE userid IS NOT NULL" );
executeSql( "UPDATE dataelementgroupset SET publicaccess=NULL WHERE userid IS NOT NULL" );
+ // upgrade system charts/maps to public read-only sharing
+ executeSql( "UPDATE chart SET publicaccess='r-------' WHERE user IS NOT NULL;" );
+ executeSql( "UPDATE map SET publicaccess='r-------' WHERE user IS NOT NULL;" );
+
log.info( "Tables updated" );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/Map.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/Map.hbm.xml 2012-12-13 11:53:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/Map.hbm.xml 2013-03-13 15:03:10 +0000
@@ -22,9 +22,6 @@
<property name="lastUpdated" type="timestamp" />
- <many-to-one name="user" class="org.hisp.dhis.user.User"
- column="userid" foreign-key="fk_mapview_userid" />
-
<property name="longitude" />
<property name="latitude" />
@@ -39,5 +36,16 @@
foreign-key="fk_mapmapview_mapviewid" />
</list>
+ <!-- Access properties -->
+ <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_mapview_userid" />
+
+ <property name="publicAccess" length="8" />
+
+ <set name="userGroupAccesses" table="mapusergroupaccesses">
+ <cache usage="read-write" />
+ <key column="mapid" />
+ <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
+ </set>
+
</class>
</hibernate-mapping>
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2012-12-13 11:53:32 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2013-03-13 15:03:10 +0000
@@ -112,7 +112,16 @@
<property name="rewindRelativePeriods" />
+ <!-- Access properties -->
<many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_chart_userid" />
+ <property name="publicAccess" length="8" />
+
+ <set name="userGroupAccesses" table="chartusergroupaccesses">
+ <cache usage="read-write" />
+ <key column="chartid" />
+ <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
+ </set>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-02-27 10:13:13 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-03-13 15:03:10 +0000
@@ -94,7 +94,6 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- @PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
public void postJsonObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception
{
Map map = JacksonUtils.fromJson( input, Map.class );
@@ -116,7 +115,6 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
@ResponseStatus( value = HttpStatus.NO_CONTENT )
- @PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
{
Map map = mappingService.getMap( uid );
@@ -160,7 +158,6 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
@ResponseStatus( value = HttpStatus.NO_CONTENT )
- @PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid ) throws Exception
{
Map map = mappingService.getMap( uid );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml 2013-01-17 13:32:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml 2013-03-13 15:03:10 +0000
@@ -239,6 +239,8 @@
<property name="authorities">
<set>
<value>ALL</value>
+ <value>F_CHART_PUBLIC_ADD</value>
+ <value>F_MAP_PUBLIC_ADD</value>
</set>
</property>
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2013-03-12 06:51:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2013-03-13 15:03:10 +0000
@@ -213,6 +213,7 @@
F_RELATIONSHIPTYPE_UPDATE=Update Relationship Type
F_RELATIONSHIP_DELETE=Delete Relationship
F_GIS_ADMIN=Administrate GIS
+F_MAP_PUBLIC_ADD=Add Public Map
F_DATAMART_ADMIN=Administrate data mart
F_SCHEDULING_ADMIN=Scheduling Administration
F_SQLVIEW_ADD=Add Sql View
@@ -230,6 +231,7 @@
F_OPTIONSET_DELETE=Delete Option Set
F_DATA_MART_ADMIN=Administrate data mart
F_DV_ADMIN=Administrate data vizualiser
+F_CHART_PUBLIC_ADD=Add Public Chart
F_MOBILE_SENDSMS=Send SMS
F_MOBILE_SETTINGS=Set mobile settings
F_PERFORM_MAINTENANCE=Perform maintenance tasks
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2012-06-28 17:04:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2013-03-13 15:03:10 +0000
@@ -1,109 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
-"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
-"http://struts.apache.org/dtds/struts-2.0.dtd">
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
- <include file="dhis-web-commons.xml" />
-
- <package name="dhis-web-visualizer" extends="dhis-web-commons"
- namespace="/dhis-web-visualizer">
-
- <!-- Default -->
-
- <action name="index" class="org.hisp.dhis.visualizer.action.NoAction">
- <result name="success" type="redirect">app/index.html</result>
- </action>
-
- <!-- Initialize -->
-
- <action name="initialize"
- class="org.hisp.dhis.visualizer.action.InitializeAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonInitialize.vm</result>
- </action>
-
- <!-- OrganisationUnit -->
-
- <action name="getOrganisationUnitChildren"
- class="org.hisp.dhis.visualizer.action.GetOrganisationUnitChildrenAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonminOrganisationUnitChildren.vm</result>
- </action>
-
- <action name="getOrganisationUnitPaths"
- class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm</result>
- </action>
-
- <action name="getOrganisationUnitPathsByGroup"
- class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByGroupAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm</result>
- </action>
-
- <action name="getOrganisationUnitPathsByLevel"
- class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByLevelAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm</result>
- </action>
-
- <!-- Aggregated values -->
-
- <action name="getAggregatedValues"
- class="org.hisp.dhis.visualizer.action.GetAggregatedValuesAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonminAggregatedValues.vm</result>
- <result name="none" type="velocity-json">
- /dhis-web-visualizer/void.vm</result>
- </action>
-
- <!-- Chart -->
-
- <action name="addOrUpdateSystemChart"
- class="org.hisp.dhis.visualizer.action.AddOrUpdateChartAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/stringChartId.vm</result>
- <param name="requiredAuthorities">F_DV_ADMIN</param>
- <param name="system">true</param>
- </action>
-
- <action name="addOrUpdateChart"
- class="org.hisp.dhis.visualizer.action.AddOrUpdateChartAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/stringChartId.vm</result>
- </action>
-
- <action name="updateChartName"
- class="org.hisp.dhis.visualizer.action.UpdateChartNameAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/void.vm</result>
- </action>
-
- <action name="getSystemAndCurrentUserCharts"
- class="org.hisp.dhis.visualizer.action.GetSystemAndCurrentUserChartsAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/jsonminCharts.vm</result>
- </action>
-
- <action name="deleteCharts"
- class="org.hisp.dhis.visualizer.action.DeleteChartsAction">
- <result name="success" type="velocity-json">
- /dhis-web-visualizer/void.vm</result>
- </action>
-
- <!-- Export -->
-
- <action name="exportImage" class="org.hisp.dhis.visualizer.action.ExportImageAction">
- <result name="success" type="outputStreamResult"/>
- </action>
-
- <!-- i18n -->
-
- <action name="i18n" class="org.hisp.dhis.visualizer.action.NoAction">
- <result name="success" type="velocity-javascript">/dhis-web-visualizer/i18n.vm</result>
- </action>
-
- </package>
+ <include file="dhis-web-commons.xml" />
+
+ <package name="dhis-web-visualizer" extends="dhis-web-commons"
+ namespace="/dhis-web-visualizer">
+
+ <!-- Default -->
+
+ <action name="index" class="org.hisp.dhis.visualizer.action.NoAction">
+ <result name="success" type="redirect">app/index.html</result>
+ </action>
+
+ <!-- Initialize -->
+
+ <action name="initialize"
+ class="org.hisp.dhis.visualizer.action.InitializeAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonInitialize.vm
+ </result>
+ </action>
+
+ <!-- OrganisationUnit -->
+
+ <action name="getOrganisationUnitChildren"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitChildrenAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminOrganisationUnitChildren.vm
+ </result>
+ </action>
+
+ <action name="getOrganisationUnitPaths"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm
+ </result>
+ </action>
+
+ <action name="getOrganisationUnitPathsByGroup"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByGroupAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm
+ </result>
+ </action>
+
+ <action name="getOrganisationUnitPathsByLevel"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByLevelAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm
+ </result>
+ </action>
+
+ <!-- Aggregated values -->
+
+ <action name="getAggregatedValues"
+ class="org.hisp.dhis.visualizer.action.GetAggregatedValuesAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminAggregatedValues.vm
+ </result>
+ <result name="none" type="velocity-json">
+ /dhis-web-visualizer/void.vm
+ </result>
+ </action>
+
+ <!-- Chart -->
+
+ <action name="addOrUpdateSystemChart"
+ class="org.hisp.dhis.visualizer.action.AddOrUpdateChartAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/stringChartId.vm
+ </result>
+ <param name="requiredAuthorities">F_DV_ADMIN</param>
+ <param name="system">true</param>
+ </action>
+
+ <action name="addOrUpdateChart"
+ class="org.hisp.dhis.visualizer.action.AddOrUpdateChartAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/stringChartId.vm
+ </result>
+ </action>
+
+ <action name="updateChartName"
+ class="org.hisp.dhis.visualizer.action.UpdateChartNameAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/void.vm
+ </result>
+ </action>
+
+ <action name="getSystemAndCurrentUserCharts"
+ class="org.hisp.dhis.visualizer.action.GetSystemAndCurrentUserChartsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminCharts.vm
+ </result>
+ </action>
+
+ <action name="deleteCharts"
+ class="org.hisp.dhis.visualizer.action.DeleteChartsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/void.vm
+ </result>
+ </action>
+
+ <!-- Export -->
+
+ <action name="exportImage" class="org.hisp.dhis.visualizer.action.ExportImageAction">
+ <result name="success" type="outputStreamResult" />
+ </action>
+
+ <!-- i18n -->
+
+ <action name="i18n" class="org.hisp.dhis.visualizer.action.NoAction">
+ <result name="success" type="velocity-javascript">/dhis-web-visualizer/i18n.vm</result>
+ </action>
+
+ </package>
</struts>