UNPKG

kuzzle-sdk

Version:
164 lines (163 loc) 9.9 kB
import { BaseController } from "./Base"; import { Role } from "../core/security/Role"; import { RoleSearchResult } from "../core/searchResult/Role"; import { Profile } from "../core/security/Profile"; import { ProfileSearchResult } from "../core/searchResult/Profile"; import { User } from "../core/security/User"; import { UserSearchResult } from "../core/searchResult/User"; import { ArgsDefault } from "../types"; export declare class SecurityController extends BaseController { /** * @param {Kuzzle} kuzzle */ constructor(kuzzle: any); /** * Creates a new API key for a user. * * @param {String} userId - User kuid * @param {String} description - API key description * @param {Object} [options] - { _id, expiresIn, refresh } * * @returns {Promise.<Object>} ApiKey { _id, _source } */ createApiKey(userId: any, description: any, options?: ArgsSecurityControllerCreateApiKey): Promise<any>; /** * Checks if an API action can be executed by a user * * @param {String} kuid - User kuid * @param {Object} requestPayload - Request to check */ checkRights(kuid: any, requestPayload: any, options?: ArgsSecurityControllerCheckRights): Promise<any>; /** * Deletes an user API key. * * @param {String} userId - User kuid * @param {String} id - API key ID * @param {Object} [options] - { refresh } * * @returns {Promise} */ deleteApiKey(userId: any, id: any, options?: ArgsSecurityControllerDeleteApiKey): Promise<import("../types").JSONObject>; /** * Searches for a user API key. * * @param {String} userId - User kuid * @param {Object} [query] - Search query * @param {Object} [options] - { from, size } * * @returns {Promise.<object[]>} - { hits, total } */ searchApiKeys(userId: any, query?: {}, options?: ArgsSecurityControllerSearchApiKeys): Promise<any>; createCredentials(strategy: any, _id: any, body: any, options?: ArgsSecurityControllerCreateCredentials): Promise<any>; createFirstAdmin(_id: any, body: any, options?: ArgsSecurityControllerCreateFirstAdmin): Promise<User>; createOrReplaceProfile(_id: any, body: any, options?: ArgsSecurityControllerCreateOrReplaceProfile): Promise<Profile>; createOrReplaceRole(_id: any, body: any, options?: ArgsSecurityControllerCreateOrReplaceRole): Promise<Role>; createProfile(_id: any, body: any, options?: ArgsSecurityControllerCreateProfile): Promise<Profile>; createRestrictedUser(body: any, _id?: any, options?: ArgsSecurityControllerCreateRestrictedUser): Promise<User>; createRole(_id: any, body: any, options?: ArgsSecurityControllerCreateRole): Promise<Role>; createUser(_id: any, body: any, options?: ArgsSecurityControllerCreateUser): Promise<User>; deleteCredentials(strategy: any, _id: any, options?: ArgsSecurityControllerDeleteCredentials): Promise<any>; deleteProfile(_id: any, options?: ArgsSecurityControllerDeleteProfile): Promise<any>; deleteRole(_id: any, options?: ArgsSecurityControllerDeleteRole): Promise<any>; deleteUser(_id: any, options?: ArgsSecurityControllerDeleteUser): Promise<any>; getAllCredentialFields(options?: ArgsSecurityControllerGetAllCredentialFields): Promise<any>; getCredentialFields(strategy: any, options?: ArgsSecurityControllerGetCredentialFields): Promise<any>; getCredentials(strategy: any, _id: any, options?: ArgsSecurityControllerGetCredentials): Promise<any>; getCredentialsById(strategy: any, _id: any, options?: ArgsSecurityControllerGetCredentialsById): Promise<any>; getProfile(_id: any, options?: ArgsSecurityControllerGetProfile): Promise<Profile>; getProfileMapping(options?: ArgsSecurityControllerGetProfileMapping): Promise<any>; getProfileRights(_id: any, options?: ArgsSecurityControllerGetProfileRights): Promise<any>; getRole(_id: any, options?: ArgsSecurityControllerGetRole): Promise<Role>; getRoleMapping(options?: ArgsSecurityControllerGetRoleMapping): Promise<any>; getUser(_id: any, options?: ArgsSecurityControllerGetUser): Promise<User>; getUserMapping(options?: ArgsSecurityControllerGetUserMapping): Promise<any>; getUserRights(_id: any, options?: ArgsSecurityControllerGetUserRights): Promise<any>; getUserStrategies(_id: any, options?: ArgsSecurityControllerGetUserStrategies): Promise<any>; hasCredentials(strategy: any, _id: any, options?: ArgsSecurityControllerHasCredentials): Promise<any>; mDeleteProfiles(ids: any, options?: ArgsSecurityControllerMDeleteProfiles): Promise<any>; mDeleteRoles(ids: any, options?: ArgsSecurityControllerMDeleteRoles): Promise<any>; mDeleteUsers(ids: any, options?: ArgsSecurityControllerMDeleteUsers): Promise<any>; mGetProfiles(ids: any, options?: ArgsSecurityControllerMGetProfiles): Promise<any>; mGetUsers(ids: any, options?: ArgsSecurityControllerMGetUsers): Promise<any>; mGetRoles(ids: any, options?: ArgsSecurityControllerMGetRoles): Promise<any>; refresh(collection: any, options?: ArgsSecurityControllerRefresh): Promise<import("../types").JSONObject>; replaceUser(_id: any, body: any, options?: ArgsSecurityControllerReplaceUser): Promise<User>; searchProfiles(body: any, options?: ArgsSecurityControllerSearchProfiles): Promise<ProfileSearchResult>; searchRoles(body: any, options?: ArgsSecurityControllerSearchRoles): Promise<RoleSearchResult>; searchUsers(body: any, options?: ArgsSecurityControllerSearchUsers): Promise<UserSearchResult>; updateCredentials(strategy: any, _id: any, body: any, options?: ArgsSecurityControllerUpdateCredentials): Promise<any>; updateProfile(_id: any, body: any, options?: ArgsSecurityControllerUpdateProfile): Promise<Profile>; updateProfileMapping(body: any, options?: ArgsSecurityControllerUpdateProfileMapping): Promise<any>; updateRole(_id: any, body: any, options?: ArgsSecurityControllerUpdateRole): Promise<Role>; updateRoleMapping(body: any, options?: ArgsSecurityControllerUpdateRoleMapping): Promise<any>; updateUser(_id: any, body: any, options?: ArgsSecurityControllerUpdateUser): Promise<User>; updateUserMapping(body: any, options?: ArgsSecurityControllerUpdateUserMapping): Promise<any>; validateCredentials(strategy: any, _id: any, body: any, options?: ArgsSecurityControllerValidateCredentials): Promise<any>; } export interface ArgsSecurityControllerCreateApiKey extends ArgsDefault { expiresIn?: string | number; _id?: string; refresh?: "wait_for" | "false"; } export type ArgsSecurityControllerCheckRights = ArgsDefault; export interface ArgsSecurityControllerDeleteApiKey extends ArgsDefault { refresh?: "wait_for" | "false"; } export interface ArgsSecurityControllerSearchApiKeys extends ArgsDefault { from?: number; size?: number; lang?: string; } export type ArgsSecurityControllerCreateCredentials = ArgsDefault; export interface ArgsSecurityControllerCreateFirstAdmin extends ArgsDefault { reset?: boolean; } export type ArgsSecurityControllerCreateOrReplaceProfile = ArgsDefault; export interface ArgsSecurityControllerCreateOrReplaceRole extends ArgsDefault { force?: boolean; } export type ArgsSecurityControllerCreateProfile = ArgsDefault; export type ArgsSecurityControllerCreateRestrictedUser = ArgsDefault; export interface ArgsSecurityControllerCreateRole extends ArgsDefault { force?: boolean; } export type ArgsSecurityControllerCreateUser = ArgsDefault; export type ArgsSecurityControllerDeleteCredentials = ArgsDefault; export type ArgsSecurityControllerDeleteProfile = ArgsDefault; export type ArgsSecurityControllerDeleteRole = ArgsDefault; export type ArgsSecurityControllerDeleteUser = ArgsDefault; export type ArgsSecurityControllerGetAllCredentialFields = ArgsDefault; export type ArgsSecurityControllerGetCredentialFields = ArgsDefault; export type ArgsSecurityControllerGetCredentials = ArgsDefault; export type ArgsSecurityControllerGetCredentialsById = ArgsDefault; export type ArgsSecurityControllerGetProfile = ArgsDefault; export type ArgsSecurityControllerGetProfileMapping = ArgsDefault; export type ArgsSecurityControllerGetProfileRights = ArgsDefault; export type ArgsSecurityControllerGetRole = ArgsDefault; export type ArgsSecurityControllerGetRoleMapping = ArgsDefault; export type ArgsSecurityControllerGetUser = ArgsDefault; export type ArgsSecurityControllerGetUserMapping = ArgsDefault; export type ArgsSecurityControllerGetUserRights = ArgsDefault; export type ArgsSecurityControllerGetUserStrategies = ArgsDefault; export type ArgsSecurityControllerHasCredentials = ArgsDefault; export type ArgsSecurityControllerMDeleteProfiles = ArgsDefault; export type ArgsSecurityControllerMDeleteRoles = ArgsDefault; export type ArgsSecurityControllerMDeleteUsers = ArgsDefault; export type ArgsSecurityControllerMGetProfiles = ArgsDefault; export type ArgsSecurityControllerMGetUsers = ArgsDefault; export type ArgsSecurityControllerMGetRoles = ArgsDefault; export type ArgsSecurityControllerReplaceUser = ArgsDefault; export type ArgsSecurityControllerSearchProfiles = ArgsDefault; export type ArgsSecurityControllerSearchRoles = ArgsDefault; export type ArgsSecurityControllerSearchUsers = ArgsDefault; export type ArgsSecurityControllerUpdateCredentials = ArgsDefault; export type ArgsSecurityControllerUpdateProfile = ArgsDefault; export type ArgsSecurityControllerUpdateProfileMapping = ArgsDefault; export interface ArgsSecurityControllerUpdateRole extends ArgsDefault { force?: boolean; } export type ArgsSecurityControllerUpdateRoleMapping = ArgsDefault; export type ArgsSecurityControllerUpdateUser = ArgsDefault; export type ArgsSecurityControllerUpdateUserMapping = ArgsDefault; export type ArgsSecurityControllerValidateCredentials = ArgsDefault; export type ArgsSecurityControllerRefresh = ArgsDefault;