///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
import type { IRole, IUser } from '~/types';
export declare class RoleConflictError extends Error {
constructor(message: string);
}
export interface RoleDeps {
/** Returns a cache store for the given key. Injected from getLogStores. */
getCache?: (key: string) => {
get: (k: string) => Promise;
set: (k: string, v: unknown) => Promise;
};
}
export declare function createRoleMethods(mongoose: typeof import('mongoose'), deps?: RoleDeps): {
listRoles: (options?: {
limit?: number;
offset?: number;
}) => Promise[]>;
countRoles: () => Promise;
initializeRoles: () => Promise;
getRoleByName: (roleName: string, fieldsToSelect?: string | string[] | null) => Promise;
updateRoleByName: (roleName: string, updates: Partial) => Promise;
updateAccessPermissions: (roleName: string, permissionsUpdate: Record>, roleData?: IRole) => Promise;
migrateRoleSchema: (roleName?: string) => Promise;
createRoleByName: (roleData: Partial) => Promise;
deleteRoleByName: (roleName: string) => Promise;
updateUsersByRole: (oldRole: string, newRole: string) => Promise;
findUserIdsByRole: (roleName: string) => Promise;
updateUsersRoleByIds: (userIds: string[], newRole: string) => Promise;
listUsersByRole: (roleName: string, options?: {
limit?: number;
offset?: number;
}) => Promise;
countUsersByRole: (roleName: string) => Promise;
};
export type RoleMethods = ReturnType;