Skip to content

fix(server-nestjs): backfill default system roles on roleless projects - #2685

Merged
shikanime merged 1 commit into
mainfrom
pr/2684-backfill-roles
Sep 8, 2026
Merged

fix(server-nestjs): backfill default system roles on roleless projects#2685
shikanime merged 1 commit into
mainfrom
pr/2684-backfill-roles

Conversation

@shikanime

@shikanime shikanime commented Sep 7, 2026

Copy link
Copy Markdown
Member

Issues liées

Refs #2684

Quel est le comportement actuel ?

Les projets créés avant l'introduction de generateProjectCreateInput (apps/server-nestjs/src/modules/project/project.utils.ts) n'ont aucune ligne dans ProjectRole : leurs membres n'ont aucune permission et les groupes OIDC Keycloak correspondants sont absents.

Quel est le nouveau comportement ?

Les projets disposant déjà d'au moins un rôle ne sont pas touchés ; la migration est idempotente (WHERE NOT EXISTS).

Cette PR introduit-elle un breaking change ?

Non.

Autres informations

Validée sur PostgreSQL 16 jetable : un projet sans rôle reçoit exactement 4 rôles (permissions, positions et oidcGroup conformes), un projet avec rôles reste inchangé, une seconde exécution insère 0 ligne (INSERT 0 0).

Refs #2684

@shikanime shikanime self-assigned this Sep 7, 2026
@shikanime shikanime added the technical debt Résoud de la dette technique label Sep 7, 2026
@shikanime shikanime added this to the 9.26.0 milestone Sep 7, 2026
@shikanime
shikanime force-pushed the pr/2684-backfill-roles branch 2 times, most recently from 9184499 to 2a33d0c Compare September 7, 2026 15:01
@github-actions github-actions Bot added the built label Sep 7, 2026
@shikanime
shikanime force-pushed the pr/2684-backfill-roles branch from 2a33d0c to 1d5b4cf Compare September 7, 2026 15:21
Projects created before generateProjectCreateInput seeded the four default
project roles have no ProjectRole rows: members hold no permissions and the
Keycloak OIDC groups are absent.

Insert Administrateur (2), DevOps (984), Développeur (784) and Lecture seule
(768) with system:managed type and slug-derived oidcGroup, mirroring
generateProjectCreateInput, only into projects owning zero roles. Projects
with any existing role are left untouched and the insert is idempotent.

Refs #2684

Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: I520cf59e2d3fc2d59b64df4441a571b26a6a6964
@shikanime
shikanime force-pushed the pr/2684-backfill-roles branch from 1d5b4cf to 55d4ae4 Compare September 7, 2026 15:23
@shikanime shikanime added the preview Deploy preview app with Argo-cd label Sep 7, 2026
@shikanime
shikanime marked this pull request as ready for review September 7, 2026 15:23
@shikanime
shikanime requested a review from a team as a code owner September 7, 2026 15:23
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🤖 Hey !

A preview of the application is available at : https://console-pr-2685.dso.cpin-hp.numerique-interieur.fr

Please be patient, deployment may take a few minutes.

@cloud-pi-native-sonarqube

Copy link
Copy Markdown

@StephaneTrebel StephaneTrebel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@shikanime
shikanime added this pull request to the merge queue Sep 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 7, 2026
@shikanime
shikanime added this pull request to the merge queue Sep 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 7, 2026
@shikanime
shikanime added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit 796870c Sep 8, 2026
83 of 85 checks passed
@shikanime
shikanime deleted the pr/2684-backfill-roles branch September 8, 2026 12:24
@shikanime shikanime modified the milestones: 9.26.0, 9.25.2 Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

built preview Deploy preview app with Argo-cd technical debt Résoud de la dette technique

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants