mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
lint for eslint
This commit is contained in:
@@ -14,12 +14,12 @@ import {
|
||||
} from '../services/permissions.service'
|
||||
|
||||
@Directive({
|
||||
selector: '[ifObjectPermissions]',
|
||||
selector: '[appIfObjectPermissions]',
|
||||
})
|
||||
export class IfObjectPermissionsDirective implements OnInit, OnChanges {
|
||||
// The role the user must have
|
||||
@Input()
|
||||
ifObjectPermissions: {
|
||||
appIfObjectPermissions: {
|
||||
object: ObjectWithPermissions
|
||||
action: PermissionAction
|
||||
}
|
||||
@@ -39,10 +39,10 @@ export class IfObjectPermissionsDirective implements OnInit, OnChanges {
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (
|
||||
!this.ifObjectPermissions?.object ||
|
||||
!this.appIfObjectPermissions?.object ||
|
||||
this.permissionsService.currentUserHasObjectPermissions(
|
||||
this.ifObjectPermissions.action,
|
||||
this.ifObjectPermissions.object
|
||||
this.appIfObjectPermissions.action,
|
||||
this.appIfObjectPermissions.object
|
||||
)
|
||||
) {
|
||||
if (!this.createdView)
|
||||
|
@@ -11,12 +11,12 @@ import { ObjectWithPermissions } from '../data/object-with-permissions'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
|
||||
@Directive({
|
||||
selector: '[ifOwner]',
|
||||
selector: '[appIfOwner]',
|
||||
})
|
||||
export class IfOwnerDirective implements OnInit, OnChanges {
|
||||
// The role the user must have
|
||||
@Input()
|
||||
ifOwner: ObjectWithPermissions
|
||||
appIfOwner: ObjectWithPermissions
|
||||
|
||||
createdView: EmbeddedViewRef<any>
|
||||
|
||||
@@ -32,7 +32,7 @@ export class IfOwnerDirective implements OnInit, OnChanges {
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (this.permissionsService.currentUserOwnsObject(this.ifOwner)) {
|
||||
if (this.permissionsService.currentUserOwnsObject(this.appIfOwner)) {
|
||||
if (!this.createdView)
|
||||
this.createdView = this.viewContainerRef.createEmbeddedView(
|
||||
this.templateRef
|
||||
|
@@ -12,11 +12,11 @@ import {
|
||||
} from '../services/permissions.service'
|
||||
|
||||
@Directive({
|
||||
selector: '[ifPermissions]',
|
||||
selector: '[appIfPermissions]',
|
||||
})
|
||||
export class IfPermissionsDirective implements OnInit {
|
||||
@Input()
|
||||
ifPermissions:
|
||||
appIfPermissions:
|
||||
| Array<{ action: PermissionAction; type: PermissionType }>
|
||||
| { action: PermissionAction; type: PermissionType }
|
||||
|
||||
@@ -34,7 +34,7 @@ export class IfPermissionsDirective implements OnInit {
|
||||
public ngOnInit(): void {
|
||||
if (
|
||||
[]
|
||||
.concat(this.ifPermissions)
|
||||
.concat(this.appIfPermissions)
|
||||
.every((perm: { action: PermissionAction; type: PermissionType }) =>
|
||||
this.permissionsService.currentUserCan(perm.action, perm.type)
|
||||
)
|
||||
|
Reference in New Issue
Block a user