-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
29 changed files
with
227 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
apps/server/src/infra/schulconnex-client/response/lizenz-info/index.ts
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
.../src/infra/schulconnex-client/response/lizenz-info/schulconnex-lizenz-info-action-type.ts
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...ra/schulconnex-client/response/lizenz-info/schulconnex-lizenz-info-permission-response.ts
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...ver/src/infra/schulconnex-client/response/lizenz-info/schulconnex-lizenz-info-response.ts
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
apps/server/src/infra/schulconnex-client/response/policies-info/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { SchulconnexPoliciesInfoTargetResponse } from './schulconnex-policies-info-target-response'; | ||
export { SchulconnexPoliciesInfoResponse } from './schulconnex-policies-info-response'; | ||
export { SchulconnexPoliciesInfoActionType } from './schulconnex-policies-info-action-type'; | ||
export { SchulconnexPoliciesInfoPermissionResponse } from './schulconnex-policies-info-permission-response'; |
3 changes: 3 additions & 0 deletions
3
.../infra/schulconnex-client/response/policies-info/schulconnex-policies-info-action-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export enum SchulconnexPoliciesInfoActionType { | ||
EXECUTE = 'execute', | ||
} |
7 changes: 7 additions & 0 deletions
7
...chulconnex-client/response/policies-info/schulconnex-policies-info-permission-response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IsArray } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoActionType } from './schulconnex-policies-info-action-type'; | ||
|
||
export class SchulconnexPoliciesInfoPermissionResponse { | ||
@IsArray() | ||
action!: SchulconnexPoliciesInfoActionType[]; | ||
} |
16 changes: 16 additions & 0 deletions
16
...src/infra/schulconnex-client/response/policies-info/schulconnex-policies-info-response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Type } from 'class-transformer'; | ||
import { IsArray, IsObject, ValidateNested } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoPermissionResponse } from './schulconnex-policies-info-permission-response'; | ||
import { SchulconnexPoliciesInfoTargetResponse } from './schulconnex-policies-info-target-response'; | ||
|
||
export class SchulconnexPoliciesInfoResponse { | ||
@IsObject() | ||
@ValidateNested() | ||
@Type(() => SchulconnexPoliciesInfoTargetResponse) | ||
target!: SchulconnexPoliciesInfoTargetResponse; | ||
|
||
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@Type(() => SchulconnexPoliciesInfoPermissionResponse) | ||
permission!: SchulconnexPoliciesInfoPermissionResponse[]; | ||
} |
2 changes: 1 addition & 1 deletion
2
...chulconnex-lizenz-info-target-response.ts → ...ulconnex-policies-info-target-response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
apps/server/src/infra/schulconnex-client/schulconnex-api.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { SchulconnexPersonenInfoParams } from './request'; | ||
import { SchulconnexLizenzInfoResponse, SchulconnexResponse } from './response'; | ||
import { SchulconnexPoliciesInfoResponse, SchulconnexResponse } from './response'; | ||
|
||
export interface SchulconnexApiInterface { | ||
getPersonInfo(accessToken: string, options?: { overrideUrl: string }): Promise<SchulconnexResponse>; | ||
|
||
getPersonenInfo(params: SchulconnexPersonenInfoParams): Promise<SchulconnexResponse[]>; | ||
|
||
getLizenzInfo(accessToken: string, options?: { overrideUrl: string }): Promise<SchulconnexLizenzInfoResponse[]>; | ||
getPoliciesInfo(accessToken: string, options?: { overrideUrl: string }): Promise<SchulconnexPoliciesInfoResponse[]>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { schulconnexResponseFactory } from './schulconnex-response-factory'; | ||
export { schulconnexLizenzInfoResponseFactory } from './schulconnex-lizenz-info-response-factory'; | ||
export { schulconnexPoliciesInfoResponseFactory } from './schulconnex-policies-info-response-factory'; |
16 changes: 0 additions & 16 deletions
16
apps/server/src/infra/schulconnex-client/testing/schulconnex-lizenz-info-response-factory.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...server/src/infra/schulconnex-client/testing/schulconnex-policies-info-response-factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Factory } from 'fishery'; | ||
import { SchulconnexPoliciesInfoActionType, SchulconnexPoliciesInfoResponse } from '../response'; | ||
|
||
export const schulconnexPoliciesInfoResponseFactory = Factory.define<SchulconnexPoliciesInfoResponse>(() => { | ||
return { | ||
target: { | ||
uid: 'bildungscloud', | ||
partOf: '', | ||
}, | ||
permission: [ | ||
{ | ||
action: [SchulconnexPoliciesInfoActionType.EXECUTE], | ||
}, | ||
], | ||
}; | ||
}); |
31 changes: 31 additions & 0 deletions
31
apps/server/src/modules/provisioning/loggable/fetching-policies-info-failed.loggable.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ExternalUserDto } from '../dto'; | ||
import { FetchingPoliciesInfoFailedLoggable } from './fetching-policies-info-failed.loggable'; | ||
|
||
describe(FetchingPoliciesInfoFailedLoggable.name, () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const externalUserDto: ExternalUserDto = { | ||
externalId: 'someId', | ||
}; | ||
const policiesInfoEndpoint = 'someEndpoint'; | ||
|
||
const loggable = new FetchingPoliciesInfoFailedLoggable(externalUserDto, policiesInfoEndpoint); | ||
|
||
return { loggable, externalUserDto, policiesInfoEndpoint }; | ||
}; | ||
|
||
it('should return a loggable message', () => { | ||
const { loggable, externalUserDto, policiesInfoEndpoint } = setup(); | ||
|
||
const message = loggable.getLogMessage(); | ||
|
||
expect(message).toEqual({ | ||
message: 'Could not fetch policies info for user. The provisioning of licenses will be skipped.', | ||
data: { | ||
externalUserId: externalUserDto.externalId, | ||
policiesInfoEndpoint, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
apps/server/src/modules/provisioning/loggable/fetching-policies-info-failed.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; | ||
import { ExternalUserDto } from '../dto'; | ||
|
||
export class FetchingPoliciesInfoFailedLoggable implements Loggable { | ||
constructor(private readonly user: ExternalUserDto, private readonly policiesInfoEndpoint: string) {} | ||
|
||
getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { | ||
return { | ||
message: 'Could not fetch policies info for user. The provisioning of licenses will be skipped.', | ||
data: { | ||
externalUserId: this.user.externalId, | ||
policiesInfoEndpoint: this.policiesInfoEndpoint, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export interface ProvisioningConfig { | ||
FEATURE_SCHULCONNEX_COURSE_SYNC_ENABLED: boolean; | ||
FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED: boolean; | ||
PROVISIONING_SCHULCONNEX_LIZENZ_INFO_URL: string; | ||
PROVISIONING_SCHULCONNEX_POLICIES_INFO_URL: string; | ||
FEATURE_SANIS_GROUP_PROVISIONING_ENABLED: boolean; | ||
FEATURE_OTHER_GROUPUSERS_PROVISIONING_ENABLED: boolean; | ||
} |
Oops, something went wrong.