Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Chore: hide slim toggler if insufficient permissions

shamoon819f6063351d
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.html b/src-ui/src/app/components/app-frame/app-frame.component.html
index 7ec92cda8..673eaf03b 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.html
+++ b/src-ui/src/app/components/app-frame/app-frame.component.html
@@ -68,13 +68,15 @@
<nav id="sidebarMenu" class="d-md-block bg-light sidebar collapse"
[ngClass]="slimSidebarEnabled ? 'slim' : 'col-md-3 col-lg-2 col-xxxl-1'" [class.animating]="slimSidebarAnimating"
[ngbCollapse]="isMenuCollapsed">
- <button class="btn btn-sm btn-dark sidebar-slim-toggler" (click)="toggleSlimSidebar()">
- @if (slimSidebarEnabled) {
- <i-bs width="0.9em" height="0.9em" name="chevron-double-right"></i-bs>
- } @else {
- <i-bs width="0.9em" height="0.9em" name="chevron-double-left"></i-bs>
- }
- </button>
+ @if (canSaveSettings) {
+ <button class="btn btn-sm btn-dark sidebar-slim-toggler" (click)="toggleSlimSidebar()">
+ @if (slimSidebarEnabled) {
+ <i-bs width="0.9em" height="0.9em" name="chevron-double-right"></i-bs>
+ } @else {
+ <i-bs width="0.9em" height="0.9em" name="chevron-double-left"></i-bs>
+ }
+ </button>
+ }
<div class="sidebar-sticky pt-3 d-flex flex-column justify-space-around">
<ul class="nav flex-column">
<li class="nav-item app-link">
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.ts b/src-ui/src/app/components/app-frame/app-frame.component.ts
index 28f6ad9b9..03033cb46 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.ts
+++ b/src-ui/src/app/components/app-frame/app-frame.component.ts
@@ -152,6 +152,19 @@ export class AppFrameComponent
return this.settingsService.get(SETTINGS_KEYS.APP_TITLE)
}
+ get canSaveSettings(): boolean {
+ return (
+ this.permissionsService.currentUserCan(
+ PermissionAction.Change,
+ PermissionType.UISettings
+ ) &&
+ this.permissionsService.currentUserCan(
+ PermissionAction.Add,
+ PermissionType.UISettings
+ )
+ )
+ }
+
get slimSidebarEnabled(): boolean {
return this.settingsService.get(SETTINGS_KEYS.SLIM_SIDEBAR)
}