mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-16 21:55:37 -05:00
Refactor permissions check code
Directly check permissions and no subscription (uisettings is always initialized on frontend startup) update permission directive to accept single string add explicit management permission name
This commit is contained in:
@@ -553,11 +553,9 @@ export class DocumentDetailComponent
|
||||
}
|
||||
|
||||
get commentsEnabled(): boolean {
|
||||
// TODO - Is this the only way to allow/disallow from permissions?
|
||||
var canViewComments = false
|
||||
this.settings.permissions().subscribe((perm) => {
|
||||
canViewComments = perm.includes('documents.view_comment')
|
||||
})
|
||||
return this.settings.get(SETTINGS_KEYS.COMMENTS_ENABLED) && canViewComments
|
||||
return (
|
||||
this.settings.get(SETTINGS_KEYS.COMMENTS_ENABLED) &&
|
||||
this.settings.currentUserCan('documents.view_comment')
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user