mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-26 01:16:16 +00:00
Chore: update to Angular 20 (#10273)
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
ViewContainerRef,
|
||||
inject,
|
||||
} from '@angular/core'
|
||||
import { ObjectWithPermissions } from '../data/object-with-permissions'
|
||||
import {
|
||||
@@ -17,6 +18,10 @@ import {
|
||||
selector: '[pngxIfObjectPermissions]',
|
||||
})
|
||||
export class IfObjectPermissionsDirective implements OnInit, OnChanges {
|
||||
private viewContainerRef = inject(ViewContainerRef)
|
||||
private templateRef = inject<TemplateRef<any>>(TemplateRef)
|
||||
private permissionsService = inject(PermissionsService)
|
||||
|
||||
// The role the user must have
|
||||
@Input()
|
||||
pngxIfObjectPermissions: {
|
||||
@@ -26,17 +31,6 @@ export class IfObjectPermissionsDirective implements OnInit, OnChanges {
|
||||
|
||||
createdView: EmbeddedViewRef<any>
|
||||
|
||||
/**
|
||||
* @param {ViewContainerRef} viewContainerRef -- The location where we need to render the templateRef
|
||||
* @param {TemplateRef<any>} templateRef -- The templateRef to be potentially rendered
|
||||
* @param {PermissionsService} permissionsService -- Will give us access to the permissions a user has
|
||||
*/
|
||||
constructor(
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private templateRef: TemplateRef<any>,
|
||||
private permissionsService: PermissionsService
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (
|
||||
!this.pngxIfObjectPermissions?.object ||
|
||||
|
@@ -6,6 +6,7 @@ import {
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
ViewContainerRef,
|
||||
inject,
|
||||
} from '@angular/core'
|
||||
import { ObjectWithPermissions } from '../data/object-with-permissions'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
@@ -14,23 +15,16 @@ import { PermissionsService } from '../services/permissions.service'
|
||||
selector: '[pngxIfOwner]',
|
||||
})
|
||||
export class IfOwnerDirective implements OnInit, OnChanges {
|
||||
private viewContainerRef = inject(ViewContainerRef)
|
||||
private templateRef = inject<TemplateRef<any>>(TemplateRef)
|
||||
private permissionsService = inject(PermissionsService)
|
||||
|
||||
// The role the user must have
|
||||
@Input()
|
||||
pngxIfOwner: ObjectWithPermissions
|
||||
|
||||
createdView: EmbeddedViewRef<any>
|
||||
|
||||
/**
|
||||
* @param {ViewContainerRef} viewContainerRef -- The location where we need to render the templateRef
|
||||
* @param {TemplateRef<any>} templateRef -- The templateRef to be potentially rendered
|
||||
* @param {PermissionsService} permissionsService -- Will give us access to the permissions a user has
|
||||
*/
|
||||
constructor(
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private templateRef: TemplateRef<any>,
|
||||
private permissionsService: PermissionsService
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (this.permissionsService.currentUserOwnsObject(this.pngxIfOwner)) {
|
||||
if (!this.createdView)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
Directive,
|
||||
inject,
|
||||
Input,
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
@@ -15,22 +16,15 @@ import {
|
||||
selector: '[pngxIfPermissions]',
|
||||
})
|
||||
export class IfPermissionsDirective implements OnInit {
|
||||
private viewContainerRef = inject(ViewContainerRef)
|
||||
private templateRef = inject<TemplateRef<any>>(TemplateRef)
|
||||
private permissionsService = inject(PermissionsService)
|
||||
|
||||
@Input()
|
||||
pngxIfPermissions:
|
||||
| Array<{ action: PermissionAction; type: PermissionType }>
|
||||
| { action: PermissionAction; type: PermissionType }
|
||||
|
||||
/**
|
||||
* @param {ViewContainerRef} viewContainerRef -- The location where we need to render the templateRef
|
||||
* @param {TemplateRef<any>} templateRef -- The templateRef to be potentially rendered
|
||||
* @param {PermissionsService} permissionsService -- Will give us access to the permissions a user has
|
||||
*/
|
||||
constructor(
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private templateRef: TemplateRef<any>,
|
||||
private permissionsService: PermissionsService
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
if (
|
||||
[]
|
||||
|
Reference in New Issue
Block a user