From 4a3485165322e282b140a05ea4194b6ec029e9ba Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Thu, 31 Aug 2023 17:12:55 +0200 Subject: [PATCH 1/4] add requirements to disable switch --- .../AdminMigrationSection.unit.ts | 89 ++++++++++++++++++- .../administration/AdminMigrationSection.vue | 1 + 2 files changed, 87 insertions(+), 3 deletions(-) diff --git a/src/components/administration/AdminMigrationSection.unit.ts b/src/components/administration/AdminMigrationSection.unit.ts index 5de809cdfd..13e9cf735d 100644 --- a/src/components/administration/AdminMigrationSection.unit.ts +++ b/src/components/administration/AdminMigrationSection.unit.ts @@ -783,8 +783,8 @@ describe("AdminMigrationSection", () => { }); }); - describe("when migration is not yet finished", () => { - it("should show switch button and description", () => { + describe("when migration is active", () => { + it("should show switch button", () => { const { wrapper } = setup( { getOauthMigration: { @@ -808,10 +808,93 @@ describe("AdminMigrationSection", () => { }); }); + describe("when migration has not yet started", () => { + it("should disable the switch", () => { + const { wrapper } = setup( + { + getOauthMigration: { + enableMigrationStart: true, + oauthMigrationPossible: false, + oauthMigrationMandatory: false, + oauthMigrationFinished: "", + oauthMigrationFinalFinish: "", + }, + }, + { + getEnableLdapSyncDuringMigration: true, + } + ); + + const switchComponent = wrapper.find( + '[data-testid="enable-sync-during-migration-switch"]' + ); + + expect(switchComponent.attributes("disabled")).toEqual("disabled"); + }); + }); + + describe("when migration is active", () => { + it("should enable the switch", () => { + const { wrapper } = setup( + { + getOauthMigration: { + enableMigrationStart: true, + oauthMigrationPossible: true, + oauthMigrationMandatory: false, + oauthMigrationFinished: "", + oauthMigrationFinalFinish: "", + }, + }, + { + getEnableLdapSyncDuringMigration: true, + } + ); + + const switchComponent = wrapper.find( + '[data-testid="enable-sync-during-migration-switch"]' + ); + + expect(switchComponent.attributes("disabled")).toEqual(undefined); + }); + }); + + describe("when migration has not yet closed", () => { + it("should disable the switch", () => { + const { wrapper } = setup( + { + getOauthMigration: { + enableMigrationStart: true, + oauthMigrationPossible: false, + oauthMigrationMandatory: false, + oauthMigrationFinished: new Date(2023, 1, 1).toDateString(), + oauthMigrationFinalFinish: "", + }, + }, + { + getEnableLdapSyncDuringMigration: true, + } + ); + + const switchComponent = wrapper.find( + '[data-testid="enable-sync-during-migration-switch"]' + ); + + expect(switchComponent.attributes("disabled")).toEqual("disabled"); + }); + }); + describe("when clicking switch button", () => { it("should call update in schoolsModule", async () => { const { wrapper, schoolsModule } = setup( - {}, + { + getOauthMigration: { + enableMigrationStart: true, + oauthMigrationPossible: true, + oauthMigrationMandatory: false, + oauthMigrationFinished: "", + oauthMigrationFinalFinish: "", + }, + }, { getEnableLdapSyncDuringMigration: true, } diff --git a/src/components/administration/AdminMigrationSection.vue b/src/components/administration/AdminMigrationSection.vue index 1a908adb25..a72e2ee5a7 100644 --- a/src/components/administration/AdminMigrationSection.vue +++ b/src/components/administration/AdminMigrationSection.vue @@ -131,6 +131,7 @@ 'components.administration.adminMigrationSection.enableSyncDuringMigration.label' ) " + :disabled="!oauthMigration.oauthMigrationPossible" v-model="school.features.enableLdapSyncDuringMigration" inset dense From 6053792d27cde855dbb5d40c46cd7b11cb7bc8d6 Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Fri, 1 Sep 2023 13:42:58 +0200 Subject: [PATCH 2/4] update schoolfeatures after migration close --- .../administration/AdminMigrationSection.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/administration/AdminMigrationSection.vue b/src/components/administration/AdminMigrationSection.vue index a72e2ee5a7..46de623a2d 100644 --- a/src/components/administration/AdminMigrationSection.vue +++ b/src/components/administration/AdminMigrationSection.vue @@ -213,18 +213,19 @@ export default defineComponent({ () => schoolsModule.getOauthMigration ); - const setMigration = (available: boolean, mandatory: boolean) => { + const setMigration = async (available: boolean, mandatory: boolean) => { const migrationFlags: MigrationBody = { oauthMigrationPossible: available, oauthMigrationMandatory: mandatory, oauthMigrationFinished: !available, }; - schoolsModule.setSchoolOauthMigration(migrationFlags); + await schoolsModule.setSchoolOauthMigration(migrationFlags); + await schoolsModule.fetchSchool(); }; const school: ComputedRef = computed(() => schoolsModule.getSchool); - watch(school, () => { - schoolsModule.fetchSchoolOAuthMigration(); + watch(school, async () => { + await schoolsModule.fetchSchoolOAuthMigration(); }); const isShowEndWarning: Ref = ref(false); @@ -303,8 +304,8 @@ export default defineComponent({ () => envConfigModule.getShowOutdatedUsers ); - const setSchoolFeatures = () => { - schoolsModule.update({ + const setSchoolFeatures = async () => { + await schoolsModule.update({ id: school.value.id, features: school.value.features, }); From e338b4aa4d3bab21b34aeb52bcf9132c07f67bc8 Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Fri, 1 Sep 2023 15:01:20 +0200 Subject: [PATCH 3/4] text changes --- src/locales/de.json | 2 +- src/locales/en.json | 2 +- src/locales/es.json | 2 +- src/locales/uk.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/locales/de.json b/src/locales/de.json index 4aea51fd08..34c36f4431 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -140,7 +140,7 @@ "components.editor.highlight.dullGreen": "Grüner Marker (matt)", "components.editor.highlight.dullPink": "Pinker Marker (matt)", "components.editor.highlight.dullYellow": "Gelber Marker (matt)", - "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Die Synchronisation mit dem bisherigen Login-System für Klassen und neue Accounts während der Migration erlauben", + "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Die Synchronisation mit dem bisherigen Login-System für Klassen und Accounts während der Migration erlauben", "components.administration.adminMigrationSection.endWarningCard.agree": "Ok", "components.administration.adminMigrationSection.endWarningCard.disagree": "Abbrechen", "components.administration.adminMigrationSection.endWarningCard.text": "Bitte bestätigen, dass die Account-Migration zu moin.schule abgeschlossen werden soll.

Achtung: Der Abschluss der Account-Migration hat folgende Auswirkungen:

  • Zu moin.schule gewechselte Schüler:innen und Lehrkräfte können sich nur noch über moin.schule anmelden.

  • Eine Migration ist für Schüler:innen und Lehrkräfte nicht mehr möglich.

  • Nicht migrierte Schüler:innen und Lehrkräfte können sich weiterhin wie bisher anmelden.

  • Nicht migrierte Anwender können sich auch über moin.schule anmelden, erzeugen aber dadurch einen zusätzlichen, leeren Account in der Niedersächsischen Bildungscloud.
    Eine automatische Datenübernahme aus dem vorbestehenden Account in diesen neuen Account ist nicht möglich.

  • Nach Ablauf einer Wartefrist von {gracePeriod} Tagen wird der Abschluss der Account-Migration endgültig. Im Anschluss wird das alte Anmeldesystem abgeschaltet und nicht migrierte Accounts werden gelöscht.


Wichtige Informationen zum Migrationsprozess sind hier verfügbar.", diff --git a/src/locales/en.json b/src/locales/en.json index 69dc8604eb..9080d4e353 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -139,7 +139,7 @@ "components.editor.highlight.dullGreen": "Green marker (dull)", "components.editor.highlight.dullPink": "Pink marker (dull)", "components.editor.highlight.dullYellow": "Yellow marker (dull)", - "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Allow synchronization with the previous login system for classes and new accounts during the migration", + "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Allow synchronization with the previous login system for classes and accounts during the migration", "components.administration.adminMigrationSection.endWarningCard.agree": "Ok", "components.administration.adminMigrationSection.endWarningCard.disagree": "Abort", "components.administration.adminMigrationSection.endWarningCard.text": "Please confirm that you want to complete the user account migration to moin.schule.

Warning: Completing the user account migration has the following effects:

  • Students and teachers who switched to moin.schule can only register via moin.schule.

  • Migration is no longer possible for students and teachers.

  • Students and teachers who have not migrated can still log in as before.

  • Users who have not migrated can also log in via moin.schule, but this creates an additional, empty account in the Niedersächsische Bildungscloud.
    Automatic data transfer from the existing account to this new account is not possible.

  • After a waiting period of {gracePeriod} days, the completion of the account migration becomes final. Subsequently, the old login system will be shut down and non-migrated accounts will be deleted.


Important information on the migration process is available here.", diff --git a/src/locales/es.json b/src/locales/es.json index 3fce3c54f1..14e92da747 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -139,7 +139,7 @@ "components.editor.highlight.dullGreen": "Marcador verde (mate)", "components.editor.highlight.dullPink": "Marcador rosa (mate)", "components.editor.highlight.dullYellow": "Marcador amarillo (mate)", - "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Permitir la sincronización con el sistema de inicio de sesión anterior para clases y cuentas nuevas durante la migración", + "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Permitir la sincronización con el sistema de inicio de sesión anterior para clases y cuentas durante la migración", "components.administration.adminMigrationSection.endWarningCard.agree": "Sí", "components.administration.adminMigrationSection.endWarningCard.disagree": "Desgaje", "components.administration.adminMigrationSection.endWarningCard.text": "Confirme que desea completar la migración de la cuenta de usuario a moin.schule.

Advertencia: Completar la migración de la cuenta de usuario tiene los siguientes efectos:

  • Los estudiantes y profesores que cambiaron a moin.schule solo pueden registrarse a través de moin.schule.

  • La migración ya no es posible para estudiantes y profesores.

  • Los estudiantes y profesores que no han migrado aún pueden seguir matriculándose como antes.

  • Los usuarios que no han migrado también pueden iniciar sesión a través de moin.schule, pero esto crea una cuenta vacía adicional en Niedersächsische Bildungscloud.
    No es posible la transferencia automática de datos de la cuenta existente a esta nueva cuenta.

  • Tras un periodo de espera de {gracePeriod} días, la finalización de la migración de cuentas se convierte en definitiva. A continuación, se desactiva el antiguo sistema de inicio de sesión y se eliminan las cuentas que no se hayan migrado.


La información importante sobre el proceso de migración está disponible aquí.", diff --git a/src/locales/uk.json b/src/locales/uk.json index 0121490705..0fdab59145 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -140,7 +140,7 @@ "components.editor.highlight.dullGreen": "Зелений маркер (матові)", "components.editor.highlight.dullPink": "Рожевий маркер (матові)", "components.editor.highlight.dullYellow": "Жовтий маркер (матові)", - "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Дозволити синхронізацію з попередньою системою входу для класів і нових облікових записів під час міграції", + "components.administration.adminMigrationSection.enableSyncDuringMigration.label": "Дозволити синхронізацію з попередньою системою входу для класів і облікових записів під час міграції", "components.administration.adminMigrationSection.endWarningCard.agree": "в порядку", "components.administration.adminMigrationSection.endWarningCard.disagree": "Переривати", "components.administration.adminMigrationSection.endWarningCard.text": "Будь ласка, підтвердьте, що ви хочете завершити міграцію облікового запису користувача до moin.schule.

Попередження: Завершення міграції облікового запису користувача має такі наслідки:

  • Студенти та викладачі, які перейшли на moin.schule, можуть зареєструватися лише через moin.schule.

  • Міграція більше неможлива для студентів і викладачів.

  • Студенти і вчителі, які не перейшли, можуть продовжувати реєструватися, як і раніше.

  • Користувачі, які не перейшли, також можуть зареєструватися через moin.schule, але це створює додатковий порожній обліковий запис у Niedersächsische Bildungscloud.
    Автоматичне перенесення даних із існуючого облікового запису до цього нового облікового запису неможливе.

  • Після періоду очікування в {gracePeriod} дн. перенесення облікового запису стає остаточним. Тоді стару систему реєстрації буде вимкнено, а облікові записи, які не було перенесено, буде видалено.


Доступна важлива інформація щодо процесу міграції тут.", From d543726bb99b4d1e861cf32770af7d0c718a5a35 Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Tue, 5 Sep 2023 11:14:44 +0200 Subject: [PATCH 4/4] test amendments --- .../AdminMigrationSection.unit.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/administration/AdminMigrationSection.unit.ts b/src/components/administration/AdminMigrationSection.unit.ts index 13e9cf735d..26a7a6b373 100644 --- a/src/components/administration/AdminMigrationSection.unit.ts +++ b/src/components/administration/AdminMigrationSection.unit.ts @@ -430,6 +430,7 @@ describe("AdminMigrationSection", () => { oauthMigrationMandatory: false, oauthMigrationFinished: false, }); + expect(schoolsModule.fetchSchool).toHaveBeenCalled(); }); }); @@ -509,6 +510,7 @@ describe("AdminMigrationSection", () => { oauthMigrationMandatory: false, oauthMigrationFinished: true, }); + expect(schoolsModule.fetchSchool).toHaveBeenCalled(); }); }); @@ -806,15 +808,13 @@ describe("AdminMigrationSection", () => { expect(switchComponent.exists()).toBe(true); }); - }); - describe("when migration has not yet started", () => { - it("should disable the switch", () => { + it("should enable the switch", () => { const { wrapper } = setup( { getOauthMigration: { enableMigrationStart: true, - oauthMigrationPossible: false, + oauthMigrationPossible: true, oauthMigrationMandatory: false, oauthMigrationFinished: "", oauthMigrationFinalFinish: "", @@ -829,17 +829,17 @@ describe("AdminMigrationSection", () => { '[data-testid="enable-sync-during-migration-switch"]' ); - expect(switchComponent.attributes("disabled")).toEqual("disabled"); + expect(switchComponent.attributes("disabled")).toEqual(undefined); }); }); - describe("when migration is active", () => { - it("should enable the switch", () => { + describe("when migration has not yet started", () => { + it("should disable the switch", () => { const { wrapper } = setup( { getOauthMigration: { enableMigrationStart: true, - oauthMigrationPossible: true, + oauthMigrationPossible: false, oauthMigrationMandatory: false, oauthMigrationFinished: "", oauthMigrationFinalFinish: "", @@ -854,7 +854,7 @@ describe("AdminMigrationSection", () => { '[data-testid="enable-sync-during-migration-switch"]' ); - expect(switchComponent.attributes("disabled")).toEqual(undefined); + expect(switchComponent.attributes("disabled")).toEqual("disabled"); }); });