Skip to main content

Class: UsersController

api-login/users.controller.UsersController

Controller allowing access to the users in the system

Constructors

constructor

new UsersController(userService, backendUserSerice, loginDataSerive)

Parameters

NameType
userServiceLoginUserService
backendUserSericeBackendUserService
loginDataSeriveUserLoginDataService

Defined in

login-service/src/api-login/users.controller.ts:45

Properties

backendUserSerice

Private Readonly backendUserSerice: BackendUserService

Defined in

login-service/src/api-login/users.controller.ts:47


loginDataSerive

Private Readonly loginDataSerive: UserLoginDataService

Defined in

login-service/src/api-login/users.controller.ts:48


userService

Private Readonly userService: LoginUserService

Defined in

login-service/src/api-login/users.controller.ts:46

Methods

createNewUser

createNewUser(input): Promise<LoginUser>

Create a new user object (which has no authentications yet) based on the given data.

Needs admin permissions.

Meant for admins to create users which can then be linked a authentication by a admin. Can be used, if self registration os turned off for all strategies globally.

Parameters

NameTypeDescription
inputCreateUserAsAdminInputInput data to create a new user from

Returns

Promise<LoginUser>

If uscessful, the created user object

Defined in

login-service/src/api-login/users.controller.ts:135


deleteUser

deleteUser(id): Promise<DefaultReturn>

NOTE: Not implemented yet. Will always fail.

Permanently deletes an existing user by its id.

Needs Admin permissions

Parameters

NameTypeDescription
idstringThe uuid string of the existing user to delete

Returns

Promise<DefaultReturn>

Defined in

login-service/src/api-login/users.controller.ts:186


editUser

editUser(id, input): Promise<LoginUser>

NOTE: Not implemented yet. Will always fail.

Updates an existing user object using the given data. Only the entries that are given in the input will be updated in the user.

Needs Admin permissions

Parameters

NameTypeDescription
idstringThe uuid string of the existing user to edit
inputPartial<CreateUserAsAdminInput>If sucessful, the updated user object

Returns

Promise<LoginUser>

Defined in

login-service/src/api-login/users.controller.ts:160


getLoginDataForUser

getLoginDataForUser(id, res): Promise<UserLoginData[]>

Gets the list of all login data of a single user specified by id.

Needs admin permission for any user other than the one sending the request (equivalen to self query).

Parameters

NameTypeDescription
idstringThe uuid string of the existing user to get the loginData for or 'self'
resResponse<any, Record<string, any>>The response object containing the request state

Returns

Promise<UserLoginData[]>

If user exits, login data for the user with the specified id

Defined in

login-service/src/api-login/users.controller.ts:218


getOneUser

getOneUser(id, res): Promise<LoginUser>

Get the user object of any user by its id.

Needs admin permission for any user other than the one sending the request (equivalen to self query).

Parameters

NameTypeDescription
idstringThe uuid string of the user to get the details for
resResponse<any, Record<string, any>>-

Returns

Promise<LoginUser>

If existing and permitted, the user details of the requested user

Defined in

login-service/src/api-login/users.controller.ts:102


getOwnUser

getOwnUser(res): Promise<LoginUser>

Gets the user object of the logged in user that is sending the request.

Parameters

NameTypeDescription
resResponse<any, Record<string, any>>The response object containing the request state

Returns

Promise<LoginUser>

The user details of the logged in user

Defined in

login-service/src/api-login/users.controller.ts:75


listAllUsers

listAllUsers(): Promise<LoginUser[]>

Gets a list of all users in the system.

Needs admin permissions.

Returns

Promise<LoginUser[]>

List of all users in the system

Defined in

login-service/src/api-login/users.controller.ts:62