Skip to content

SudoSOS Back-end API / internal/ldap / ADService

Class: ADService ​

Extends ​

Constructors ​

Constructor ​

ts
new ADService(manager?): ADService;

Parameters ​

ParameterType
manager?EntityManager

Returns ​

ADService

Inherited from ​

WithManager.constructor

Properties ​

PropertyModifierTypeInherited from
managerprotectedEntityManagerWithManager.manager

Methods ​

createAccountIfNew() ​

ts
createAccountIfNew(ldapUsers): Promise<void>;

Creates an account for all new GUIDs

Parameters ​

ParameterTypeDescription
ldapUsersLDAPUser[]-

Returns ​

Promise<void>


filterUnboundGUID() ​

ts
filterUnboundGUID(ldapResponses): Promise<LDAPResponse[]>;

Returns all objects with a GUID that is not in the LDAPAuthenticator table.

Parameters ​

ParameterTypeDescription
ldapResponsesLDAPResponse[]Array to filter.

Returns ​

Promise<LDAPResponse[]>


getLDAPGroupMembers() ​

ts
getLDAPGroupMembers(client, dn): Promise<Pick<SearchResult, "searchReferences"> & object>;

Gets all LDAP Users in the DN group

Parameters ​

ParameterTypeDescription
clientClientThe LDAP Connection
dnstringDN Of the group to get members of

Returns ​

Promise<Pick<SearchResult, "searchReferences"> & object>


getLDAPGroups() ​

ts
getLDAPGroups<T>(client, baseDN): Promise<T[]>;

Gets all LDAP Groups in the given baseDN

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterTypeDescription
clientClientThe LDAP Connection
baseDNstringBase DN to search in

Returns ​

Promise<T[]>


getLDAPResponseFromGUID() ​

ts
getLDAPResponseFromGUID(client, guid): Promise<LDAPUser>;

Retrieves the LDAP entry matching the provided GUID, or undefined if there is none.

Parameters ​

ParameterTypeDescription
clientClient-
guidBuffer-

Returns ​

Promise<LDAPUser>


getUsers() ​

ts
getUsers(ldapUsers, createIfNew?): Promise<User[]>;

This function returns all user objects related to the provided ldapUsers If createIfNew is true it will create users for all unbounded ldapUsers.

Parameters ​

ParameterTypeDefault valueDescription
ldapUsersLDAPUser[]undefinedLDAP user object to get users for.
createIfNewbooleanfalseBoolean if unknown users should be created.

Returns ​

Promise<User[]>


toServiceAccount() ​

ts
toServiceAccount(serviceAccount): Promise<User>;

Create a new user account for the given service account.

Parameters ​

ParameterTypeDescription
serviceAccountLDAPUser-

Returns ​

Promise<User>


toSharedUser() ​

ts
toSharedUser(sharedUser): Promise<User>;

Creates and binds a Shared (Organ) group to an actual User

Parameters ​

ParameterTypeDescription
sharedUserLDAPGroupThe group that needs an account.

Returns ​

Promise<User>


updateRoleMembership() ​

ts
updateRoleMembership(
   client, 
   ldapRole, 
roleManager): Promise<void>;

Gives Users the correct role. Note that this creates Users if they do not exists in the LDAPAuth. table.

Parameters ​

ParameterTypeDescription
clientClient-
ldapRoleLDAPGroupthe AD entry linked to this role.
roleManagerRoleManagerReference to the application role manager

Returns ​

Promise<void>


updateSharedAccountMembership() ​

ts
updateSharedAccountMembership(client, sharedAccount): Promise<void>;

Handles and updates a shared group Gives authentications to the members of the shared group

Parameters ​

ParameterTypeDescription
clientClientThe LDAP client
sharedAccountLDAPGroupAccount to give access

Returns ​

Promise<void>