Skip to content

Commit 8def1df

Browse files
fix: check if OIDC is activated before deleting users (#1029)
* fix: check if OIDC is activated before deleting users Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com> * chore: bump versions Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com> * chore: bump chart version Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com> * chore: unbump chart version Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com> * chore: bump chart version Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com> --------- Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com>
1 parent 198bce4 commit 8def1df

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
<!-- towncrier release notes start -->
9-
109
## [1.0.0](https://github.com/Substra/substra-backend/releases/tag/1.0.0) - 2024-10-14
1110

1211
### Added

backend/users/management/commands/sync_users.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import os
2+
13
from django.conf import settings
24
from django.contrib.auth import get_user_model
35
from django.contrib.auth.password_validation import validate_password
46
from django.core.exceptions import ValidationError
57
from django.db import models
68

9+
from backend.settings.deps.utils import to_bool
710
from organization.management.commands.base_sync import BaseSyncCommand
811
from organization.management.commands.base_sync import Element
912
from users.models import UserChannel
@@ -52,6 +55,9 @@ def update_password(self, element: UserElement) -> models.Model:
5255
return user
5356

5457
def delete(self, discarded_keys: set[str]) -> None:
55-
# Prevent the deletion of virtual users
56-
discarded_keys.difference_update(settings.VIRTUAL_USERNAMES.values())
57-
super().delete(discarded_keys)
58+
if to_bool(os.environ.get("OIDC_ENABLED", "false")):
59+
self.stdout.write("Not deleting users that are not in the file to avoid removing OIDC users.")
60+
else:
61+
# Prevent the deletion of virtual users
62+
discarded_keys.difference_update(settings.VIRTUAL_USERNAMES.values())
63+
super().delete(discarded_keys)

changes/1029.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
User migration check OIDC activation before removing users

charts/substra-backend/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22

33
<!-- towncrier release notes start -->
4+
## [26.15.2] - 2025-02-17
5+
6+
Inject OIDC config in migration job & bump app version to 1.0.1
7+
48
## [26.15.1] - 2025-01-06
59

610
Fix missing role on builder pod

charts/substra-backend/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: substra-backend
33
home: https://github.com/Substra
4-
version: 26.15.1
4+
version: 26.15.2
55
appVersion: 1.0.0
66
kubeVersion: '>= 1.19.0-0'
77
description: Main package for Substra

charts/substra-backend/templates/job-migrations.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ spec:
6161
name: {{ include "substra.fullname" . }}-orchestrator
6262
- configMapRef:
6363
name: {{ include "substra.fullname" . }}-database
64+
- configMapRef:
65+
name: {{ include "substra.fullname" . }}-oidc
6466
- secretRef:
6567
name: {{ include "substra-backend.database.secret-name" . }}
6668
env:

0 commit comments

Comments
 (0)