import { ObservableMap } from 'mobx'; import { CubaApp, EntityAttrPermissionValue, EffectivePermsInfo, EntityOperationType } from '@cuba-platform/rest'; export declare class Security { private cubaREST; attrPermissionCache: ObservableMap; private effectivePermissions?; private restSupportEffectivePerms; permissionsRequestCount: number; constructor(cubaREST: CubaApp); /** * Indicates whether the permissions data has been successfully loaded from backend. * NOTE: will always return `true` if the REST API version doesn't support effective permissions * (REST API version < 7.2). */ get isDataLoaded(): boolean; /** * Returns current user permissions. */ get permissions(): EffectivePermsInfo; getAttributePermission: (entityName: string, attributeName: string) => EntityAttrPermissionValue; /** * Returns a boolean indicating whether the current user is allowed to upload files. * This is convenience method that checks whether a user has a `create` operation permission * on `sys$FileDescriptor` entity and `cuba.restApi.fileUpload.enabled` specific permission. */ canUploadAndLinkFile: () => boolean; /** * Returns a boolean indicating whether a given entity operation permission is granted * to the current user. * * @param entityName * @param operation */ isOperationPermissionGranted: (entityName: string, operation: EntityOperationType) => boolean; /** * Returns a boolean indicating whether a given entity attribute permission is granted * to the current user. * * @param entityName * @param attrName * @param requiredAttrPerm */ isAttributePermissionGranted: (entityName: string, attrName: string, requiredAttrPerm: Exclude) => boolean; /** * Returns a boolean indicating whether a given specific permission is granted * to the current user. * * @param target */ isSpecificPermissionGranted: (target: string) => boolean; loadPermissions(): Promise; }