import type { IGrants } from '../types/index.js'; import { type INameOptions } from './validation.js'; /** * Gets a flat, ordered list of inherited roles for the given role. * @param grants - Main grants object to be processed. * @param roleName - Role name to be inspected. * @param [opts] - Charset / safe-errors policy. */ export declare function getRoleHierarchyOf(grants: IGrants, roleName: string, opts?: INameOptions, _rootRole?: string): string[]; /** * Checks the given grants model and gets an array of non-existent roles * from the given roles. * @param grants - Grants model to be checked. * @param roles - Roles to be checked. */ export declare function getNonExistentRoles(grants: IGrants, roles: string[]): string[]; /** * Checks whether the given extender role(s) is already (cross) inherited * by the given role and returns the first cross-inherited role. Otherwise, * returns `null`. * * Note that cross-inheritance is not allowed. * * @param grants - Grants model to be checked. * @param roleName - Target role to be checked. * @param extenderRoles - Extender role(s) to be checked. * @param [opts] - Charset / safe-errors policy. */ export declare function getCrossExtendingRole(grants: IGrants, roleName: string, extenderRoles: string | string[], opts?: INameOptions): string | null; /** * Extends the given role(s) with privileges of one or more other roles. * * @param grants * @param roles - Role(s) to be extended. If a role does not exist, it * throws (`ROLE_NOT_FOUND`). * @param extenderRoles - Role(s) to inherit from. If an extender role does not * exist, it will throw. * @param [opts] - Charset / safe-errors policy. * * @throws {AccessControlError} - If a role is extended by itself, a non-existent * role or a cross-inherited role. */ export declare function extendRole(grants: IGrants, roles: string | string[], extenderRoles: string | string[], opts?: INameOptions): void; /** * Pre-creates the role(s) with an empty object, in case the grant chain is not * terminated by an action method (e.g. just `ac.grant('user')`). * @param grants * @param roles * @param [opts] - Charset / safe-errors policy. */ export declare function preCreateRoles(grants: IGrants, roles: string | string[], opts?: INameOptions): void; //# sourceMappingURL=roles.d.ts.map