mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Add ability to set owner per object
This commit is contained in:
@@ -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>
|
||||
|
@@ -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()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user