Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPSH-1570: Enhanced Logging In Email-Event-Handler #845

Open
wants to merge 7 commits into
base: release-0102
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/ldap/domain/ldap-client.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Person } from '../../../modules/person/domain/person.js';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { LdapClient } from './ldap-client.js';
import { Attribute, Change, Client, Entry, SearchResult } from 'ldapts';
import { PersonID } from '../../../shared/types/aggregate-ids.types.js';
import { PersonID, PersonReferrer } from '../../../shared/types/aggregate-ids.types.js';
import { LdapSearchError } from '../error/ldap-search.error.js';
import { LdapEntityType } from './ldap.types.js';
import { ClassLogger } from '../../logging/class-logger.js';
Expand Down Expand Up @@ -549,7 +549,7 @@ describe('LDAP Client Service', () => {
});
describe('when modifying', () => {
it('Should Update LDAP When called with Attributes', async () => {
const oldReferrer: string = faker.internet.userName();
const oldReferrer: PersonReferrer = faker.internet.userName();
const newGivenName: string = faker.person.firstName();
const newSn: string = faker.person.lastName();
const newUid: string = faker.string.alphanumeric(6);
Expand Down
12 changes: 5 additions & 7 deletions src/core/ldap/domain/ldap-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class LdapClientService {
};
}

private getLehrerUid(referrer: string, rootName: string): string {
private getLehrerUid(referrer: PersonReferrer, rootName: string): string {
return `uid=${referrer},ou=${rootName},${LdapClientService.DC_SCHULE_SH_DC_DE}`;
}

Expand All @@ -121,7 +121,7 @@ export class LdapClientService {
domain: string,
mail?: string, //Wird hier erstmal seperat mit reingegeben bis die Umstellung auf primary/alternative erfolgt
): Promise<Result<PersonData>> {
const referrer: string | undefined = person.referrer;
const referrer: PersonReferrer | undefined = person.referrer;
if (!referrer) {
return {
ok: false,
Expand Down Expand Up @@ -184,7 +184,7 @@ export class LdapClientService {
});
}

public async isLehrerExisting(referrer: string, domain: string): Promise<Result<boolean>> {
public async isLehrerExisting(referrer: PersonReferrer, domain: string): Promise<Result<boolean>> {
const rootName: Result<string> = this.getRootNameOrError(domain);
if (!rootName.ok) return rootName;

Expand All @@ -208,7 +208,7 @@ export class LdapClientService {
}

public async modifyPersonAttributes(
oldReferrer: string,
oldReferrer: PersonReferrer,
newGivenName?: string,
newSn?: string,
newUid?: string,
Expand Down Expand Up @@ -286,7 +286,7 @@ export class LdapClientService {
});
}

public async deleteLehrerByReferrer(referrer: string): Promise<Result<string>> {
public async deleteLehrerByReferrer(referrer: PersonReferrer): Promise<Result<string>> {
return this.mutex.runExclusive(async () => {
this.logger.info('LDAP: deleteLehrer');
const client: Client = this.ldapClient.getClient();
Expand Down Expand Up @@ -341,7 +341,6 @@ export class LdapClientService {
newEmailAddress: string,
): Promise<Result<PersonID>> {
// Converted to avoid PersonRepository-ref, UEM-password-generation
//const referrer: string | undefined = await this.getPersonReferrerOrUndefined(personId);
return this.mutex.runExclusive(async () => {
this.logger.info('LDAP: changeEmailAddress');
const splitted: string[] = newEmailAddress.split('@');
Expand Down Expand Up @@ -427,7 +426,6 @@ export class LdapClientService {

public async changeUserPasswordByPersonId(personId: PersonID, referrer: PersonReferrer): Promise<Result<PersonID>> {
// Converted to avoid PersonRepository-ref, UEM-password-generation
//const referrer: string | undefined = await this.getPersonReferrerOrUndefined(personId);
const userPassword: string = generatePassword();

return this.mutex.runExclusive(async () => {
Expand Down
351 changes: 160 additions & 191 deletions src/modules/email/domain/email-event-handler.spec.ts

Large diffs are not rendered by default.

138 changes: 94 additions & 44 deletions src/modules/email/domain/email-event-handler.ts

Large diffs are not rendered by default.

Loading
Loading