mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	lint for eslint
This commit is contained in:
		| @@ -14,6 +14,7 @@ | ||||
|                 4 | ||||
|             ], | ||||
|             "created": "2022-03-22T07:24:18Z", | ||||
|             "created_date": "2022-03-22", | ||||
|             "modified": "2022-03-22T07:24:23.264859Z", | ||||
|             "added": "2022-03-22T07:24:22.922631Z", | ||||
|             "archive_serial_number": null, | ||||
| @@ -31,6 +32,7 @@ | ||||
|             "content": "Test document PDF", | ||||
|             "tags": [], | ||||
|             "created": "2022-03-23T07:24:18Z", | ||||
|             "created_date": "2022-03-23", | ||||
|             "modified": "2022-03-23T07:24:23.264859Z", | ||||
|             "added": "2022-03-23T07:24:22.922631Z", | ||||
|             "archive_serial_number": 12345, | ||||
| @@ -50,6 +52,7 @@ | ||||
|                 2 | ||||
|             ], | ||||
|             "created": "2022-03-24T07:24:18Z", | ||||
|             "created_date": "2022-03-24", | ||||
|             "modified": "2022-03-24T07:24:23.264859Z", | ||||
|             "added": "2022-03-24T07:24:22.922631Z", | ||||
|             "archive_serial_number": null, | ||||
| @@ -69,6 +72,7 @@ | ||||
|                 4, 5 | ||||
|             ], | ||||
|             "created": "2022-06-01T07:24:18Z", | ||||
|             "created_date": "2022-06-01", | ||||
|             "modified": "2022-06-01T07:24:23.264859Z", | ||||
|             "added": "2022-06-01T07:24:22.922631Z", | ||||
|             "archive_serial_number": 12347, | ||||
|   | ||||
| @@ -5,11 +5,11 @@ beforeEach(() => { | ||||
|     fixture: 'ui_settings/settings.json', | ||||
|   }) | ||||
|  | ||||
|   cy.intercept('http://localhost:8000/api/users/', { | ||||
|   cy.intercept('http://localhost:8000/api/users/*', { | ||||
|     fixture: 'users/users.json', | ||||
|   }) | ||||
|  | ||||
|   cy.intercept('http://localhost:8000/api/groups/', { | ||||
|   cy.intercept('http://localhost:8000/api/groups/*', { | ||||
|     fixture: 'groups/groups.json', | ||||
|   }) | ||||
|  | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
|     </svg> | ||||
|     <span class="ms-2" [class.visually-hidden]="slimSidebarEnabled" i18n="app title">Paperless-ngx</span> | ||||
|   </a> | ||||
|   <div class="search-form-container flex-grow-1 py-2 pb-3 pb-sm-2 px-3 ps-md-4 me-sm-auto order-3 order-sm-1" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|   <div class="search-form-container flex-grow-1 py-2 pb-3 pb-sm-2 px-3 ps-md-4 me-sm-auto order-3 order-sm-1" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|     <form (ngSubmit)="search()" class="form-inline flex-grow-1"> | ||||
|       <svg width="1em" height="1em" fill="currentColor"> | ||||
|         <use xlink:href="assets/bootstrap-icons.svg#search"/> | ||||
| @@ -39,7 +39,7 @@ | ||||
|           <p class="small mb-0 px-3 text-muted" i18n>Logged in as {{this.settingsService.displayName}}</p> | ||||
|           <div class="dropdown-divider"></div> | ||||
|         </div> | ||||
|         <a ngbDropdownItem class="nav-link" routerLink="settings" (click)="closeMenu()" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.UISettings }"> | ||||
|         <a ngbDropdownItem class="nav-link" routerLink="settings" (click)="closeMenu()" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.UISettings }"> | ||||
|           <svg class="sidebaricon me-2" fill="currentColor"> | ||||
|             <use xlink:href="assets/bootstrap-icons.svg#gear"/> | ||||
|           </svg><ng-container i18n>Settings</ng-container> | ||||
| @@ -72,7 +72,7 @@ | ||||
|               </svg><span> <ng-container i18n>Dashboard</ng-container></span> | ||||
|             </a> | ||||
|           </li> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|             <a class="nav-link" routerLink="documents" routerLinkActive="active" (click)="closeMenu()" ngbPopover="Documents" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#files"/> | ||||
| @@ -80,7 +80,7 @@ | ||||
|             </a> | ||||
|           </li> | ||||
|         </ul> | ||||
|         <div *ifPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }"> | ||||
|         <div *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }"> | ||||
|           <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted" *ngIf='savedViewService.loading || savedViewService.sidebarViews.length > 0'> | ||||
|             <span i18n>Saved views</span> | ||||
|             <div *ngIf="savedViewService.loading" class="spinner-border spinner-border-sm fw-normal ms-2" role="status"></div> | ||||
| @@ -96,7 +96,7 @@ | ||||
|           </ul> | ||||
|         </div> | ||||
|  | ||||
|         <div *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|         <div *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|           <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted" *ngIf='openDocuments.length > 0'> | ||||
|             <span i18n>Open documents</span> | ||||
|           </h6> | ||||
| @@ -127,35 +127,35 @@ | ||||
|           <span i18n>Manage</span> | ||||
|         </h6> | ||||
|         <ul class="nav flex-column mb-2"> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Correspondent }"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Correspondent }"> | ||||
|             <a class="nav-link" routerLink="correspondents" routerLinkActive="active" (click)="closeMenu()" ngbPopover="Correspondents" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#person"/> | ||||
|               </svg><span> <ng-container i18n>Correspondents</ng-container></span> | ||||
|             </a> | ||||
|           </li> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Tag }" tourAnchor="tour.tags"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Tag }" tourAnchor="tour.tags"> | ||||
|             <a class="nav-link" routerLink="tags" routerLinkActive="active" (click)="closeMenu()" ngbPopover="Tags" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#tags"/> | ||||
|               </svg><span> <ng-container i18n>Tags</ng-container></span> | ||||
|             </a> | ||||
|           </li> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.DocumentType }"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.DocumentType }"> | ||||
|             <a class="nav-link" routerLink="documenttypes" routerLinkActive="active" (click)="closeMenu()" ngbPopover="Document types" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#hash"/> | ||||
|               </svg><span> <ng-container i18n>Document types</ng-container></span> | ||||
|             </a> | ||||
|           </li> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.StoragePath }"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.StoragePath }"> | ||||
|             <a class="nav-link" routerLink="storagepaths" routerLinkActive="active" (click)="closeMenu()" ngbPopover="Storage paths" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#folder"/> | ||||
|               </svg><span> <ng-container i18n>Storage paths</ng-container></span> | ||||
|             </a> | ||||
|           </li> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.PaperlessTask }" tourAnchor="tour.file-tasks"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.PaperlessTask }" tourAnchor="tour.file-tasks"> | ||||
|             <a class="nav-link" routerLink="tasks" routerLinkActive="active" (click)="closeMenu()" ngbPopover="File Tasks" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <span *ngIf="tasksService.failedFileTasks.length > 0 && slimSidebarEnabled" class="badge bg-danger position-absolute top-0 end-0">{{tasksService.failedFileTasks.length}}</span> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
| @@ -163,14 +163,14 @@ | ||||
|               </svg><span> <ng-container i18n>File Tasks<span *ngIf="tasksService.failedFileTasks.length > 0"><span class="badge bg-danger ms-2">{{tasksService.failedFileTasks.length}}</span></span></ng-container></span> | ||||
|             </a> | ||||
|           </li> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Admin }"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Admin }"> | ||||
|             <a class="nav-link" routerLink="logs" routerLinkActive="active" (click)="closeMenu()" ngbPopover="Logs" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#text-left"/> | ||||
|               </svg><span> <ng-container i18n>Logs</ng-container></span> | ||||
|             </a> | ||||
|           </li> | ||||
|           <li class="nav-item" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.UISettings }" tourAnchor="tour.settings"> | ||||
|           <li class="nav-item" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.UISettings }" tourAnchor="tour.settings"> | ||||
|             <a class="nav-link" routerLink="settings" routerLinkActive="active" (click)="closeMenu()" ngbPopover="Settings" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#gear"/> | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
|     <app-input-text *ngIf="patternRequired" i18n-title title="Matching pattern" formControlName="match" [error]="error?.match"></app-input-text> | ||||
|     <app-input-check *ngIf="patternRequired" i18n-title title="Case insensitive" formControlName="is_insensitive" novalidate></app-input-check> | ||||
|  | ||||
|     <div *ifOwner="object"> | ||||
|     <div *appIfOwner="object"> | ||||
|       <app-permissions-form [users]="users" accordion="true" formControlName="permissions_form"></app-permissions-form> | ||||
|     </div> | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
|         <app-input-check *ngIf="patternRequired" i18n-title title="Case insensitive" formControlName="is_insensitive"></app-input-check> | ||||
|       </div> | ||||
|  | ||||
|       <div *ifOwner="object"> | ||||
|       <div *appIfOwner="object"> | ||||
|         <app-permissions-form [users]="users" accordion="true" formControlName="permissions_form"></app-permissions-form> | ||||
|       </div> | ||||
|  | ||||
|   | ||||
| @@ -16,7 +16,7 @@ | ||||
|     <app-input-text *ngIf="patternRequired" i18n-title title="Matching pattern" formControlName="match" [error]="error?.match"></app-input-text> | ||||
|     <app-input-check *ngIf="patternRequired" i18n-title title="Case insensitive" formControlName="is_insensitive"></app-input-check> | ||||
|  | ||||
|     <div *ifOwner="object"> | ||||
|     <div *appIfOwner="object"> | ||||
|       <app-permissions-form [users]="users" accordion="true" formControlName="permissions_form"></app-permissions-form> | ||||
|     </div> | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,7 @@ | ||||
|       <app-input-text *ngIf="patternRequired" i18n-title title="Matching pattern" formControlName="match" [error]="error?.match"></app-input-text> | ||||
|       <app-input-check *ngIf="patternRequired" i18n-title title="Case insensitive" formControlName="is_insensitive"></app-input-check> | ||||
|  | ||||
|       <div *ifOwner="object"> | ||||
|       <div *appIfOwner="object"> | ||||
|         <app-permissions-form [users]="users" accordion="true" formControlName="permissions_form"></app-permissions-form> | ||||
|       </div> | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' | ||||
| import { Component, EventEmitter, Input, Output } from '@angular/core' | ||||
| import { FormControl, FormGroup } from '@angular/forms' | ||||
| import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' | ||||
| import { PaperlessUser } from 'src/app/data/paperless-user' | ||||
| @@ -9,7 +9,7 @@ import { UserService } from 'src/app/services/rest/user.service' | ||||
|   templateUrl: './permissions-dialog.component.html', | ||||
|   styleUrls: ['./permissions-dialog.component.scss'], | ||||
| }) | ||||
| export class PermissionsDialogComponent implements OnInit { | ||||
| export class PermissionsDialogComponent { | ||||
|   users: PaperlessUser[] | ||||
|  | ||||
|   constructor( | ||||
| @@ -40,8 +40,6 @@ export class PermissionsDialogComponent implements OnInit { | ||||
|   @Input() | ||||
|   message = $localize`Note that permissions set here will override any existing permissions` | ||||
|  | ||||
|   ngOnInit(): void {} | ||||
|  | ||||
|   cancelClicked() { | ||||
|     this.activeModal.close() | ||||
|   } | ||||
|   | ||||
| @@ -28,7 +28,7 @@ | ||||
|  | ||||
|     <app-welcome-widget *ngIf="settingsService.offerTour()" tourAnchor="tour.dashboard"></app-welcome-widget> | ||||
|  | ||||
|     <div *ifPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }"> | ||||
|     <div *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }"> | ||||
|       <ng-container *ngFor="let v of savedViewService.dashboardViews; first as isFirst"> | ||||
|         <app-saved-view-widget *ngIf="isFirst; else noTour" [savedView]="v" tourAnchor="tour.dashboard"></app-saved-view-widget> | ||||
|         <ng-template #noTour> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <app-widget-frame [title]="savedView.name" [loading]="loading"> | ||||
|  | ||||
|   <a class="btn-link" header-buttons [routerLink]="[]" (click)="showAll()" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }" i18n>Show all</a> | ||||
|   <a class="btn-link" header-buttons [routerLink]="[]" (click)="showAll()" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }" i18n>Show all</a> | ||||
|  | ||||
|  | ||||
|   <table content class="table table-sm table-hover table-borderless mb-0"> | ||||
| @@ -10,7 +10,7 @@ | ||||
|         <th scope="col" i18n>Title</th> | ||||
|       </tr> | ||||
|     </thead> | ||||
|     <tbody *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|     <tbody *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|       <tr *ngFor="let doc of documents"> | ||||
|         <td><a routerLink="/documents/{{doc.id}}" class="d-block text-dark text-decoration-none">{{doc.created_date | customDate}}</a></td> | ||||
|         <td><a routerLink="/documents/{{doc.id}}" class="d-block text-dark text-decoration-none">{{doc.title | documentTitle}}<app-tag [tag]="t" *ngFor="let t of doc.tags$ | async" class="ms-1" (click)="clickTag(t, $event)"></app-tag></a></td> | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     </a> | ||||
|   </div> | ||||
|   <div content tourAnchor="tour.upload-widget"> | ||||
|     <form *ifPermissions="{ action: PermissionAction.Add, type: PermissionType.Document }"> | ||||
|     <form *appIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Document }"> | ||||
|       <ngx-file-drop dropZoneLabel="Drop documents here or" browseBtnLabel="Browse files" (onFileDrop)="dropped($event)" | ||||
|         (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" dropZoneClassName="bg-light card" | ||||
|         multiple="true" contentClassName="justify-content-center d-flex align-items-center py-5 px-2" [showBrowseBtn]=true | ||||
| @@ -40,7 +40,7 @@ | ||||
|     <h6 class="alert-heading">{{status.filename}}</h6> | ||||
|     <p class="mb-0 pb-1" *ngIf="!isFinished(status) || (isFinished(status) && !status.documentId)">{{status.message}}</p> | ||||
|     <ngb-progressbar [value]="status.getProgress()" [max]="1" [type]="getStatusColor(status)"></ngb-progressbar> | ||||
|     <div *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|     <div *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|       <div *ngIf="isFinished(status)"> | ||||
|         <button *ngIf="status.documentId" class="btn btn-sm btn-outline-primary btn-open" routerLink="/documents/{{status.documentId}}" (click)="dismiss(status)"> | ||||
|           <small i18n>Open document</small> | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <div *ngIf="comments"> | ||||
|     <form [formGroup]="commentForm" class="needs-validation mt-3" *ifPermissions="{ action: PermissionAction.Add, type: PermissionType.Comment }" novalidate> | ||||
|     <form [formGroup]="commentForm" class="needs-validation mt-3" *appIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Comment }" novalidate> | ||||
|         <div class="form-group"> | ||||
|             <textarea class="form-control form-control-sm" [class.is-invalid]="newCommentError" rows="3" formControlName="newComment" placeholder="Enter comment" i18n-placeholder required></textarea> | ||||
|             <div class="invalid-feedback" i18n> | ||||
| @@ -18,7 +18,7 @@ | ||||
|         </div> | ||||
|         <div class="d-flex card-footer small bg-light text-primary justify-content-between align-items-center"> | ||||
|             <span>{{displayName(comment)}} - {{ comment.created | customDate}}</span> | ||||
|             <button type="button" class="btn btn-link btn-sm p-0 fade" (click)="deleteComment(comment.id)" *ifPermissions="{ action: PermissionAction.Delete, type: PermissionType.Comment }"> | ||||
|             <button type="button" class="btn btn-link btn-sm p-0 fade" (click)="deleteComment(comment.id)" *appIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Comment }"> | ||||
|                 <svg width="13" height="13" fill="currentColor"> | ||||
|                     <use xlink:href="assets/bootstrap-icons.svg#trash" /> | ||||
|                 </svg> | ||||
|   | ||||
| @@ -28,7 +28,7 @@ | ||||
|  | ||||
|     </div> | ||||
|  | ||||
|     <button *ifOwner="document" type="button" class="btn btn-sm btn-outline-primary me-2" (click)="redoOcr()"> | ||||
|     <button *appIfOwner="document" type="button" class="btn btn-sm btn-outline-primary me-2" (click)="redoOcr()"> | ||||
|         <svg class="buttonicon" fill="currentColor"> | ||||
|             <use xlink:href="assets/bootstrap-icons.svg#arrow-counterclockwise" /> | ||||
|         </svg><span class="d-none d-lg-inline ps-1" i18n>Redo OCR</span> | ||||
| @@ -178,7 +178,7 @@ | ||||
|                     </ng-template> | ||||
|                 </li> | ||||
|  | ||||
|                 <li [ngbNavItem]="6" *ifOwner="document"> | ||||
|                 <li [ngbNavItem]="6" *appIfOwner="document"> | ||||
|                     <a ngbNavLink i18n>Permissions</a> | ||||
|                     <ng-template ngbNavContent> | ||||
|                         <div class="mb-3"> | ||||
| @@ -193,7 +193,7 @@ | ||||
|             <ng-container> | ||||
|                 <button type="button" class="btn btn-outline-secondary" (click)="discard()" i18n [disabled]="!userCanEdit || networkActive || (isDirty$ | async) === false">Discard</button>  | ||||
|                 <button type="button" class="btn btn-outline-primary" (click)="saveEditNext()" *ngIf="hasNext()" i18n [disabled]="!userCanEdit || networkActive || (isDirty$ | async) === false || error">Save & next</button>  | ||||
|                 <button type="submit" class="btn btn-primary" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n [disabled]="!userCanEdit || networkActive || (isDirty$ | async) === false || error">Save</button>  | ||||
|                 <button type="submit" class="btn btn-primary" *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n [disabled]="!userCanEdit || networkActive || (isDirty$ | async) === false || error">Save</button>  | ||||
|             </ng-container> | ||||
|         </form> | ||||
|     </div> | ||||
|   | ||||
| @@ -23,7 +23,7 @@ | ||||
|   </div> | ||||
|   <div class="w-100 d-xl-none"></div> | ||||
|   <div class="col-auto mb-2 mb-xl-0"> | ||||
|     <div class="d-flex" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"> | ||||
|     <div class="d-flex" *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"> | ||||
|       <label class="ms-auto mt-1 mb-0 me-2" i18n>Edit:</label> | ||||
|       <app-filterable-dropdown class="me-2 me-md-3" title="Tags" icon="tag-fill" i18n-title | ||||
|         filterPlaceholder="Filter tags" i18n-filterPlaceholder | ||||
| @@ -131,7 +131,7 @@ | ||||
|     </div> | ||||
|  | ||||
|     <div class="btn-group btn-group-sm me-2"> | ||||
|       <button type="button" class="btn btn-sm btn-outline-danger" (click)="applyDelete()" *ifPermissions="{ action: PermissionAction.Delete, type: PermissionType.Document }" [disabled]="!userOwnsAll"> | ||||
|       <button type="button" class="btn btn-sm btn-outline-danger" (click)="applyDelete()" *appIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Document }" [disabled]="!userOwnsAll"> | ||||
|         <svg width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor"> | ||||
|           <use xlink:href="assets/bootstrap-icons.svg#trash" /> | ||||
|         </svg> <ng-container i18n>Delete</ng-container> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { Component } from '@angular/core' | ||||
| import { Component, OnDestroy, OnInit } from '@angular/core' | ||||
| import { PaperlessTag } from 'src/app/data/paperless-tag' | ||||
| import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' | ||||
| import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' | ||||
| @@ -36,7 +36,10 @@ import { first, Subject, takeUntil } from 'rxjs' | ||||
|   templateUrl: './bulk-editor.component.html', | ||||
|   styleUrls: ['./bulk-editor.component.scss'], | ||||
| }) | ||||
| export class BulkEditorComponent extends ComponentWithPermissions { | ||||
| export class BulkEditorComponent | ||||
|   extends ComponentWithPermissions | ||||
|   implements OnInit, OnDestroy | ||||
| { | ||||
|   tags: PaperlessTag[] | ||||
|   correspondents: PaperlessCorrespondent[] | ||||
|   documentTypes: PaperlessDocumentType[] | ||||
|   | ||||
| @@ -37,7 +37,7 @@ | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#diagram-3"/> | ||||
|               </svg> <span class="d-none d-md-inline" i18n>More like this</span> | ||||
|             </a> | ||||
|             <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"> | ||||
|             <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }"> | ||||
|               <svg class="sidebaricon" fill="currentColor" class="sidebaricon"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#pencil"/> | ||||
|               </svg> <span class="d-none d-md-inline" i18n>Edit</span> | ||||
|   | ||||
| @@ -67,7 +67,7 @@ | ||||
|       </div> | ||||
|       <div class="d-flex justify-content-between align-items-center"> | ||||
|         <div class="btn-group w-100"> | ||||
|           <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" title="Edit" i18n-title *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n-title> | ||||
|           <a routerLink="/documents/{{document.id}}" class="btn btn-sm btn-outline-secondary" title="Edit" i18n-title *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Document }" i18n-title> | ||||
|             <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-pencil" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> | ||||
|               <path fill-rule="evenodd" d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5L13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175l-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/> | ||||
|             </svg> | ||||
|   | ||||
| @@ -59,7 +59,7 @@ | ||||
|     </div> | ||||
|   </div> | ||||
|  | ||||
|   <div class="btn-group ms-2 flex-fill" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }" ngbDropdown role="group"> | ||||
|   <div class="btn-group ms-2 flex-fill" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }" ngbDropdown role="group"> | ||||
|     <button class="btn btn-sm btn-outline-primary dropdown-toggle flex-fill" tourAnchor="tour.documents-views" ngbDropdownToggle> | ||||
|       <ng-container i18n>Views</ng-container> | ||||
|       <div *ngIf="savedViewIsModified" class="position-absolute top-0 start-100 p-2 translate-middle badge bg-secondary border border-light rounded-circle"> | ||||
| @@ -72,10 +72,10 @@ | ||||
|         <div class="dropdown-divider" *ngIf="savedViewService.allViews.length > 0"></div> | ||||
|       </ng-container> | ||||
|  | ||||
|       <div *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.SavedView }"> | ||||
|       <div *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.SavedView }"> | ||||
|         <button ngbDropdownItem (click)="saveViewConfig()" *ngIf="list.activeSavedViewId" [disabled]="!savedViewIsModified" i18n>Save "{{list.activeSavedViewTitle}}"</button> | ||||
|       </div> | ||||
|       <button ngbDropdownItem (click)="saveViewConfigAs()" *ifPermissions="{ action: PermissionAction.Add, type: PermissionType.SavedView }" i18n>Save as...</button> | ||||
|       <button ngbDropdownItem (click)="saveViewConfigAs()" *appIfPermissions="{ action: PermissionAction.Add, type: PermissionType.SavedView }" i18n>Save as...</button> | ||||
|     </div> | ||||
|   </div> | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <app-page-header title="{{ typeNamePlural | titlecase }}"> | ||||
|   <button type="button" class="btn btn-sm btn-outline-primary" (click)="openCreateDialog()" *ifPermissions="{ action: PermissionAction.Add, type: permissionType }" i18n>Create</button> | ||||
|   <button type="button" class="btn btn-sm btn-outline-primary" (click)="openCreateDialog()" *appIfPermissions="{ action: PermissionAction.Add, type: permissionType }" i18n>Create</button> | ||||
| </app-page-header> | ||||
|  | ||||
| <div class="row"> | ||||
| @@ -41,24 +41,24 @@ | ||||
|               </svg> | ||||
|             </button> | ||||
|             <div ngbDropdownMenu aria-labelledby="actionsMenuMobile"> | ||||
|               <button (click)="filterDocuments(object)" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }" ngbDropdownItem i18n>Filter Documents</button> | ||||
|               <button (click)="openEditDialog(object)" *ifPermissions="{ action: PermissionAction.Change, type: permissionType }" ngbDropdownItem i18n>Edit</button> | ||||
|               <button class="text-danger" (click)="openDeleteDialog(object)" *ifPermissions="{ action: PermissionAction.Delete, type: permissionType }" ngbDropdownItem i18n>Delete</button> | ||||
|               <button (click)="filterDocuments(object)" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }" ngbDropdownItem i18n>Filter Documents</button> | ||||
|               <button (click)="openEditDialog(object)" *appIfPermissions="{ action: PermissionAction.Change, type: permissionType }" ngbDropdownItem i18n>Edit</button> | ||||
|               <button class="text-danger" (click)="openDeleteDialog(object)" *appIfPermissions="{ action: PermissionAction.Delete, type: permissionType }" ngbDropdownItem i18n>Delete</button> | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
|         <div class="btn-group d-none d-sm-block"> | ||||
|           <button class="btn btn-sm btn-outline-secondary" (click)="filterDocuments(object)" *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|           <button class="btn btn-sm btn-outline-secondary" (click)="filterDocuments(object)" *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|             <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-funnel" viewBox="0 0 16 16"> | ||||
|               <path fill-rule="evenodd" d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2h-11z"/> | ||||
|             </svg> <ng-container i18n>Documents</ng-container> | ||||
|           </button> | ||||
|           <button class="btn btn-sm btn-outline-secondary" (click)="openEditDialog(object)" *ifPermissions="{ action: PermissionAction.Change, type: permissionType }" [disabled]="!userCanEdit(object)"> | ||||
|           <button class="btn btn-sm btn-outline-secondary" (click)="openEditDialog(object)" *appIfPermissions="{ action: PermissionAction.Change, type: permissionType }" [disabled]="!userCanEdit(object)"> | ||||
|             <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-pencil" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> | ||||
|               <path fill-rule="evenodd" d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5L13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175l-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/> | ||||
|             </svg> <ng-container i18n>Edit</ng-container> | ||||
|           </button> | ||||
|           <button class="btn btn-sm btn-outline-danger" (click)="openDeleteDialog(object)" *ifPermissions="{ action: PermissionAction.Delete, type: permissionType }" [disabled]="!userCanDelete(object)"> | ||||
|           <button class="btn btn-sm btn-outline-danger" (click)="openDeleteDialog(object)" *appIfPermissions="{ action: PermissionAction.Delete, type: permissionType }" [disabled]="!userCanDelete(object)"> | ||||
|             <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16"> | ||||
|               <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/> | ||||
|               <path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <app-page-header title="Settings" i18n-title> | ||||
|   <button class="btn btn-sm btn-outline-primary" (click)="tourService.start()"><ng-container i18n>Start tour</ng-container></button> | ||||
|   <a *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Admin }" class="btn btn-sm btn-primary ms-3" href="admin/" target="_blank"> | ||||
|   <a *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Admin }" class="btn btn-sm btn-primary ms-3" href="admin/" target="_blank"> | ||||
|       <ng-container i18n>Open Django Admin</ng-container> | ||||
|       <svg class="sidebaricon ms-1" fill="currentColor"> | ||||
|         <use xlink:href="assets/bootstrap-icons.svg#arrow-up-right"/> | ||||
| @@ -211,7 +211,7 @@ | ||||
|  | ||||
|               <div class="mb-2 col-auto"> | ||||
|                 <label class="form-label" for="name_{{view.id}}" i18n>Actions</label> | ||||
|                 <button type="button" class="btn btn-sm btn-outline-danger form-control" (click)="deleteSavedView(view)" *ifPermissions="{ action: PermissionAction.Delete, type: PermissionType.SavedView }" i18n>Delete</button> | ||||
|                 <button type="button" class="btn btn-sm btn-outline-danger form-control" (click)="deleteSavedView(view)" *appIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.SavedView }" i18n>Delete</button> | ||||
|               </div> | ||||
|             </div> | ||||
|  | ||||
| @@ -227,12 +227,12 @@ | ||||
|       </ng-template> | ||||
|     </li> | ||||
|  | ||||
|     <li *ifPermissions="{ action: PermissionAction.View, type: PermissionType.MailRule }" [ngbNavItem]="SettingsNavIDs.Mail" (mouseover)="maybeInitializeTab(SettingsNavIDs.Mail)" (focusin)="maybeInitializeTab(SettingsNavIDs.Mail)"> | ||||
|     <li *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.MailRule }" [ngbNavItem]="SettingsNavIDs.Mail" (mouseover)="maybeInitializeTab(SettingsNavIDs.Mail)" (focusin)="maybeInitializeTab(SettingsNavIDs.Mail)"> | ||||
|       <a ngbNavLink i18n>Mail</a> | ||||
|       <ng-template ngbNavContent> | ||||
|  | ||||
|         <ng-container *ngIf="mailAccounts && mailRules"> | ||||
|           <ng-container *ifPermissions="{ action: PermissionAction.View, type: PermissionType.MailAccount }"> | ||||
|           <ng-container *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.MailAccount }"> | ||||
|             <h4> | ||||
|               <ng-container i18n>Mail accounts</ng-container> | ||||
|               <button type="button" class="btn btn-sm btn-primary ms-4" (click)="editMailAccount()"> | ||||
| @@ -258,8 +258,8 @@ | ||||
|                     <div class="col d-flex align-items-center">{{account.imap_server}}</div> | ||||
|                     <div class="col"> | ||||
|                       <div class="btn-group"> | ||||
|                         <button *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" class="btn btn-sm btn-primary" type="button" (click)="editMailAccount(account)" i18n>Edit</button> | ||||
|                         <button *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteMailAccount(account)" i18n>Delete</button> | ||||
|                         <button *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" class="btn btn-sm btn-primary" type="button" (click)="editMailAccount(account)" i18n>Edit</button> | ||||
|                         <button *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteMailAccount(account)" i18n>Delete</button> | ||||
|                       </div> | ||||
|                     </div> | ||||
|                   </div> | ||||
| @@ -269,7 +269,7 @@ | ||||
|             </ul> | ||||
|           </ng-container> | ||||
|  | ||||
|           <ng-container *ifPermissions="{ action: PermissionAction.View, type: PermissionType.MailRule }"> | ||||
|           <ng-container *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.MailRule }"> | ||||
|             <h4 class="mt-4"> | ||||
|               <ng-container i18n>Mail rules</ng-container> | ||||
|               <button type="button" class="btn btn-sm btn-primary ms-4" (click)="editMailRule()"> | ||||
| @@ -295,8 +295,8 @@ | ||||
|                     <div class="col d-flex align-items-center">{{(mailAccountService.getCached(rule.account) | async)?.name}}</div> | ||||
|                     <div class="col"> | ||||
|                       <div class="btn-group"> | ||||
|                         <button *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" class="btn btn-sm btn-primary" type="button" (click)="editMailRule(rule)" i18n>Edit</button> | ||||
|                         <button *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteMailRule(rule)" i18n>Delete</button> | ||||
|                         <button *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" class="btn btn-sm btn-primary" type="button" (click)="editMailRule(rule)" i18n>Edit</button> | ||||
|                         <button *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteMailRule(rule)" i18n>Delete</button> | ||||
|                       </div> | ||||
|                     </div> | ||||
|                   </div> | ||||
| @@ -315,7 +315,7 @@ | ||||
|       </ng-template> | ||||
|     </li> | ||||
|  | ||||
|     <li [ngbNavItem]="SettingsNavIDs.UsersGroups" *ifPermissions="{ action: PermissionAction.Add, type: PermissionType.User }" (mouseover)="maybeInitializeTab(SettingsNavIDs.UsersGroups)" (focusin)="maybeInitializeTab(SettingsNavIDs.UsersGroups)"> | ||||
|     <li [ngbNavItem]="SettingsNavIDs.UsersGroups" *appIfPermissions="{ action: PermissionAction.Add, type: PermissionType.User }" (mouseover)="maybeInitializeTab(SettingsNavIDs.UsersGroups)" (focusin)="maybeInitializeTab(SettingsNavIDs.UsersGroups)"> | ||||
|       <a ngbNavLink i18n>Users & Groups</a> | ||||
|       <ng-template ngbNavContent> | ||||
|  | ||||
| @@ -390,7 +390,7 @@ | ||||
|           </li> | ||||
|         </ul> | ||||
|  | ||||
|         <div *ngIf="groups.length == 0">No groups defined</div> | ||||
|         <div *ngIf="groups.length === 0">No groups defined</div> | ||||
|       </ng-container> | ||||
|  | ||||
|       <div *ngIf="!users || !groups"> | ||||
| @@ -404,5 +404,5 @@ | ||||
|  | ||||
|   <div [ngbNavOutlet]="nav" class="border-start border-end border-bottom p-3 mb-3 shadow-sm"></div> | ||||
|  | ||||
|   <button type="submit" class="btn btn-primary mb-2" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.UISettings }" [disabled]="(isDirty$ | async) === false" i18n>Save</button> | ||||
|   <button type="submit" class="btn btn-primary mb-2" *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.UISettings }" [disabled]="(isDirty$ | async) === false" i18n>Save</button> | ||||
| </form> | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|         <use xlink:href="assets/bootstrap-icons.svg#x"/> | ||||
|       </svg> <ng-container i18n>Clear selection</ng-container> | ||||
|     </button> | ||||
|     <button class="btn btn-sm btn-outline-primary me-4" (click)="dismissTasks()" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.PaperlessTask }" [disabled]="tasksService.total === 0"> | ||||
|     <button class="btn btn-sm btn-outline-primary me-4" (click)="dismissTasks()" *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.PaperlessTask }" [disabled]="tasksService.total === 0"> | ||||
|       <svg class="sidebaricon" fill="currentColor"> | ||||
|         <use xlink:href="assets/bootstrap-icons.svg#check2-all"/> | ||||
|       </svg> <ng-container i18n>{{dismissButtonText}}</ng-container> | ||||
| @@ -75,12 +75,12 @@ | ||||
|         </td> | ||||
|         <td scope="row"> | ||||
|           <div class="btn-group" role="group"> | ||||
|             <button class="btn btn-sm btn-outline-secondary" (click)="dismissTask(task); $event.stopPropagation();" *ifPermissions="{ action: PermissionAction.Change, type: PermissionType.PaperlessTask }"> | ||||
|             <button class="btn btn-sm btn-outline-secondary" (click)="dismissTask(task); $event.stopPropagation();" *appIfPermissions="{ action: PermissionAction.Change, type: PermissionType.PaperlessTask }"> | ||||
|               <svg class="sidebaricon" fill="currentColor"> | ||||
|                 <use xlink:href="assets/bootstrap-icons.svg#check"/> | ||||
|               </svg> <ng-container i18n>Dismiss</ng-container> | ||||
|             </button> | ||||
|             <ng-container *ifPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|             <ng-container *appIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"> | ||||
|               <button *ngIf="task.related_document" class="btn btn-sm btn-outline-primary" (click)="dismissAndGo(task); $event.stopPropagation();"> | ||||
|                 <svg class="sidebaricon" fill="currentColor"> | ||||
|                   <use xlink:href="assets/bootstrap-icons.svg#file-text"/> | ||||
|   | ||||
| @@ -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
	 Michael Shamoon
					Michael Shamoon