Add ability to set owner per object

This commit is contained in:
Michael Shamoon
2022-12-09 10:04:39 -08:00
parent df2540320c
commit 360a2258e1
28 changed files with 293 additions and 220 deletions

View File

@@ -1,15 +1,13 @@
<div class="mb-3 paperless-input-select">
<label class="form-label" [for]="inputId">{{title}}</label>
<div>
<ng-select name="inputId" [(ngModel)]="value"
[disabled]="disabled"
clearable="true"
[items]="groups"
multiple="true"
bindLabel="name"
bindValue="id"
(change)="onChange(value)">
</ng-select>
</div>
<small *ngIf="hint" class="form-text text-muted">{{hint}}</small>
</div>
<div class="paperless-input-select">
<div>
<ng-select name="inputId" [(ngModel)]="value"
[disabled]="disabled"
clearable="true"
[items]="groups"
multiple="true"
bindLabel="name"
bindValue="id"
(change)="onChange(value)">
</ng-select>
</div>
</div>

View File

@@ -3,7 +3,6 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms'
import { first } from 'rxjs/operators'
import { PaperlessGroup } from 'src/app/data/paperless-group'
import { GroupService } from 'src/app/services/rest/group.service'
import { SettingsService } from 'src/app/services/settings.service'
import { AbstractInputComponent } from '../abstract-input'
@Component({
@@ -18,31 +17,14 @@ import { AbstractInputComponent } from '../abstract-input'
templateUrl: './permissions-group.component.html',
styleUrls: ['./permissions-group.component.scss'],
})
export class PermissionsGroupComponent
extends AbstractInputComponent<PaperlessGroup>
implements OnInit
{
export class PermissionsGroupComponent extends AbstractInputComponent<PaperlessGroup> {
groups: PaperlessGroup[]
@Input()
type: string
constructor(groupService: GroupService, settings: SettingsService) {
constructor(groupService: GroupService) {
super()
groupService
.listAll()
.pipe(first())
.subscribe((result) => (this.groups = result.results))
}
ngOnInit(): void {
if (this.type == 'view') {
this.title = $localize`Groups can view`
} else if (this.type == 'change') {
this.title = $localize`Groups can edit`
this.hint = $localize`Edit permissions also grant viewing permissions`
}
super.ngOnInit()
}
}