From 2e36f99c5c368f5b8f21c0bfd67ee3380478516b Mon Sep 17 00:00:00 2001 From: Liam Whalen Date: Thu, 5 Nov 2015 14:12:40 -0800 Subject: [PATCH] LP#1175400 Added perm for overrider When overriding an over allocation, the user now needs the ACQ_OVERRIDE_OVER_ALLOCATION perm. TODO: refactor the code. Signed-off-by: Liam Whalen --- .../web/js/ui/default/acq/financial/view_funding_source.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js b/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js index 1c1c5465b7..c505041fc8 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js +++ b/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js @@ -66,7 +66,18 @@ function applyFSAllocation(fields) { dojo.connect(oilsFSOverAllocateOverride, 'onClick', function() { oilsFSOverAllocateDialog.hide(); - doAllocation(fields); + + // Are we allowed to touch the barred state? + var permission = 'ACQ_OVERRIDE_OVER_ALLOCATION'; + var staff = new openils.User().user; + var ou = staff.ws_ou(); + var resp = fieldmapper.standardRequest( + ['open-ils.actor', 'open-ils.actor.user.perm.check'], + { params : [openils.User.authtoken, staff.id(), ou, [permission] ] } + ); + if(!resp[0]) { + doAllocation(fields); + } } ); -- 2.11.0