more correct permission handling for registering workstations..builds the library...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 30 Apr 2009 20:47:35 +0000 (20:47 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 30 Apr 2009 20:47:35 +0000 (20:47 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13025 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/main/ws_info.xul

index 0003e9e..f5ce8a7 100644 (file)
@@ -229,6 +229,8 @@ const api = {
        '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' },
index 122d17b..b629ceb 100644 (file)
                                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_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 = [];
+            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',
+                    [ 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 = {};