import { VoterInterface } from "../interfaces/voter.interface"; import { VotingStrategyEnum } from "../enums/voting-strategy.enum"; import { IdentityInterface, TracingManagerInterface } from "@pristine-ts/common"; import { LogHandlerInterface } from "@pristine-ts/logging"; /** * The permission manager verifies if the correct permission are there to access and take an action on a resource. */ export declare class PermissionManager { private readonly voters; private readonly logHandler; private readonly tracingManager; /** * The permission manager verifies if the correct permission are there to access and take an action on a resource. * @param voters The voters that determine if access is granted. * All services with the tag ServiceDefinitionTagEnum.Voter will be injected here * @param logHandler The log handler to output logs. * @param tracingManager The tracing manager used to attach markers for the voting decisions. */ constructor(voters: VoterInterface[], logHandler: LogHandlerInterface, tracingManager: TracingManagerInterface); /** * Returns whether or not the permission manager grants access to the resource. Drops one * marker per voter (`permission.voter-vote` with `{voter, vote}`) so the trace shows which * voter swung the decision. `@traced()` puts the whole call in its own span so the * voting work is visible in the trace tree alongside auth/authz. * @param identity The identity trying to have access to a resource. * @param action The action trying to be executed on the resource. * @param resource The resource being accessed. * @param votingStrategy The voting strategy that defines how to merge the votes. Default is DenyOnUnanimousAbstention. */ hasAccessToResource(identity: IdentityInterface, action: string, resource: object, votingStrategy?: VotingStrategyEnum): Promise; }