當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript perm.service.PermService類代碼示例

本文整理匯總了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');
             }
         }
     );
 });
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:11,代碼來源:resolver.service.ts

示例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]);
                }
            },
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:17,代碼來源:hold.component.ts

示例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')
            );
        };
    }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:71,代碼來源:parts.component.ts


注:本文中的@eg/core/perm.service.PermService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。