← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2420: (GIS) Simple user access control implemented.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2420 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-12-24 16:53:37 +0100
message:
  (GIS) Simple user access control implemented.
modified:
  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-mapping/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js


--
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-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	2010-12-23 12:27:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties	2010-12-24 15:52:18 +0000
@@ -118,6 +118,7 @@
 F_PATIENTATTRIBUTEVALUE_DELETE = Delete Patient Attribute Value
 F_RELATIONSHIPTYPE_UPDATE = Update Relationship Type
 F_RELATIONSHIP_DELETE = Delete Relationship
+F_GIS_ADMIN = Administrate GIS
 
 #-- User module ---------------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml	2010-12-01 12:16:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml	2010-12-24 15:51:48 +0000
@@ -116,12 +116,14 @@
 			class="org.hisp.dhis.mapping.action.AddOrUpdateMapLegendAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="deleteMapLegend"
 			class="org.hisp.dhis.mapping.action.DeleteMapLegendAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="getAllMapLegends"
@@ -142,12 +144,14 @@
 			class="org.hisp.dhis.mapping.action.AddOrUpdateMapLegendSetAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="deleteMapLegendSet"
 			class="org.hisp.dhis.mapping.action.DeleteMapLegendSetAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="getAllMapLegendSets"
@@ -198,11 +202,13 @@
 			class="org.hisp.dhis.mapping.action.AddOrUpdateMapViewAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="deleteMapView" class="org.hisp.dhis.mapping.action.DeleteMapViewAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="getMapView" class="org.hisp.dhis.mapping.action.GetMapViewAction">
@@ -240,12 +246,14 @@
 			class="org.hisp.dhis.mapping.action.AddOrUpdateMapLayerAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="deleteMapLayer"
 			class="org.hisp.dhis.mapping.action.DeleteMapLayerAction">
 			<result name="success" type="velocity-json">/dhis-web-mapping/void.vm
 			</result>
+            <param name="requiredAuthorities">F_GIS_ADMIN</param>
 		</action>
 
 		<action name="getAllMapLayers"

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm	2010-12-09 15:11:24 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm	2010-12-24 15:51:48 +0000
@@ -69,5 +69,8 @@
       }
     }#if( $velocityCount < $overlaysSize ),#end
 #end
-  ]
+  ],
+  "security": {
+    "isAdmin": $auth.hasAccess( "dhis-web-mapping", "deleteMapLegendSet" )
+  } 
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js	2010-12-15 09:01:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js	2010-12-24 15:51:48 +0000
@@ -20,7 +20,7 @@
 
 //  Layout
 
-    west_width: 270, // viewport west
+    west_width: 270,
     gridpanel_width: 270 - 15,
     multiselect_width: 219,
 	combo_width: 150,
@@ -354,7 +354,7 @@
     
     topLevelUnit: null,
     
-    locateFeatureWindow: null,
-    
-    selectFeatureWindow: null
+    user: {
+		isAdmin: false
+	}
 };

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-12-21 12:32:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-12-24 15:51:48 +0000
@@ -1,4 +1,4 @@
-Ext.onReady( function() {    
+Ext.onReady( function() {
     Ext.BLANK_IMAGE_URL = '../resources/ext-ux/theme/gray-extend/gray-extend/s.gif';
 	Ext.override(Ext.form.Field,{showField:function(){this.show();this.container.up('div.x-form-item').setDisplayed(true);},hideField:function(){this.hide();this.container.up('div.x-form-item').setDisplayed(false);}});
 	Ext.QuickTips.init();
@@ -17,7 +17,8 @@
             GLOBAL.vars.parameter.mapView = init.mapView;
             GLOBAL.vars.parameter.baseLayers = init.baseLayers;
             GLOBAL.vars.parameter.overlays = init.overlays;
-            GLOBAL.vars.mapDateType.value = init.userSettings.mapDateType;            
+            GLOBAL.vars.mapDateType.value = init.userSettings.mapDateType;
+            GLOBAL.vars.user.isAdmin = init.security.isAdmin;
                         
     /* Section: stores */
     var mapViewStore = new Ext.data.JsonStore({
@@ -2334,6 +2335,7 @@
 	var favoritesButton = new Ext.Button({
 		iconCls: 'icon-favorite',
 		tooltip: i18n_favorite_map_views,
+		hidden: !GLOBAL.vars.user.isAdmin,
 		handler: function() {
 			var x = Ext.getCmp('center').x + 15;
 			var y = Ext.getCmp('center').y + 41;    
@@ -2387,6 +2389,7 @@
 	var predefinedMapLegendSetButton = new Ext.Button({
 		iconCls: 'icon-predefinedlegendset',
 		tooltip: i18n_create_predefined_legend_sets,
+		hidden: !GLOBAL.vars.user.isAdmin,
 		handler: function() {
 			var x = Ext.getCmp('center').x + 15;
 			var y = Ext.getCmp('center').y + 41;
@@ -2407,6 +2410,7 @@
 	var adminButton = new Ext.Button({
 		iconCls: 'icon-admin',
 		tooltip: 'Administrator settings',
+		hidden: !GLOBAL.vars.user.isAdmin,
 		handler: function() {
 			var x = Ext.getCmp('center').x + 15;
 			var y = Ext.getCmp('center').y + 41;