From f4a9f937fbea659f4c38dd8ab799489d836843d2 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:59:15 +0100 Subject: [PATCH] fix(authz): bundle labels as the portal names them; last admin message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The catalogue named CXO "Geschäftsleitung" and OWNER "Inhaber des Arbeitsbereichs", while the portal shows "Geschäftsführung" and "Inhaberschaft". The catalogue now takes the portal's names (version 2026-11-12.1), which also keeps the role "Geschäftsführung" apart from the company function "Geschäftsleitung" of the role dataset. The last-admin refusal named only IT_ADMIN; the guard holds for OWNER too, so the message now says "the last administrator (IT_ADMIN or OWNER)". Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf --- internal/authz/catalogue.go | 12 +++++++----- internal/server/team.go | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/internal/authz/catalogue.go b/internal/authz/catalogue.go index 6b132b1..36bd423 100644 --- a/internal/authz/catalogue.go +++ b/internal/authz/catalogue.go @@ -23,7 +23,7 @@ import "strings" // Version names this catalogue; it changes with every change of a // capability, bundle or position. -const Version = "2026-11-11.1" +const Version = "2026-11-12.1" // Products a capability belongs to. const ( @@ -143,10 +143,12 @@ func join(groups ...[]string) []string { // grant them on 2026-11-10; then the new ones of variant L and EXTERNAL. var Bundles = []Bundle{ {Code: "IT_ADMIN", Label: "IT-Administration", Assignable: true, Capabilities: join(adminPortal, adminWerkmeister, adminRegistry)}, - // OWNER has IT_ADMIN's rights. The portal does not know OWNER yet; it - // will show it like IT_ADMIN (step 2, decided 2026-11-10). - {Code: "OWNER", Label: "Inhaber des Arbeitsbereichs", Assignable: true, Capabilities: join(adminPortal, adminWerkmeister, adminRegistry)}, - {Code: "CXO", Label: "Geschäftsleitung", Assignable: true, Capabilities: join(member, []string{ + // OWNER has IT_ADMIN's rights; the portal shows it like IT_ADMIN (decided + // 2026-11-10). Bundle labels are the portal's German role names, so the + // role "Geschäftsführung" (CXO) stays apart from the company function + // "Geschäftsleitung" (r1.geschaeftsleitung) of the role dataset. + {Code: "OWNER", Label: "Inhaberschaft", Assignable: true, Capabilities: join(adminPortal, adminWerkmeister, adminRegistry)}, + {Code: "CXO", Label: "Geschäftsführung", Assignable: true, Capabilities: join(member, []string{ "portal:products.view", "portal:projects.view", "portal:profile.view", "portal:billing.view", "portal:audit.view", "portal:catalog.view", "portal:documents.view", "portal:store.view", "portal:contracts.view", "portal:infra.view", "portal:studio.view", "portal:profile.edit", "portal:store.upload", "portal:projects.edit", diff --git a/internal/server/team.go b/internal/server/team.go index 9472323..798a3b1 100644 --- a/internal/server/team.go +++ b/internal/server/team.go @@ -260,7 +260,7 @@ func (s *Server) changeRole(ctx context.Context, w http.ResponseWriter, r *http. return } if !isAdminRole([]string{role}) && lastActiveAdmin(members, m) { - writeError(w, http.StatusConflict, "last_admin", "the last IT_ADMIN of a workspace cannot be demoted") + writeError(w, http.StatusConflict, "last_admin", "the last administrator (IT_ADMIN or OWNER) of a workspace cannot be demoted") return } if err := s.Keycloak.SetMemberRole(ctx, m.UserID, role); err != nil { @@ -278,7 +278,7 @@ func (s *Server) setBlocked(ctx context.Context, w http.ResponseWriter, r *http. return } if blocked && lastActiveAdmin(members, m) { - writeError(w, http.StatusConflict, "last_admin", "the last IT_ADMIN of a workspace cannot be blocked") + writeError(w, http.StatusConflict, "last_admin", "the last administrator (IT_ADMIN or OWNER) of a workspace cannot be blocked") return } if err := s.Keycloak.SetMemberBlocked(ctx, m.UserID, t.ID, blocked); err != nil { @@ -323,7 +323,7 @@ func (s *Server) deleteMember(w http.ResponseWriter, r *http.Request, resolve te return } if lastActiveAdmin(members, m) { - writeError(w, http.StatusConflict, "last_admin", "the last IT_ADMIN of a workspace cannot be removed") + writeError(w, http.StatusConflict, "last_admin", "the last administrator (IT_ADMIN or OWNER) of a workspace cannot be removed") return }