Skip to content

Commit

Permalink
SPSH-1137 (#750)
Browse files Browse the repository at this point in the history
* Implement VIDIS module/service to request VIDIS offers from VIDIS Offer API

* Implement new mapping table between Organisation and ServiceProvider

* Implement logic to create or update ServiceProviders for VIDIS offers

* Implement cron job endpoint for VIDIS ServiceProvider update

* Use faker in test

* Add VIDIS config keys

* Add config keys for test

* Add dummy test data for config test

* Fix tests

* Add tests

* Add keys

* Add and adapt tests

* Change arguments to correct parameter order

* Add permission check to cron controller endpoint

* Adapt tests

* Use root Organisation as schulstrukturknoten for VIDIS offers

* Externalize VIDIS related config

* Use MissingPermissionsError, remove no longer required CronJobError

* Remove unnecessary import

* Rename variable

* Rename test files

* Fix vidisConfig declaration

* Change findByName

* Avoid try-catch

* Fix check

* Fix migration

* Add or adapt logs

* Fix missing logging dependency for test

* Add missing import of ClassLogger

* Change from offer to Angebot

* Add logging

* Use existing method to retrieve Organisationen, remove unnecessary method and Error

* Avoid magic numbers for media type file signatures
  • Loading branch information
he-meyer authored Nov 29, 2024
1 parent e512222 commit 109cab6
Show file tree
Hide file tree
Showing 31 changed files with 1,369 additions and 7 deletions.
8 changes: 8 additions & 0 deletions charts/dbildungs-iam-server/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,13 @@
"RENAME_WAITING_TIME_IN_SECONDS": 3,
"STEP_UP_TIMEOUT_ENABLED": "true",
"STEP_UP_TIMEOUT_IN_SECONDS": 10
},
"VIDIS": {
"BASE_URL": "https://service-stage.vidis.schule",
"USERNAME": "",
"PASSWORD": "",
"REGION_NAME": "test-region",
"KEYCLOAK_GROUP": "VIDIS-service",
"KEYCLOAK_ROLE": "VIDIS-user"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,34 @@
secretKeyRef:
name: {{ default .Values.auth.existingSecret .Values.auth.secretName }}
key: redis-password
- name: VIDIS_BASE_URL
valueFrom:
secretKeyRef:
name: {{ default .Values.auth.existingSecret .Values.auth.secretName }}
key: vidis-base-url
- name: VIDIS_USERNAME
valueFrom:
secretKeyRef:
name: {{ default .Values.auth.existingSecret .Values.auth.secretName }}
key: vidis-username
- name: VIDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ default .Values.auth.existingSecret .Values.auth.secretName }}
key: vidis-password
- name: VIDIS_REGION_NAME
valueFrom:
secretKeyRef:
name: {{ default .Values.auth.existingSecret .Values.auth.secretName }}
key: vidis-region-name
- name: VIDIS_KEYCLOAK_GROUP
valueFrom:
secretKeyRef:
name: {{ default .Values.auth.existingSecret .Values.auth.secretName }}
key: vidis-keycloak-group
- name: VIDIS_KEYCLOAK_ROLE
valueFrom:
secretKeyRef:
name: {{ default .Values.auth.existingSecret .Values.auth.secretName }}
key: vidis-keycloak-role
{{- end}}
6 changes: 6 additions & 0 deletions charts/dbildungs-iam-server/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ data:
system-step-up-enabled: {{ .Values.auth.system_step_up_enabled }}
secrets-json: {{ .Values.auth.secrets_json }}
redis-password: {{ .Values.auth.redis_password }}
vidis-base-url: {{ .Values.auth.vidis_base_url }}
vidis-username: {{ .Values.auth.vidis_username }}
vidis-password: {{ .Values.auth.vidis_password }}
vidis-region-name: {{ .Values.auth.vidis_region_name }}
vidis-keycloak-group: {{ .Values.auth.vidis_keycloak_group }}
vidis-keycloak-role: {{ .Values.auth.vidis_keycloak_role }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/dbildungs-iam-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ auth:
system_step_up_timeout_in_seconds: ''
system_step_up_timeout_enabled: ''
redis_password: ''
vidis_base_url: ''
vidis_username: ''
vidis_password: ''
vidis_region_name: ''
vidis_keycloak_group: ''
vidis_keycloak_role: ''

backend:
replicaCount: 1
Expand Down
8 changes: 8 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
"USER_RESOLVER": "mariadb_resolver",
"REALM": "defrealm"
},
"VIDIS": {
"BASE_URL": "https://service-stage.vidis.schule",
"USERNAME": "username",
"PASSWORD": "password",
"REGION_NAME": "test-region",
"KEYCLOAK_GROUP": "VIDIS-service",
"KEYCLOAK_ROLE": "VIDIS-user"
},
"IMPORT": {
"IMPORT_FILE_MAXGROESSE_IN_MB": 10
},
Expand Down
230 changes: 230 additions & 0 deletions migrations/.snapshot-dbildungs-iam-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -4523,6 +4523,236 @@
}
}
},
{
"columns": {
"organisation_id": {
"name": "organisation_id",
"type": "uuid",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"mappedType": "uuid"
},
"service_provider_id": {
"name": "service_provider_id",
"type": "uuid",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"mappedType": "uuid"
}
},
"name": "organisation_service_provider",
"schema": "public",
"indexes": [
{
"keyName": "organisation_service_provider_pkey",
"columnNames": [
"organisation_id",
"service_provider_id"
],
"composite": true,
"constraint": true,
"primary": true,
"unique": true
}
],
"checks": [],
"foreignKeys": {
"organisation_service_provider_organisation_id_foreign": {
"constraintName": "organisation_service_provider_organisation_id_foreign",
"columnNames": [
"organisation_id"
],
"localTableName": "public.organisation_service_provider",
"referencedColumnNames": [
"id"
],
"referencedTableName": "public.organisation",
"updateRule": "cascade"
},
"organisation_service_provider_service_provider_id_foreign": {
"constraintName": "organisation_service_provider_service_provider_id_foreign",
"columnNames": [
"service_provider_id"
],
"localTableName": "public.organisation_service_provider",
"referencedColumnNames": [
"id"
],
"referencedTableName": "public.service_provider",
"updateRule": "cascade"
}
},
"nativeEnums": {
"db_seed_status_enum": {
"name": "db_seed_status_enum",
"schema": "public",
"items": [
"STARTED",
"DONE",
"FAILED"
]
},
"referenced_entity_type_enum": {
"name": "referenced_entity_type_enum",
"schema": "public",
"items": [
"PERSON",
"ORGANISATION",
"ROLLE",
"SERVICE_PROVIDER"
]
},
"organisations_typ_enum": {
"name": "organisations_typ_enum",
"schema": "public",
"items": [
"ROOT",
"LAND",
"TRAEGER",
"SCHULE",
"KLASSE",
"ANBIETER",
"SONSTIGE ORGANISATION / EINRICHTUNG",
"UNBESTAETIGT"
]
},
"traegerschaft_enum": {
"name": "traegerschaft_enum",
"schema": "public",
"items": [
"01",
"02",
"03",
"04",
"05",
"06"
]
},
"geschlecht_enum": {
"name": "geschlecht_enum",
"schema": "public",
"items": [
"m",
"w",
"d",
"x"
]
},
"vertrauensstufe_enum": {
"name": "vertrauensstufe_enum",
"schema": "public",
"items": [
"KEIN",
"UNBE",
"TEIL",
"VOLL"
]
},
"email_address_status_enum": {
"name": "email_address_status_enum",
"schema": "public",
"items": [
"ENABLED",
"DISABLED",
"REQUESTED",
"FAILED"
]
},
"rollen_art_enum": {
"name": "rollen_art_enum",
"schema": "public",
"items": [
"LERN",
"LEHR",
"EXTERN",
"ORGADMIN",
"LEIT",
"SYSADMIN"
]
},
"personenstatus_enum": {
"name": "personenstatus_enum",
"schema": "public",
"items": [
"AKTIV"
]
},
"jahrgangsstufe_enum": {
"name": "jahrgangsstufe_enum",
"schema": "public",
"items": [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10"
]
},
"rollen_merkmal_enum": {
"name": "rollen_merkmal_enum",
"schema": "public",
"items": [
"BEFRISTUNG_PFLICHT",
"KOPERS_PFLICHT"
]
},
"rollen_system_recht_enum": {
"name": "rollen_system_recht_enum",
"schema": "public",
"items": [
"ROLLEN_VERWALTEN",
"PERSONEN_SOFORT_LOESCHEN",
"PERSONEN_VERWALTEN",
"SCHULEN_VERWALTEN",
"KLASSEN_VERWALTEN",
"SCHULTRAEGER_VERWALTEN",
"MIGRATION_DURCHFUEHREN",
"PERSON_SYNCHRONISIEREN",
"CRON_DURCHFUEHREN",
"PERSONEN_ANLEGEN",
"IMPORT_DURCHFUEHREN"
]
},
"service_provider_target_enum": {
"name": "service_provider_target_enum",
"schema": "public",
"items": [
"URL",
"EMAIL",
"SCHULPORTAL_ADMINISTRATION"
]
},
"service_provider_kategorie_enum": {
"name": "service_provider_kategorie_enum",
"schema": "public",
"items": [
"EMAIL",
"UNTERRICHT",
"VERWALTUNG",
"HINWEISE",
"ANGEBOTE"
]
},
"service_provider_system_enum": {
"name": "service_provider_system_enum",
"schema": "public",
"items": [
"NONE",
"EMAIL",
"ITSLEARNING"
]
}
}
},
{
"columns": {
"id": {
Expand Down
20 changes: 20 additions & 0 deletions migrations/Migration20241115133701-S.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Migration } from '@mikro-orm/migrations';

export class Migration20241115133701 extends Migration {
async up(): Promise<void> {
this.addSql(
'create table "organisation_service_provider" ("organisation_id" uuid not null, "service_provider_id" uuid not null, constraint "organisation_service_provider_pkey" primary key ("organisation_id", "service_provider_id"));',
);

this.addSql(
'alter table "organisation_service_provider" add constraint "organisation_service_provider_organisation_id_foreign" foreign key ("organisation_id") references "organisation" ("id") on update cascade;',
);
this.addSql(
'alter table "organisation_service_provider" add constraint "organisation_service_provider_service_provider_id_foreign" foreign key ("service_provider_id") references "service_provider" ("id") on update cascade;',
);
}

override async down(): Promise<void> {
this.addSql('drop table if exists "organisation_service_provider" cascade;');
}
}
Loading

0 comments on commit 109cab6

Please sign in to comment.