mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
ff87264f95
* add setup steps * refactoring * omitempty * cleanup * begin org * create org * setup org * setup org * merge * fixes * fixes * fixes
41 lines
686 B
Go
41 lines
686 B
Go
package domain
|
|
|
|
import (
|
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
|
)
|
|
|
|
type Member struct {
|
|
es_models.ObjectRoot
|
|
|
|
UserID string
|
|
Roles []string
|
|
}
|
|
|
|
func NewMember(aggregateID, userID string, roles ...string) *Member {
|
|
return &Member{
|
|
ObjectRoot: es_models.ObjectRoot{
|
|
AggregateID: aggregateID,
|
|
},
|
|
UserID: userID,
|
|
Roles: roles,
|
|
}
|
|
}
|
|
|
|
func (i *Member) IsValid() bool {
|
|
return i.AggregateID != "" && i.UserID != "" && len(i.Roles) != 0
|
|
}
|
|
|
|
type MemberState int32
|
|
|
|
const (
|
|
MemberStateUnspecified MemberState = iota
|
|
MemberStateActive
|
|
MemberStateRemoved
|
|
|
|
memberStateCount
|
|
)
|
|
|
|
func (f MemberState) Valid() bool {
|
|
return f >= 0 && f < memberStateCount
|
|
}
|