mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
Fix: remove admin.logentry perm, use admin (staff) status (#6380)
This commit is contained in:
@@ -418,4 +418,25 @@ describe('PermissionsService', () => {
|
||||
)
|
||||
).toBeTruthy()
|
||||
})
|
||||
|
||||
it('correctly checks admin status', () => {
|
||||
permissionsService.initialize([], {
|
||||
username: 'testuser',
|
||||
last_name: 'User',
|
||||
first_name: 'Test',
|
||||
id: 1,
|
||||
is_staff: true,
|
||||
})
|
||||
|
||||
expect(permissionsService.isAdmin()).toBeTruthy()
|
||||
|
||||
permissionsService.initialize([], {
|
||||
username: 'testuser',
|
||||
last_name: 'User',
|
||||
first_name: 'Test',
|
||||
id: 1,
|
||||
})
|
||||
|
||||
expect(permissionsService.isAdmin()).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
@@ -24,7 +24,6 @@ export enum PermissionType {
|
||||
MailRule = '%s_mailrule',
|
||||
User = '%s_user',
|
||||
Group = '%s_group',
|
||||
Admin = '%s_logentry',
|
||||
ShareLink = '%s_sharelink',
|
||||
CustomField = '%s_customfield',
|
||||
Workflow = '%s_workflow',
|
||||
@@ -52,6 +51,10 @@ export class PermissionsService {
|
||||
)
|
||||
}
|
||||
|
||||
public isAdmin(): boolean {
|
||||
return this.currentUser?.is_staff
|
||||
}
|
||||
|
||||
public currentUserOwnsObject(object: ObjectWithPermissions): boolean {
|
||||
return (
|
||||
!object ||
|
||||
|
Reference in New Issue
Block a user