mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 07:45:32 +01: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:
parent
4603813896
commit
59e359ff98
25 changed files with 74 additions and 125 deletions
|
|
@ -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')
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue