mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
fix: todos (#1346)
* fix: pub sub in new eventstore * fix: todos * fix: todos * fix: todos * fix: todos * fix: todos
This commit is contained in:
@@ -1,9 +1,37 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
IAMRolePrefix = "IAM"
|
||||
OrgRolePrefix = "ORG"
|
||||
ProjectRolePrefix = "PROJECT"
|
||||
ProjectGrantRolePrefix = "PROJECT_GRANT"
|
||||
RoleOrgOwner = "ORG_OWNER"
|
||||
RoleOrgProjectCreator = "ORG_PROJECT_CREATOR"
|
||||
RoleIAMOwner = "IAM_OWNER"
|
||||
RoleProjectOwner = "PROJECT_OWNER"
|
||||
RoleProjectOwnerGlobal = "PROJECT_OWNER_GLOBAL"
|
||||
)
|
||||
|
||||
func CheckForInvalidRoles(roles []string, rolePrefix string, validRoles []authz.RoleMapping) []string {
|
||||
invalidRoles := make([]string, 0)
|
||||
for _, role := range roles {
|
||||
if !containsRole(role, rolePrefix, validRoles) {
|
||||
invalidRoles = append(invalidRoles, role)
|
||||
}
|
||||
}
|
||||
return invalidRoles
|
||||
}
|
||||
|
||||
func containsRole(role, rolePrefix string, validRoles []authz.RoleMapping) bool {
|
||||
for _, validRole := range validRoles {
|
||||
if role == validRole.Role && strings.HasPrefix(role, rolePrefix) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user