mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:47:32 +00:00
chore: move the go code into a subfolder
This commit is contained in:
35
apps/api/internal/domain/user_grant.go
Normal file
35
apps/api/internal/domain/user_grant.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package domain
|
||||
|
||||
import es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
|
||||
type UserGrant struct {
|
||||
es_models.ObjectRoot
|
||||
|
||||
State UserGrantState
|
||||
UserID string
|
||||
ProjectID string
|
||||
ProjectGrantID string
|
||||
RoleKeys []string
|
||||
}
|
||||
|
||||
type UserGrantState int32
|
||||
|
||||
const (
|
||||
UserGrantStateUnspecified UserGrantState = iota
|
||||
UserGrantStateActive
|
||||
UserGrantStateInactive
|
||||
UserGrantStateRemoved
|
||||
)
|
||||
|
||||
func (u *UserGrant) IsValid() bool {
|
||||
return u.ProjectID != "" && u.UserID != ""
|
||||
}
|
||||
|
||||
func (g *UserGrant) HasInvalidRoles(validRoles []string) bool {
|
||||
for _, roleKey := range g.RoleKeys {
|
||||
if !containsRoleKey(roleKey, validRoles) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user