mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
prevent edit docs when dont have global edit perms
This commit is contained in:
parent
bec8d00232
commit
1718cf6504
@ -71,7 +71,7 @@
|
||||
<div class="col-auto ms-auto mb-2 mb-xl-0 d-flex">
|
||||
<div class="btn-toolbar me-2">
|
||||
|
||||
<button type="button" class="btn btn-sm btn-outline-primary me-2" (click)="setPermissions()" [disabled]="!userOwnsAll">
|
||||
<button type="button" class="btn btn-sm btn-outline-primary me-2" (click)="setPermissions()" [disabled]="!userOwnsAll || !userCanEditAll">
|
||||
<svg width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor">
|
||||
<use xlink:href="assets/bootstrap-icons.svg#person-fill-lock" />
|
||||
</svg> <ng-container i18n>Permissions</ng-container>
|
||||
|
@ -27,7 +27,11 @@ import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from 'src/app/services/permissions.service'
|
||||
import { FormControl, FormGroup } from '@angular/forms'
|
||||
import { first, Subject, takeUntil } from 'rxjs'
|
||||
|
||||
@ -83,7 +87,12 @@ export class BulkEditorComponent
|
||||
)
|
||||
|
||||
get userCanEditAll(): boolean {
|
||||
let canEdit: boolean = true
|
||||
let canEdit: boolean = this.permissionService.currentUserCan(
|
||||
PermissionAction.Change,
|
||||
PermissionType.Document
|
||||
)
|
||||
if (!canEdit) return false
|
||||
|
||||
const docs = this.list.documents.filter((d) => this.list.selected.has(d.id))
|
||||
canEdit = docs.every((d) =>
|
||||
this.permissionService.currentUserHasObjectPermissions(
|
||||
|
Loading…
x
Reference in New Issue
Block a user