mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
fa9f581d56
* chore: move to new org * logging * fix: org rename caos -> zitadel Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
36 lines
693 B
Go
36 lines
693 B
Go
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
|
|
}
|