[open-ils-commits] r13025 - in trunk/Open-ILS/xul/staff_client: chrome/content/main server/main (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 30 16:47:39 EDT 2009


Author: phasefx
Date: 2009-04-30 16:47:35 -0400 (Thu, 30 Apr 2009)
New Revision: 13025

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/main/ws_info.xul
Log:
more correct permission handling for registering workstations..builds the library drop-down based on work orgs.  But was also done because I was getting a weird -1 result on the admin user from open-ils.actor.user.perm.highest_org

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-04-30 20:44:08 UTC (rev 13024)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-04-30 20:47:35 UTC (rev 13025)
@@ -229,6 +229,8 @@
 	'PERM_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check' },
 	'PERM_MULTI_ORG_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check.multi_org' },
 	'PERM_RETRIEVE_HIGHEST_ORG' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.highest_org' },
+	'PERM_RETRIEVE_WORK_OU' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.has_work_perm_at' },
+	'BATCH_PERM_RETRIEVE_WORK_OU' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.has_work_perm_at.batch' },
 	'MARC_XML_RECORD_CREATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.create' },
 	'MARC_XML_RECORD_IMPORT' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.import' },
 	'MARC_XML_RECORD_REPLACE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.marc.replace' },

Modified: trunk/Open-ILS/xul/staff_client/server/main/ws_info.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/main/ws_info.xul	2009-04-30 20:44:08 UTC (rev 13024)
+++ trunk/Open-ILS/xul/staff_client/server/main/ws_info.xul	2009-04-30 20:47:35 UTC (rev 13025)
@@ -76,25 +76,28 @@
 				g.aout_hash[ g.aout_list[i].id() ] = g.aout_list[i];
 			}
 
-			var highest_org_id = g.network.simple_request(
-				'PERM_RETRIEVE_HIGHEST_ORG',
-				[ xulG.auth.session.key, g.user.id(), 'REGISTER_WORKSTATION']
+			var work_ous = g.network.simple_request(
+				'PERM_RETRIEVE_WORK_OU',
+				[ xulG.auth.session.key, 'REGISTER_WORKSTATION']
 			);
-			if (highest_org_id == -1 || highest_org_id == '-1') {
+			if (work_ous.length == 0) {
 				alert(document.getElementById('commonStrings').getString('staff.main.gen_offline_widgets.workstation_registration_denied'));
 				xulG.auth.logoff();
 				return;
 			}
-			var perm_depth = findOrgDepth( highest_org_id );
+            g.my_libs = [];
+            for (var i = 0; i < work_ous.length; i++ ) {
+                var perm_depth = findOrgDepth( work_ous[i] );
 
-			g.my_libs_tree = g.network.simple_request(
-				'FM_AOU_DESCENDANTS_RETRIEVE',
-				[ g.user.home_ou(), perm_depth ]
-			);
-			if (!instanceOf(g.my_libs_tree,aou)) { /* FIXME - workaround for weird descendants call result */
-				g.my_libs_tree = g.my_libs_tree[0];
-			}
-			g.my_libs = util.fm_utils.flatten_ou_branch( g.my_libs_tree );
+                g.my_libs_tree = g.network.simple_request(
+                    'FM_AOU_DESCENDANTS_RETRIEVE',
+                    [ work_ous[i], perm_depth ]
+                );
+                if (!instanceOf(g.my_libs_tree,aou)) { /* FIXME - workaround for weird descendants call result */
+                    g.my_libs_tree = g.my_libs_tree[0];
+                }
+			    g.my_libs = g.my_libs.concat( util.fm_utils.flatten_ou_branch( g.my_libs_tree ) );
+            }
 
 			g.my_libs_shortname_hash = {};
 			g.my_libs_ou_hash = {};



More information about the open-ils-commits mailing list