@eclipse-scout/core
Version:
Eclipse Scout runtime
55 lines • 3.02 kB
TypeScript
/// <reference types="jquery" />
import { AjaxCall, AjaxError, BaseDoEntity, EventHandler, InitModelOf, ObjectModel, Permission, PermissionCollection, PermissionCollectionModel, PermissionCollectionType, PermissionLevel, PermissionModel, PropertyEventEmitter, SomeRequired, UiNotificationEvent } from '../index';
export declare class AccessControl extends PropertyEventEmitter implements AccessControlModel {
self: AccessControl;
model: AccessControlModel;
initModel: SomeRequired<this['model'], 'permissionsUrl'>;
permissionsUrl: string;
protected _permissionCollection: PermissionCollection;
protected _permissionUpdateEventHandler: EventHandler<UiNotificationEvent>;
protected _reloadTimeoutId: number;
protected _call: AjaxCall;
constructor();
init(model: InitModelOf<this>): void;
bootstrap(): JQuery.Promise<void>;
destroy(): void;
protected _subscribeForNotifications(): JQuery.Promise<string>;
protected _unsubscribeFromNotifications(): void;
protected _onPermissionUpdateNotify(event: UiNotificationEvent): void;
protected _load(): JQuery.Promise<void>;
protected _loadPermissionCollection(): JQuery.Promise<PermissionCollectionDo, AjaxError>;
/**
* Check `permission` against the current {@link PermissionCollection}.
* Quick check is executed synchronously while non-quick check is executed asynchronously.
*/
check(permission: Permission, quick: true): boolean;
check(permission: Permission, quick?: false): JQuery.Promise<boolean>;
check(permission: Permission, quick?: boolean): boolean | JQuery.Promise<boolean>;
/**
* Returns the granted {@link PermissionLevel} for a given permission instance `permission`.
* - {@link Permission.Level.UNDEFINED} if `permission` is `null` or in general 'not an {@link Permission}'
* - {@link Permission.Level.NONE} if no level at all is granted to `permission`
* - {@link PermissionLevel} if the level can be determined exactly.
* - {@link Permission.Level.UNDEFINED} if there are multiple granted permission levels possible and there is not enough data in the `permission` contained to determine the result closer.
*/
getGrantedPermissionLevel(permission: Permission): PermissionLevel;
}
export interface AccessControlModel extends ObjectModel<AccessControl> {
/**
* URL pointing to a json resource that provides information about permissions (see {@link PermissionCollectionModel}).
*/
permissionsUrl?: string;
}
export declare class PermissionUpdateMessageDo extends BaseDoEntity {
reloadDelayWindow: number;
}
export declare class PermissionDo extends BaseDoEntity implements PermissionModel {
id?: string;
objectType?: string;
level?: PermissionLevel;
}
export declare class PermissionCollectionDo extends BaseDoEntity implements PermissionCollectionModel {
permissions?: Record<string, PermissionDo[]>;
type?: PermissionCollectionType;
}
//# sourceMappingURL=AccessControl.d.ts.map