From: Liam Whalen Date: Thu, 5 Nov 2015 22:12:40 +0000 (-0800) Subject: LP#1175400 Added perm for overrider X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d908900a72257b8fd1efc6cbb1c56a95231026b9;p=working%2FEvergreen.git 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 --- 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); + } } );