allow self-service onboarding for authenticated users without roles

This commit is contained in:
2026-04-03 14:19:44 -07:00
parent b219edd2c9
commit 1a99305992
+10
View File
@@ -232,7 +232,17 @@ func requireRole(store ComplianceStore, module, action string, next http.Handler
rolesHeader = "superadmin"
}
// Authenticated users with no explicit role get default access to
// self-service modules (sessions, applications, kyc). This allows
// new users to complete onboarding without pre-assigned roles.
if rolesHeader == "" {
selfServiceModules := map[string]bool{
"sessions": true, "applications": true, "kyc": true,
}
if selfServiceModules[module] {
next(w, r)
return
}
writeError(w, http.StatusForbidden, "no role in token")
return
}