export = RoleRepository; /** * @class RoleRepository * @extends ObjectRepository */ declare class RoleRepository extends ObjectRepository { /** * @constructor * @param {SecurityModule} securityModule */ constructor(securityModule: SecurityModule); module: SecurityModule; ObjectConstructor: typeof Role; roles: Map; logger: import("../../kuzzle/Logger").Logger; init(): void; /** * From a list of role ids, retrieves the matching Role objects. * * @param {Array} ids The role ids to load * @param {Object} options - resetCache (false) * @returns {Promise.>} */ loadRoles(ids: any[]): Promise>; /** * Creates a new role, or create/replace a role * * @param {String} id * @param {Object} content * @param {Object} [opts] * @returns {Role} */ _createOrReplace(id: string, content: any, { force, method, refresh, userId }?: any): Role; /** * Creates a new role * * @param {String} id * @param {Object} content * @param {Object} [opts] * @returns {Role} */ create(id: string, content: any, opts?: any): Role; /** * Creates or replaces a role * * @param {String} id * @param {Object} content * @param {Object} [opts] * @returns {Role} */ createOrReplace(id: string, content: any, opts?: any): Role; /** * Updates a role (replaces the entire content) * * @todo (breaking change) make this function able to handle partial updates * instead of replacing the entire role content (hint: _.merge) * * @param {String} id * @param {Object} content * @param {Object} [opts] * @returns {Promise} */ update(id: string, content: any, { force, refresh, retryOnConflict, userId }?: any): Promise; /** * Get from database the document that represent the role given in parameter * * @param {string} id * @returns {Promise.} role * @throws {NotFoundError} If the corresponding role doesn't exist */ load(id: string): Promise; /** * @override */ override loadOneFromDatabase(id: any): Promise; /** * @param {Object} body Search body containing either "query" or "controllers" * @param {Object} options */ searchRole(body: any, { from, size }?: any): Promise<{ hits: any[]; total: any; }>; /** * Given a Role object, validates its definition and if OK, persist it to the database. * * @param {Role} role * @param {object} [options] The persistence options * @returns Promise */ validateAndSaveRole(role: Role, options?: object): Promise; /** * Given a Role object, checks if its controllers and actions exist. * * @param {Role} role */ checkRoleNativeRights(role: Role): void; /** * Given a Role object, checks if its controllers and actions exist in plugins. * * @param {Role} role * @param {Force} force */ checkRolePluginsRights(role: Role, { force, forceWarn }?: Force): void; /** * Fetching roles and check for each of them for invalid plugin rights. * If there are some, Kuzzle will log a warning. */ sanityCheck(): Promise; /** * Deletes a role * * @param {String} id * @param {object} [options] * @returns Promise */ deleteById(id: string, options?: object): Promise; /** * @override */ override delete(role: any, { refresh }?: { refresh?: string; }): Promise; /** * From a Role object, returns an object ready to be persisted * * @param {Role} role * @returns {object} */ serializeToDatabase(role: Role): object; /** * @override */ override truncate(opts: any): Promise; /** * Invalidate the cache entries for the given role. If none is provided, * the entire cache is emptied. * @param {string} [roleId] */ invalidate(roleId?: string): void; } import { ObjectRepository } from "../shared/ObjectRepository"; import { Role } from "../../model/security/role";