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

N21-1236 add requirements to disable switch #2780

Merged
merged 7 commits into from
Sep 5, 2023
Merged
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
89 changes: 86 additions & 3 deletions src/components/administration/AdminMigrationSection.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ describe("AdminMigrationSection", () => {
oauthMigrationMandatory: false,
oauthMigrationFinished: false,
});
expect(schoolsModule.fetchSchool).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -509,6 +510,7 @@ describe("AdminMigrationSection", () => {
oauthMigrationMandatory: false,
oauthMigrationFinished: true,
});
expect(schoolsModule.fetchSchool).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -783,8 +785,8 @@ describe("AdminMigrationSection", () => {
});
});

describe("when migration is not yet finished", () => {
it("should show switch button and description", () => {
describe("when migration is active", () => {
IgorCapCoder marked this conversation as resolved.
Show resolved Hide resolved
it("should show switch button", () => {
const { wrapper } = setup(
{
getOauthMigration: {
Expand All @@ -806,12 +808,93 @@ describe("AdminMigrationSection", () => {

expect(switchComponent.exists()).toBe(true);
});

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 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 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,
}
Expand Down
14 changes: 8 additions & 6 deletions src/components/administration/AdminMigrationSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
'components.administration.adminMigrationSection.enableSyncDuringMigration.label'
)
"
:disabled="!oauthMigration.oauthMigrationPossible"
IgorCapCoder marked this conversation as resolved.
Show resolved Hide resolved
v-model="school.features.enableLdapSyncDuringMigration"
inset
dense
Expand Down Expand Up @@ -212,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();
IgorCapCoder marked this conversation as resolved.
Show resolved Hide resolved
};

const school: ComputedRef<School> = computed(() => schoolsModule.getSchool);
watch(school, () => {
schoolsModule.fetchSchoolOAuthMigration();
watch(school, async () => {
await schoolsModule.fetchSchoolOAuthMigration();
});

const isShowEndWarning: Ref<boolean> = ref(false);
Expand Down Expand Up @@ -302,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,
});
Expand Down
2 changes: 1 addition & 1 deletion src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br><br><span class=\"red--text\">Achtung: Der Abschluss der Account-Migration hat folgende Auswirkungen:</span><br><br><ul><li>Zu moin.schule gewechselte Schüler:innen und Lehrkräfte können sich nur noch über moin.schule anmelden.</li><br><li>Eine Migration ist für Schüler:innen und Lehrkräfte nicht mehr möglich.</li><br><li>Nicht migrierte Schüler:innen und Lehrkräfte können sich weiterhin wie bisher anmelden.</li><br><li>Nicht migrierte Anwender können sich auch über moin.schule anmelden, erzeugen aber dadurch einen zusätzlichen, leeren Account in der Niedersächsischen Bildungscloud.<br><span class=\"red--text\">Eine automatische Datenübernahme aus dem vorbestehenden Account in diesen neuen Account ist nicht möglich.</span></li><br><li><span class=\"red--text\">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.</span></li></ul><br><br>Wichtige Informationen zum Migrationsprozess sind <a href=\"https://blog.niedersachsen.cloud/umzug\" target=\"_blank\">hier</a> verfügbar.",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br><br><span class=\"red--text\">Warning: Completing the user account migration has the following effects:</span><br><br><ul><li>Students and teachers who switched to moin.schule can only register via moin.schule.</li><br><li>Migration is no longer possible for students and teachers.</li><br><li>Students and teachers who have not migrated can still log in as before.</li><br><li>Users who have not migrated can also log in via moin.schule, but this creates an additional, empty account in the Niedersächsische Bildungscloud.<br><span class=\"red--text\">Automatic data transfer from the existing account to this new account is not possible.</span></li><br><li><span class=\"red--text\">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.</span></li></ul><br><br> Important information on the migration process is available <a href=\"https://blog.niedersachsen.cloud/umzug\" target=\"_blank\">here</a>.",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br><br><span class=\"red--text\">Advertencia: Completar la migración de la cuenta de usuario tiene los siguientes efectos:</span><br><br><ul><li>Los estudiantes y profesores que cambiaron a moin.schule solo pueden registrarse a través de moin.schule.</li><br><li>La migración ya no es posible para estudiantes y profesores.</li><br><li>Los estudiantes y profesores que no han migrado aún pueden seguir matriculándose como antes.</li><br><li>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.<br><span class=\"red--text\">No es posible la transferencia automática de datos de la cuenta existente a esta nueva cuenta.</span></li><br><li><span class=\"red--text\">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.</span></li></ul><br><br> La información importante sobre el proceso de migración está disponible <a href=\"https://blog.niedersachsen.cloud/umzug\" target=\"_blank\">aquí</a>.",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br><br><span class=\"red--text\">Попередження: Завершення міграції облікового запису користувача має такі наслідки:</span><br><br><ul><li>Студенти та викладачі, які перейшли на moin.schule, можуть зареєструватися лише через moin.schule.</li><br><li>Міграція більше неможлива для студентів і викладачів.</li><br><li>Студенти і вчителі, які не перейшли, можуть продовжувати реєструватися, як і раніше.</li><br><li>Користувачі, які не перейшли, також можуть зареєструватися через moin.schule, але це створює додатковий порожній обліковий запис у Niedersächsische Bildungscloud.<br><span class=\"red--text\">Автоматичне перенесення даних із існуючого облікового запису до цього нового облікового запису неможливе.<span></li><br><li><span class=\"red--text\">Після періоду очікування в {gracePeriod} дн. перенесення облікового запису стає остаточним. Тоді стару систему реєстрації буде вимкнено, а облікові записи, які не було перенесено, буде видалено.</span></li></ul><br><br>Доступна важлива інформація щодо процесу міграції <a href=\"https://blog.niedersachsen.cloud/umzug\" target=\"_blank\">тут</a>.",
Expand Down
Loading