'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' },
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 = {};