<input i18n-placeholder placeholder="Code" [ngModelOptions]="{standalone: true}" [(ngModel)]="providerCode" type="text" class="form-control" />
</div>
<div class="col-lg-4">
- <eg-org-family-select i18n-labelText labelText="Owner" [ngModelOptions]="{standalone: true}" [(ngModel)]="providerOwners"></eg-org-family-select>
+ <eg-org-family-select i18n-labelText labelText="Owner"
+ [limitPerms]="['VIEW_PROVIDER','MANAGE_PROVIDER','ADMIN_PROVIDER']"
+ [ngModelOptions]="{standalone: true}" [(ngModel)]="providerOwners">
+ </eg-org-family-select>
</div>
<div class="col-lg-2 text-right">
<button class="btn btn-primary mr-1" (click)="submitSearch()" type="submit" i18n>Search</button>
import {PcrudService} from '@eg/core/pcrud.service';
import {Pager} from '@eg/share/util/pager';
import {EventService} from '@eg/core/event.service';
+import {ProviderRecordService} from './provider-record.service';
export interface AcqProviderSearchTerm {
classes: string[];
constructor(
private evt: EventService,
private auth: AuthService,
- private pcrud: PcrudService
+ private pcrud: PcrudService,
+ private providerRecord: ProviderRecordService
) {
this.firstRun = true;
}
term.fields.forEach( (field, ind) => {
const curr_cls = term.classes[ind];
+ // remove any OUs that the user doesn't have provider view
+ // permission for
+ if (curr_cls == 'acqpro' && field == 'owner' && op == 'in') {
+ val = val.filter(ou => {
+ return this.providerRecord.getViewOUs().includes(ou);
+ });
+ }
+
if (ind === 1) {
// we're OR'ing in other classes/fields
// and this is the first so restructure
providerUpdated$ = this.providerUpdatedSource.asObservable();
private permissions: any;
+ private viewOUs: number[] = [];
constructor(
private idl: IdlService,
}
loadPerms() {
- this.perm.hasWorkPermAt(['ADMIN_PROVIDER','MANAGE_PROVIDER'], true).then(permMap => {
+ this.perm.hasWorkPermAt(['ADMIN_PROVIDER','MANAGE_PROVIDER', 'VIEW_PROVIDER'], true).then(permMap => {
this.permissions = permMap;
+ this.viewOUs.concat(permMap['VIEW_PROVIDER']);
+ this.permissions['ADMIN_PROVIDER'].forEach(ou => {
+ if (!this.viewOUs.includes(ou)) {
+ this.viewOUs.push(ou);
+ }
+ });
+ this.permissions['MANAGE_PROVIDER'].forEach(ou => {
+ if (!this.viewOUs.includes(ou)) {
+ this.viewOUs.push(ou);
+ }
+ });
});
}
}
}
+ getViewOUs(): number[] {
+ return this.viewOUs;
+ }
+
current(): IdlObject {
return this.currentProvider ? this.currentProvider.record : null;
}