fix(authz): bundle labels as the portal names them; last admin message
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
This commit is contained in:
1 parent
dd94763d50
commit
f4a9f937fb
2 files changed
+10
-8
No files matched your search
@@ -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",
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user