[open-ils-commits] r7558 -
branches/rel_1_2/Evergreen/xul/staff_client/server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 17 12:23:59 EDT 2007
Author: erickson
Date: 2007-07-17 12:18:26 -0400 (Tue, 17 Jul 2007)
New Revision: 7558
Modified:
branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue.js
branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue_config.js
Log:
removed hard-coded group application_perms in favor of grabbing them dynamically from the set of retrieved groups
Modified: branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue.js
===================================================================
--- branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue.js 2007-07-16 20:19:33 UTC (rev 7557)
+++ branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue.js 2007-07-17 16:18:26 UTC (rev 7558)
@@ -105,9 +105,29 @@
/* ------------------------------------------------------------------------------ */
+/*
+ * adds all of the group.application_perm's to the list
+ * provided by descending through the group tree
+ */
+function buildAppPermList(list, group) {
+ if(!group) return;
+ if(group.application_perm() )
+ list.push(group.application_perm());
+ for(i in group.children()) {
+ buildAppPermList(list, group.children()[i]);
+ }
+}
-/* fetches necessary and builds the UI */
+/* fetches necessary objects and builds the UI */
function uEditBuild() {
+
+ myPerms = ['BAR_PATRON'];
+
+ /* grab the groups before we check perms so we know what
+ application_perms to check */
+ var groups = uEditFetchGroups();
+ buildAppPermList(myPerms, groups);
+
fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
uEditBuildLibSelector();
@@ -119,7 +139,7 @@
uEditDraw(
uEditFetchIdentTypes(),
- uEditFetchGroups(),
+ groups,
uEditFetchStatCats(),
uEditFetchSurveys(),
uEditFetchNetLevels()
Modified: branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue_config.js
===================================================================
--- branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue_config.js 2007-07-16 20:19:33 UTC (rev 7557)
+++ branches/rel_1_2/Evergreen/xul/staff_client/server/patron/ue_config.js 2007-07-17 16:18:26 UTC (rev 7558)
@@ -21,23 +21,6 @@
const ADULT_AGE = 18;
//const GUARDIAN_NOTE = 'SYSTEM: Parent/Guardian';
-/* if they don't have these perms, they shouldn't be here */
-var myPerms = [
- 'BAR_PATRON',
- 'group_application.user',
- 'group_application.user.patron',
- 'group_application.user.staff',
- 'group_application.user.staff.circ',
- 'group_application.user.staff.cat',
- 'group_application.user.staff.admin.global_admin',
- 'group_application.user.staff.admin.local_admin',
- 'group_application.user.staff.admin.lib_manager',
- 'group_application.user.staff.cat.cat1',
- 'group_application.user.staff.supercat',
- 'group_application.user.sip_client',
- 'group_application.user.vendor'
- ];
-
var dataFields;
const numRegex = /^\d+$/;
const wordRegex = /^[\w-]+$/;
More information about the open-ils-commits
mailing list