Skip to main content

Class: BackendUserService

backend-services/backend-user.service.BackendUserService

Constructors

constructor

new BackendUserService(graphqlService, loginUserService, userService, activeLoginService, userLoginDataService)

Parameters

NameType
graphqlServiceGraphqlService
loginUserServiceLoginUserService
userServiceLoginUserService
activeLoginServiceActiveLoginService
userLoginDataServiceUserLoginDataService

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:20

Properties

activeLoginService

Private Readonly activeLoginService: ActiveLoginService

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:24


graphqlService

Private Readonly graphqlService: GraphqlService

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:21


logger

Private Readonly logger: Logger

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:19


loginUserService

Private Readonly loginUserService: LoginUserService

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:22


userLoginDataService

Private Readonly userLoginDataService: UserLoginDataService

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:25


userService

Private Readonly userService: LoginUserService

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:23

Methods

checkIsUserAdmin

checkIsUserAdmin(user): Promise<boolean>

Checks if the user may access admin actions.

Calls the backend API to retrieve the information.

Potential optimation if performance is a problem: Cache admin state for one login session (activeLogin)

Parameters

NameTypeDescription
userLoginUserThe user for which to check admin permissions

Returns

Promise<boolean>

true if the user is allowed to access admin actions, false if not

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:38


checkUserExists

checkUserExists(user): Promise<boolean>

Checks for the existance of a GropiusUser with the neo4jid specified in the given LoginUser

Meant to check database consistency. For a properly created LoginUser this should always return true

Parameters

NameTypeDescription
userLoginUserThe LoginUser to check in the backend

Returns

Promise<boolean>

true iff the LoginUser has a valid associated GropiusUser in the backend

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:62


createLoginUserForExistingBackendUser

createLoginUserForExistingBackendUser(neo4jId): Promise<LoginUser>

Fetches the user date (username, ...) of the user fron the backend and creates a LoginUser for it

Meant to be used in case of database inconsistency as usually both users should be created simultaneously

Parameters

NameTypeDescription
neo4jIdstringThe bakcend neo4j id of the GropiusUser to create a LoginUser for

Returns

Promise<LoginUser>

The created LoginUser instance

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:119


createNewUser

createNewUser(input, isAdmin): Promise<LoginUser>

Parameters

NameType
inputCreateUserInput
isAdminboolean

Returns

Promise<LoginUser>

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:84


getAllGropiusUsersInBackend

getAllGropiusUsersInBackend(): Promise<string[]>

Fetches all backend ids of all existing GropiusUsers in the backend

Returns

Promise<string[]>

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:76


linkAccountToUser

linkAccountToUser(userToLinkTo, loginData, activeLogin): Promise<{ loggedInUser: LoginUser ; loginData: UserLoginData }>

Helper function performing tha actual linking of login data with user.

If the given login data already has a user set, the user must match the given one, else a INTERNAL_SERVER_ERROR is raised.

The expiration of the loginData will be removed. The expiration of the activeLogin will be set to the default login expiration time, except if the strategy supports sync, then the active login will never expire. The state of the loginData will be updated to VALID if it was WAITING_FOR_REGISER before

Parameters

NameTypeDescription
userToLinkToLoginUserThe user account to link the new authentication to
loginDataUserLoginDataThe new authentication to link to the user
activeLoginActiveLoginThe active login that was created during the authentication flow

Returns

Promise<{ loggedInUser: LoginUser ; loginData: UserLoginData }>

The saved and updated user and login data after linking

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:194


linkAllImsUsersToGropiusUser

linkAllImsUsersToGropiusUser(loginUser, loginData): Promise<void>

Parameters

NameType
loginUserLoginUser
loginDataUserLoginData

Returns

Promise<void>

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:152


linkOneImsUserToGropiusUser

linkOneImsUserToGropiusUser(loginUser, imsUser): Promise<void>

Parameters

NameType
loginUserLoginUser
imsUserUserLoginDataImsUser

Returns

Promise<void>

Defined in

gropius-login-service/backend/src/backend-services/backend-user.service.ts:138