Fix manage library and admin permissions

This commit is contained in:
adityachandelgit
2025-05-17 22:25:59 -06:00
committed by Aditya Chandel
parent 9675820052
commit 8d8379e689
9 changed files with 28 additions and 16 deletions
@@ -30,7 +30,7 @@
<span *ngIf="(item.routerLink && !item.items) && item.visible !== false">
<ng-container *ngIf="item.type === 'Library' || item.type === 'Shelf'">
<p-button
*ngIf="(item.type !== 'Library' || canManipulateLibrary) && item.label !== 'Unshelved'"
*ngIf="(item.type !== 'Library' || (admin || canManipulateLibrary)) && item.label !== 'Unshelved'"
(click)="entitymenu.toggle($event)"
(mouseover)="hovered = true"
(mouseleave)="hovered = false"
@@ -46,7 +46,7 @@
<p-menu #entitymenu [model]="item.menu" [popup]="true" appendTo="body"></p-menu>
</ng-container>
<ng-container *ngIf="item.type === 'Library' && !canManipulateLibrary || item.type === 'All Books' || item.label === 'Unshelved'">
<ng-container *ngIf="item.type === 'Library' && (!admin && !canManipulateLibrary) || item.type === 'All Books' || item.label === 'Unshelved'">
<p class="text-[var(--primary-color)] pr-1">
{{ (item.bookCount$ | async)?.toString() || '0' }}
</p>
@@ -49,6 +49,7 @@ export class AppMenuitemComponent implements OnInit, OnDestroy {
key: string = "";
canManipulateLibrary: boolean = false;
admin: boolean = false;
menuSourceSubscription: Subscription;
menuResetSubscription: Subscription;
@@ -57,6 +58,7 @@ export class AppMenuitemComponent implements OnInit, OnDestroy {
this.userService.userData$.subscribe(userData => {
if (userData) {
this.canManipulateLibrary = userData.permissions.canManipulateLibrary;
this.admin = userData.permissions.admin;
}
});
this.menuSourceSubscription = this.menuService.menuSource$.subscribe(value => {