本文整理汇总了TypeScript中@eg/core/perm.service.PermService类的典型用法代码示例。如果您正苦于以下问题:TypeScript service.PermService类的具体用法?TypeScript service.PermService怎么用?TypeScript service.PermService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了service.PermService类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Promise
return new Promise((resolve, reject) => {
this.perm.hasWorkPermAt(['STAFF_LOGIN']).then(
permMap => {
if (permMap.STAFF_LOGIN.length) {
resolve('perm check OK');
} else {
reject('perm check faield');
}
}
);
});
示例2:
request => {
console.log('hold returned: ', request);
ctx.lastRequest = request;
ctx.processing = false;
// If this request failed and was not already an override,
// see of this user has permission to override.
if (!request.override &&
!request.result.success && request.result.evt) {
const txtcode = request.result.evt.textcode;
const perm = txtcode + '.override';
return this.perm.hasWorkPermHere(perm).then(
permResult => ctx.canOverride = permResult[perm]);
}
},
示例3: ngOnInit
ngOnInit() {
this.initDone = true;
// Load edit perms
this.perm.hasWorkPermHere([
'CREATE_MONOGRAPH_PART',
'UPDATE_MONOGRAPH_PART',
'DELETE_MONOGRAPH_PART'
]).then(perms => this.permissions = perms);
this.gridDataSource.getRows = (pager: Pager, sort: any[]) => {
const orderBy: any = {};
if (sort.length) { // Sort provided by grid.
orderBy.bmp = sort[0].name + ' ' + sort[0].dir;
} else {
orderBy.bmp = 'label';
}
const searchOps = {
offset: pager.offset,
limit: pager.limit,
order_by: orderBy
};
return this.pcrud.search('bmp',
{record: this.recId, deleted: 'f'}, searchOps);
};
this.partsGrid.onRowActivate.subscribe(
(part: IdlObject) => {
this.editDialog.mode = 'update';
this.editDialog.recId = part.id();
this.editDialog.open().then(
ok => this.partsGrid.reload(),
err => {}
);
}
);
this.createNew = () => {
const part = this.idl.create('bmp');
part.record(this.recId);
this.editDialog.record = part;
this.editDialog.mode = 'create';
this.editDialog.open().then(
ok => this.partsGrid.reload(),
err => {}
);
};
this.deleteSelected = (parts: IdlObject[]) => {
parts.forEach(part => part.isdeleted(true));
this.pcrud.autoApply(parts).subscribe(
val => console.debug('deleted: ' + val),
err => {},
() => this.partsGrid.reload()
);
};
this.mergeSelected = (parts: IdlObject[]) => {
if (parts.length < 2) { return; }
this.mergeDialog.parts = parts;
this.mergeDialog.open().then(
ok => this.partsGrid.reload(),
err => console.debug('Dialog dismissed')
);
};
}