mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
feat: reflect django permissions on UI
This commit is contained in:
@@ -74,15 +74,27 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
if (
|
||||
this.showNotification(SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUCCESS)
|
||||
) {
|
||||
this.toastService.show({
|
||||
title: $localize`Document added`,
|
||||
delay: 10000,
|
||||
content: $localize`Document ${status.filename} was added to paperless.`,
|
||||
actionName: $localize`Open document`,
|
||||
action: () => {
|
||||
this.router.navigate(['documents', status.documentId])
|
||||
},
|
||||
// TODO - Is this the only way to allow/disallow from permissions?
|
||||
var canOpenDocuments = false
|
||||
this.settings.permissions().subscribe((perm) => {
|
||||
canOpenDocuments = perm.includes('documents.view_document')
|
||||
})
|
||||
if (canOpenDocuments)
|
||||
this.toastService.show({
|
||||
title: $localize`Document added`,
|
||||
delay: 10000,
|
||||
content: $localize`Document ${status.filename} was added to paperless.`,
|
||||
actionName: $localize`Open document`,
|
||||
action: () => {
|
||||
this.router.navigate(['documents', status.documentId])
|
||||
},
|
||||
})
|
||||
else
|
||||
this.toastService.show({
|
||||
title: $localize`Document added`,
|
||||
delay: 10000,
|
||||
content: $localize`Document ${status.filename} was added to paperless.`,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -199,7 +211,12 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public get dragDropEnabled(): boolean {
|
||||
return !this.router.url.includes('dashboard')
|
||||
// TODO - Is this the only way to allow/disallow from permissions?
|
||||
var canAddDocuments = false
|
||||
this.settings.permissions().subscribe((perm) => {
|
||||
canAddDocuments = perm.includes('documents.add_document')
|
||||
})
|
||||
return !this.router.url.includes('dashboard') && canAddDocuments
|
||||
}
|
||||
|
||||
public fileOver() {
|
||||
|
Reference in New Issue
Block a user