mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:57:32 +00:00
chore: move the go code into a subfolder
This commit is contained in:
47
apps/api/internal/domain/project_role.go
Normal file
47
apps/api/internal/domain/project_role.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
type ProjectRole struct {
|
||||
models.ObjectRoot
|
||||
|
||||
Key string
|
||||
DisplayName string
|
||||
Group string
|
||||
}
|
||||
|
||||
type ProjectRoleState int32
|
||||
|
||||
const (
|
||||
ProjectRoleStateUnspecified ProjectRoleState = iota
|
||||
ProjectRoleStateActive
|
||||
ProjectRoleStateRemoved
|
||||
)
|
||||
|
||||
func (s ProjectRoleState) Exists() bool {
|
||||
return s != ProjectRoleStateUnspecified && s != ProjectRoleStateRemoved
|
||||
}
|
||||
|
||||
func (p *ProjectRole) IsValid() bool {
|
||||
return p.AggregateID != "" && p.Key != ""
|
||||
}
|
||||
|
||||
func HasInvalidRoles(validRoles, roles []string) bool {
|
||||
for _, roleKey := range roles {
|
||||
if !containsRoleKey(roleKey, validRoles) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func containsRoleKey(roleKey string, validRoles []string) bool {
|
||||
for _, validRole := range validRoles {
|
||||
if roleKey == validRole {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user