[GIT] Evergreen ILS branch main updated. 79c4070673f0dd8451e01212fbe52dcee076af47

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Evergreen ILS". The branch, main has been updated via 79c4070673f0dd8451e01212fbe52dcee076af47 (commit) from 02889b2bca033d4cc61664dd8b4a2181774faf18 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 79c4070673f0dd8451e01212fbe52dcee076af47 Author: Mike Rylander <mrylander@gmail.com> Date: Tue Jul 15 12:07:11 2025 -0400 LP#2102221: Check SHARE_REPORT_FOLDER permission This commit restricts the UI from offering to share a report-related folder outside of the range defined by SHARE_REPORT_FOLDER. Release-note: Bring back SHARE_REPORT_FOLDER permission check. Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Michele Morgan <mmorgan@noblenet.org> Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org> Signed-off-by: Jane Sandberg <sandbergja@gmail.com> diff --git a/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.html index a57007a9b9..8915277f62 100644 --- a/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.html +++ b/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.html @@ -18,7 +18,7 @@ </div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-success" + <button type="button" class="btn btn-success" [disabled]="!this.RSvc.globalCanShare" (click)="close(contextOrg)" i18n>Save</button> <button type="button" class="btn btn-outline-dark" (click)="close()" i18n>Cancel</button> diff --git a/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.ts index 3bca74f6e4..02a95f328d 100644 --- a/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/reporter/full/folder-share-org-dialog.component.ts @@ -5,6 +5,7 @@ import {IdlObject} from '@eg/core/idl.service'; import {NgbModal} from '@ng-bootstrap/ng-bootstrap'; import {OrgService} from '@eg/core/org.service'; import {AuthService} from '@eg/core/auth.service'; +import {ReporterService} from '../share/reporter.service'; @Component({ selector: 'folder-share-org-dialog', @@ -17,6 +18,7 @@ export class FolderShareOrgDialogComponent extends DialogComponent { contextOrg = null; constructor( + private RSvc: ReporterService, private modal: NgbModal, private org: OrgService, private auth: AuthService @@ -25,8 +27,21 @@ export class FolderShareOrgDialogComponent extends DialogComponent { } notMyOrgs() { + if (!this.RSvc.globalCanShare) // If they managed to open the dialog, but should not have been able to, just filter all orgs out + return this.org.list().map(n => n.id()); + + let found_it = false; + let above_me = this.org.ancestors(this.auth.user().ws_ou(), true).filter(n => { + if (!found_it) { // Have we found the "top" org yet? + if(n == this.RSvc.topPermOrg.SHARE_REPORT_FOLDER) { // We have now! + return found_it = true; // Filter the top one in. + } + } + return !found_it; // Filter those "above" + }); + return this.org.filterList( - { notInList: this.org.fullPath(this.auth.user().ws_ou(), true) }, + { notInList: this.org.descendants(this.auth.user().ws_ou(), true).concat(above_me) }, true ); } diff --git a/Open-ILS/src/eg2/src/app/staff/reporter/full/my-outputs.component.html b/Open-ILS/src/eg2/src/app/staff/reporter/full/my-outputs.component.html index 6203aaebd9..6566c3568b 100644 --- a/Open-ILS/src/eg2/src/app/staff/reporter/full/my-outputs.component.html +++ b/Open-ILS/src/eg2/src/app/staff/reporter/full/my-outputs.component.html @@ -103,7 +103,7 @@ <button type="button" i18n class="btn btn-outline-dark m-1" *ngIf="currentFolder && RSvc.folderIsMine(currentFolder)" (click)="newSubfolder()">Add Subfolder</button> <button type="button" i18n class="btn btn-outline-dark m-1" - *ngIf="currentFolder && RSvc.folderIsMine(currentFolder) && currentFolder.shared() === 'f'" (click)="shareFolder()">Share Folder</button> + *ngIf="RSvc.globalCanShare && currentFolder && RSvc.folderIsMine(currentFolder) && currentFolder.shared() === 'f'" (click)="shareFolder()">Share Folder</button> <button type="button" i18n class="btn btn-outline-dark m-1" *ngIf="currentFolder && RSvc.folderIsMine(currentFolder) && currentFolder.shared() === 't'" (click)="unshareFolder()">Unshare Folder</button> </div> diff --git a/Open-ILS/src/eg2/src/app/staff/reporter/full/my-reports.component.html b/Open-ILS/src/eg2/src/app/staff/reporter/full/my-reports.component.html index 37a7eb4a04..8e9972e73d 100644 --- a/Open-ILS/src/eg2/src/app/staff/reporter/full/my-reports.component.html +++ b/Open-ILS/src/eg2/src/app/staff/reporter/full/my-reports.component.html @@ -91,7 +91,7 @@ (onClick)="newSubfolder($event)"> </eg-grid-toolbar-button> - <eg-grid-toolbar-button label="Share Folder" i18n-label *ngIf="currentFolder && RSvc.folderIsMine(currentFolder) && currentFolder.shared() === 'f'" + <eg-grid-toolbar-button label="Share Folder" i18n-label *ngIf="RSvc.globalCanShare && currentFolder && RSvc.folderIsMine(currentFolder) && currentFolder.shared() === 'f'" #share (onClick)="shareFolder(share)"> </eg-grid-toolbar-button> diff --git a/Open-ILS/src/eg2/src/app/staff/reporter/full/my-templates.component.html b/Open-ILS/src/eg2/src/app/staff/reporter/full/my-templates.component.html index 414e02ac4c..d1750d58b0 100644 --- a/Open-ILS/src/eg2/src/app/staff/reporter/full/my-templates.component.html +++ b/Open-ILS/src/eg2/src/app/staff/reporter/full/my-templates.component.html @@ -88,7 +88,7 @@ (onClick)="newSubfolder($event)"> </eg-grid-toolbar-button> - <eg-grid-toolbar-button label="Share Folder" i18n-label *ngIf="currentFolder && RSvc.folderIsMine(currentFolder) && currentFolder.shared() === 'f'" + <eg-grid-toolbar-button label="Share Folder" i18n-label *ngIf="RSvc.globalCanShare && currentFolder && RSvc.folderIsMine(currentFolder) && currentFolder.shared() === 'f'" #share (onClick)="shareFolder(share)"> </eg-grid-toolbar-button> diff --git a/Open-ILS/src/eg2/src/app/staff/reporter/share/reporter.service.ts b/Open-ILS/src/eg2/src/app/staff/reporter/share/reporter.service.ts index c7cf9a37ac..027955dc97 100644 --- a/Open-ILS/src/eg2/src/app/staff/reporter/share/reporter.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/reporter/share/reporter.service.ts @@ -524,6 +524,9 @@ export class ReporterService { reportFolder: IdlObject = null; outputFolder: IdlObject = null; + globalCanShare: boolean = false; + topPermOrg = { RUN_REPORTS: -1, SHARE_REPORT_FOLDER: -1, VIEW_REPORT_OUTPUT: -1 }; + constructor ( private evt: EventService, private auth: AuthService, @@ -769,7 +772,20 @@ export class ReporterService { })) }; + const perm_list = [ 'RUN_REPORTS', 'SHARE_REPORT_FOLDER', 'VIEW_REPORT_OUTPUT' ]; return Promise.all([ + new Promise<void>((resolve, reject) => { + this.net.request( + 'open-ils.actor', + 'open-ils.actor.user.perm.highest_org.batch', + this.auth.token(), this.auth.user().id(), perm_list + ).toPromise() + .then(permset => { + permset.forEach((perm_org,ind) => this.topPermOrg[perm_list[ind]] = perm_org); + if (this.topPermOrg.SHARE_REPORT_FOLDER > -1) this.globalCanShare = true; + resolve(); + }); + }), new Promise<void>((resolve, reject) => { this.net.request( 'open-ils.reporter', ----------------------------------------------------------------------- Summary of changes: .../full/folder-share-org-dialog.component.html | 2 +- .../reporter/full/folder-share-org-dialog.component.ts | 17 ++++++++++++++++- .../app/staff/reporter/full/my-outputs.component.html | 2 +- .../app/staff/reporter/full/my-reports.component.html | 2 +- .../app/staff/reporter/full/my-templates.component.html | 2 +- .../src/app/staff/reporter/share/reporter.service.ts | 16 ++++++++++++++++ 6 files changed, 36 insertions(+), 5 deletions(-) hooks/post-receive -- Evergreen ILS
participants (1)
-
Git User