import { InitModelOf, ObjectModel, ObjectOrModel, Permission, PermissionLevel, PropertyChangeEvent, PropertyEventEmitter, PropertyEventMap } from '../index'; export declare class PermissionCollection extends PropertyEventEmitter implements PermissionCollectionModel { self: PermissionCollection; model: PermissionCollectionModel; initModel: PermissionCollectionModel; eventMap: PermissionCollectionEventMap; permissions: PermissionMap; type: PermissionCollectionType; constructor(); init(model: InitModelOf): void; setPermissions(permissions: PermissionModelMapModel): void; protected _setPermissions(permissions: PermissionModelMapModel): void; setType(type: PermissionCollectionType): void; protected _setType(type: PermissionCollectionType): void; /** * Check if the given {@link Permission} is implied (see {@link PermissionCollectionType}). * Quick implies is executed synchronously while non-quick implies is executed asynchronously. */ implies(permission: Permission, quick: true): boolean; implies(permission: Permission, quick?: false): JQuery.Promise; implies(permission: Permission, quick?: boolean): boolean | JQuery.Promise; /** * 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; /** * Ensures that the given `permissionCollection` is of type {@link PermissionCollection}. If a model is provided, a new {@link PermissionCollection} will be created. */ static ensure(permissionCollection: ObjectOrModel): T; /** * Ensures that the given `permissionModelMapModel` is of type {@link PermissionMap}. * * @param permissionModelMapModel map/object of {@link Permission}s or their model grouped by `id`. */ protected static _ensurePermissionMap(permissionModelMapModel: PermissionModelMapModel): PermissionMap; } export interface PermissionCollectionModel extends ObjectModel { /** * {@link Permission}s grouped by `id`. */ permissions?: PermissionModelMapModel; /** * The type of the {@link PermissionCollection} (see {@link PermissionCollectionType}). */ type?: PermissionCollectionType; } export type PermissionMap = Map>; export type PermissionModelMapModel = Map> | ObjectOrModel[]> | Record> | ObjectOrModel[]>; export interface PermissionCollectionEventMap extends PropertyEventMap { 'propertyChange:permissions': PropertyChangeEvent; 'propertyChange:type': PropertyChangeEvent; } export declare enum PermissionCollectionType { /** * Check if {@link Permission} is contained {@link PermissionCollection}. */ DEFAULT = "DEFAULT", /** * All {@link Permission}s are implied. */ ALL = "ALL", /** * No {@link Permission} is implied. */ NONE = "NONE" } //# sourceMappingURL=PermissionCollection.d.ts.map