add share to c/dt/t/sp, refactor share input, ifOwner directive

This commit is contained in:
Michael Shamoon
2022-12-07 14:55:40 -08:00
parent 5dc14449f9
commit 43b9909a09
18 changed files with 192 additions and 18 deletions

View File

@@ -178,12 +178,12 @@
</ng-template>
</li>
<li [ngbNavItem]="6">
<li [ngbNavItem]="6" *ifOwner="document?.owner">
<a ngbNavLink i18n>Permissions</a>
<ng-template ngbNavContent>
<div formGroupName="set_permissions">
<app-input-select i18n-title title="Users can view" [items]="users" [bindLabel]="'username'" multiple="true" formControlName="view"></app-input-select>
<app-input-select i18n-title title="Users can edit" [items]="users" [bindLabel]="'username'" multiple="true" formControlName="change"></app-input-select>
<app-share-user type="view" formControlName="view"></app-share-user>
<app-share-user type="change" formControlName="change"></app-share-user>
</div>
</ng-template>
</li>

View File

@@ -40,7 +40,6 @@ import {
PermissionsService,
PermissionType,
} from 'src/app/services/permissions.service'
import { UserService } from 'src/app/services/rest/user.service'
import { PaperlessUser } from 'src/app/data/paperless-user'
@Component({
@@ -75,7 +74,6 @@ export class DocumentDetailComponent
correspondents: PaperlessCorrespondent[]
documentTypes: PaperlessDocumentType[]
storagePaths: PaperlessStoragePath[]
users: PaperlessUser[]
documentForm: FormGroup = new FormGroup({
title: new FormControl(''),
@@ -134,8 +132,7 @@ export class DocumentDetailComponent
private toastService: ToastService,
private settings: SettingsService,
private storagePathService: StoragePathService,
private permissionsService: PermissionsService,
private userService: UserService
private permissionsService: PermissionsService
) {}
titleKeyUp(event) {
@@ -175,11 +172,6 @@ export class DocumentDetailComponent
.pipe(first())
.subscribe((result) => (this.storagePaths = result.results))
this.userService
.listAll()
.pipe(first())
.subscribe((result) => (this.users = result.results))
this.route.paramMap
.pipe(
takeUntil(this.unsubscribeNotifier),