as an alternate/addition to applying per-setting permissions, use the existing VIEW_O...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 10 Mar 2011 14:24:18 +0000 (14:24 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 10 Mar 2011 14:24:18 +0000 (14:24 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@19677 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/admin/org_unit_settings.js
Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml

index 648090b..07e5404 100644 (file)
 <!ENTITY staff.server.admin.org_unit_settings.title "Organization Unit Settings">
 <!ENTITY staff.server.admin.org_unit_settings.context "Context Location">
 <!ENTITY staff.server.admin.org_unit_settings.uninherited " * Indicates the setting is not inherited from the parent org unit at run time">
+<!ENTITY staff.server.admin.org_unit_settings.no_perms "You do not have permission to view org unit settings">
 <!ENTITY staff.server.admin.org_unit_settings.edit_setting "Edit Setting">
 <!ENTITY staff.server.admin.org_unit_settings.delete_setting "Delete Setting">
 <!ENTITY staff.server.admin.org_unit_settings.update_setting "Update Setting">
index b275eb7..82f0475 100644 (file)
@@ -29,10 +29,20 @@ function osInit(data) {
     contextOrg = user.user.ws_ou();
     openils.User.authtoken = authtoken;
 
-    var connect = function() { dojo.connect(contextOrg, 'onChange', osChangeContext); };
-    new openils.User().buildPermOrgSelector('STAFF_LOGIN', osContextSelector, null, connect);
+    var connect = function() { 
+        dojo.connect(contextOrg, 'onChange', osChangeContext); 
+
+        // don't draw the org settings grid unless the user has permission
+        // to view org settings in at least 1 org unit
+        osContextSelector.store.fetch({query: {}, start: 0, count: 0, 
+            onBegin: function(size) { 
+                if(size) { osDraw();  return; }
+                dojo.removeClass('no-perms', 'hide_me');
+            }
+        });
+    };
 
-    osDraw();
+    new openils.User().buildPermOrgSelector('VIEW_ORG_SETTINGS', osContextSelector, null, connect);
 }
 dojo.addOnLoad(osInit);
 
index 2862fba..017ab39 100644 (file)
@@ -40,6 +40,9 @@
                 </span>
                 <span>&staff.server.admin.org_unit_settings.uninherited;</span>
             </div>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+                <div class='hide_me' id='no-perms'><b>&staff.server.admin.org_unit_settings.no_perms;</b></div>
+            </div>
             <div dojoType="dijit.layout.ContentPane" layoutAlign='client' class='tall'>
                 <script>
                     var osGridLayout = [{