import { IRestEntity } from '@jacquesparis/objects-model';
import { AuthorizationContext, AuthorizationDecision, AuthorizationMetadata } from '@loopback/authorization';
import { Principal } from '@loopback/security';
import { ObjectNode } from '../../models';
import { ObjectNodeService } from '../object-node/object-node.service';
import { ServiceDescription, TreatmentDescription } from './../../integration/extension-description';
import { EntityName } from './../../models/entity-name';
import { ObjectTree } from './../../models/object-tree.model';
import { ActionEntityService } from './../action-entity/action-entity.service';
import { ApplicationService, CurrentContext } from './../application.service';
import { ObjectTreeService } from './../object-tree/object-tree.service';
import { ObjectTypeService } from './../object-type.service';
import { AccessRightsCRUD, AccessRightsPermissions, AccessRightsScope, AccessRightsSet } from './access-rights.const';
export interface AccessRightsInterface {
    providerId: string;
    serviceId: string;
    cleanReturnedEntity(entity: IRestEntity, ctx: CurrentContext): Promise<void>;
    authorize(ctx: CurrentContext, context: AuthorizationContext): Promise<AuthorizationDecision>;
}
export declare class AccessRightsService implements ServiceDescription {
    protected appCtx: ApplicationService;
    protected objectTypeService: ObjectTypeService;
    protected objectNodeService: ObjectNodeService;
    protected objectTreeService: ObjectTreeService;
    protected actionEntityService: ActionEntityService;
    private accessRights;
    private forcedAccessRightsByObjectType;
    getPreTreatmentDescription(): TreatmentDescription[];
    getPostTreatmentDescription(): TreatmentDescription[];
    registerAccessRightsService(resource: EntityName, accessRights: AccessRightsInterface): void;
    get ready(): Promise<void>;
    constructor(appCtx: ApplicationService, objectTypeService: ObjectTypeService, objectNodeService: ObjectNodeService, objectTreeService: ObjectTreeService, actionEntityService: ActionEntityService);
    authorize(ctx: CurrentContext, context: AuthorizationContext, metadata: AuthorizationMetadata): Promise<AuthorizationDecision>;
    calculateRootPermissions(ctx: CurrentContext): Promise<AccessRightsSet>;
    cleanReturnedEntity(entityName: EntityName, entity: IRestEntity, ctx: CurrentContext): Promise<void>;
    cleanReturnedEntities(entityName: EntityName, entities: IRestEntity[], ctx: CurrentContext): Promise<void>;
    getForcedAccessRightsForObjectType(objectTypeId: string): Promise<{
        [scope in AccessRightsScope]?: boolean;
    }>;
    getNodeAccessRights(node: ObjectNode, ctx: CurrentContext): Promise<AccessRightsCRUD>;
    addForcedAccessRightsForObjectType(objectTypeId: string, forcedAccessRights: {
        [scope in AccessRightsScope]?: boolean;
    }): void;
    hasNodeAccessRights(scope: AccessRightsScope, node: ObjectNode, ctx: CurrentContext): Promise<boolean>;
    private loadACLTrees;
    loadRights(node: ObjectNode, ctx: CurrentContext): Promise<AccessRightsPermissions>;
    private mergeReset;
    private mergeRight;
    protected computeACLTree(aclTree: ObjectTree, principal: Principal): Promise<{
        reset: AccessRightsSet;
        rights: AccessRightsSet;
    }>;
    private findMatchingUser;
}
