mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Fix inherited permissions should not display per user in permissions form
This commit is contained in:
@@ -77,7 +77,7 @@ export class SelectComponent extends AbstractInputComponent<number> {
|
||||
}
|
||||
|
||||
get isPrivate(): boolean {
|
||||
return this.items.find((i) => i.id === this.value)?.private
|
||||
return this.items?.find((i) => i.id === this.value)?.private
|
||||
}
|
||||
|
||||
getSuggestions() {
|
||||
|
@@ -9,7 +9,7 @@ export interface PaperlessUser extends ObjectWithId {
|
||||
is_staff?: boolean
|
||||
is_active?: boolean
|
||||
is_superuser?: boolean
|
||||
groups?: PaperlessGroup[]
|
||||
groups?: number[] // PaperlessGroup[]
|
||||
user_permissions?: string[]
|
||||
inherited_permissions?: string[]
|
||||
}
|
||||
|
@@ -58,11 +58,16 @@ export class PermissionsService {
|
||||
action: string,
|
||||
object: ObjectWithPermissions
|
||||
): boolean {
|
||||
let actionObject = null
|
||||
if (action === PermissionAction.View) actionObject = object.permissions.view
|
||||
else if (action === PermissionAction.Change)
|
||||
actionObject = object.permissions.change
|
||||
if (!actionObject) return false
|
||||
return (
|
||||
this.currentUserOwnsObject(object) ||
|
||||
(object.permissions[action]['users'] as Array<number>)?.includes(
|
||||
this.currentUser.id
|
||||
)
|
||||
actionObject.users.includes(this.currentUser.id) ||
|
||||
actionObject.groups.filter((g) => this.currentUser.groups.includes(g))
|
||||
.length > 0
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user