From 321ef7b662c4ce0ff6fd63bf4d8cb2f7d2f9581a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 3 Jun 2011 09:27:26 -0400 Subject: [PATCH] Permission to control patron-collections-exempt Adds a new permission 'UPDATE_PATRON_COLLECTIONS_EXEMPT' which controls who can toggle the circ.collections.exempt user setting in the patron registration interface. Signed-off-by: Bill Erickson --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 5 ++++- Open-ILS/web/js/ui/default/actor/user/register.js | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 5e294f1bc8..f33a9d34f5 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1426,7 +1426,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES ( 507, 'ABORT_TRANSIT_ON_LOST', oils_i18n_gettext(507, 'Allows a user to abort a transit on a copy with status of LOST', 'ppl', 'description')), ( 508, 'ABORT_TRANSIT_ON_MISSING', oils_i18n_gettext(508, - 'Allows a user to abort a transit on a copy with status of MISSING', 'ppl', 'description')); + 'Allows a user to abort a transit on a copy with status of MISSING', 'ppl', 'description')), + ( 509, 'UPDATE_PATRON_COLLECTIONS_EXEMPT', oils_i18n_gettext(509, + 'Allows a user to indicate that a patron is exempt from collections processing', 'ppl', 'description')); SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000); @@ -1911,6 +1913,7 @@ INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) 'VIEW_CIRC_MATRIX_MATCHPOINT', 'ABORT_TRANSIT_ON_LOST', 'ABORT_TRANSIT_ON_MISSING', + 'UPDATE_PATRON_COLLECTIONS_EXEMPT', 'VIEW_HOLD_MATRIX_MATCHPOINT'); INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 9369e7e84f..23201ed592 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -581,7 +581,23 @@ function uEditDrawSettingRow(tbody, dividerRow, template, stype) { var row = template.cloneNode(true); row.setAttribute('user_setting', stype.name()); getByName(row, 'label').innerHTML = stype.label(); - var cb = new dijit.form.CheckBox({scrollOnFocus:false}, getByName(row, 'widget')); + var cbArgs = {scrollOnFocus : false}; + + if(stype.name() == 'circ.collections.exempt') { + // Staff require a special permission to exempt a user from collections + + var perm = fieldmapper.standardRequest( + ['open-ils.actor', 'open-ils.actor.user.has_work_perm_at'], + [openils.User.authtoken, 'UPDATE_PATRON_COLLECTIONS_EXEMPT']); + + /* If and until we implement recalc-perms on a patron home-lib change, having the + * perm at any org unit is sufficient. This should be considered a gobal permission. + */ + if(perm.length == 0) + cbArgs.disabled = true; + } + + var cb = new dijit.form.CheckBox(cbArgs, getByName(row, 'widget')); cb.attr('value', userSettings[stype.name()]); dojo.connect(cb, 'onChange', function(newVal) { userSettingsToUpdate[stype.name()] = newVal; }); tbody.insertBefore(row, dividerRow.nextSibling); -- 2.11.0