From 5375b0d599e8b9eedda164b1930dd81c48b4c3a3 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sun, 19 Jan 2020 14:47:40 -0500 Subject: [PATCH] LP#1860351: fix hasWorkPermHere() in Angular client Fixes a bug where the Angular client's hasWorkPermHere() check could return incorrect results and thus incorrectly report whether or not the staff user currently has particularl permissions at their current workstation. To test ------- [1] Arrange for a workstation whose internal ID is larger than any of the org unit IDs. [2] Log in to that workstation with a user who has permission to update monograph parts. [4] In the experimental Angular staff catalog, go to a record (e.g., /eg2/en-US/staff/catalog/record/21/monoparts) and note that the New Monograph Part button is disabled. [5] Apply the patch and repeat step 4. This time, the button should be active. Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/core/perm.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/core/perm.service.ts b/Open-ILS/src/eg2/src/app/core/perm.service.ts index 2b3a471ad2..ffc59badb1 100644 --- a/Open-ILS/src/eg2/src/app/core/perm.service.ts +++ b/Open-ILS/src/eg2/src/app/core/perm.service.ts @@ -49,10 +49,11 @@ export class PermService { return Promise.reject('hasWorkPermHere requires a workstation'); } + const ws_ou: number = +this.auth.user().ws_ou(); return this.hasWorkPermAt(permNames, true).then(resp => { const answer: HasPermHereResult = {}; Object.keys(resp).forEach(perm => { - answer[perm] = resp[perm].indexOf(wsId) > -1; + answer[perm] = resp[perm].indexOf(ws_ou) > -1; }); return answer; }); -- 2.43.2