Merge pull request #3061 from paperless-ngx/fix/issue-3053

Fix: Hide Permissions tab if user cannot view users
This commit is contained in:
shamoon 2023-04-09 16:41:45 -07:00 committed by GitHub
commit 8f90fe79c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -178,7 +178,7 @@
</ng-template>
</li>
<li [ngbNavItem]="DocumentDetailNavIDs.Permissions" *appIfOwner="document">
<li [ngbNavItem]="DocumentDetailNavIDs.Permissions" *ngIf="showPermissions">
<a ngbNavLink i18n>Permissions</a>
<ng-template ngbNavContent>
<div class="mb-3">

View File

@ -688,12 +688,21 @@ export class DocumentDetailComponent
}
}
get showPermissions(): boolean {
return (
this.permissionsService.currentUserCan(
PermissionAction.View,
PermissionType.User
) && this.userIsOwner
)
}
get notesEnabled(): boolean {
return (
this.settings.get(SETTINGS_KEYS.NOTES_ENABLED) &&
this.permissionsService.currentUserCan(
PermissionAction.View,
PermissionType.Document
PermissionType.Note
)
)
}