mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-18 20:46:49 +01:00
disable document form components when no object permissions
This commit is contained in:
parent
d15c701510
commit
8b204cac99
18 changed files with 116 additions and 21 deletions
|
|
@ -7,7 +7,7 @@ import {
|
|||
ViewContainerRef,
|
||||
} from '@angular/core'
|
||||
import { PaperlessUser } from '../data/paperless-user'
|
||||
import { SettingsService } from '../services/settings.service'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
|
||||
@Directive({
|
||||
selector: '[ifOwner]',
|
||||
|
|
@ -25,11 +25,14 @@ export class IfOwnerDirective implements OnInit, OnChanges {
|
|||
constructor(
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private templateRef: TemplateRef<any>,
|
||||
private settings: SettingsService
|
||||
private permissionsService: PermissionsService
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (!this.ifOwner || this.ifOwner?.id === this.settings.currentUser.id) {
|
||||
if (
|
||||
!this.ifOwner ||
|
||||
this.permissionsService.currentUserIsOwner(this.ifOwner)
|
||||
) {
|
||||
this.viewContainerRef.createEmbeddedView(this.templateRef)
|
||||
} else {
|
||||
this.viewContainerRef.clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue