2021-01-08 10:33:45 +00:00
|
|
|
package domain
|
|
|
|
|
|
|
|
import (
|
2021-02-23 14:13:04 +00:00
|
|
|
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
2021-01-08 10:33:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Org struct {
|
|
|
|
models.ObjectRoot
|
|
|
|
|
|
|
|
State OrgState
|
|
|
|
Name string
|
|
|
|
|
2022-03-24 16:21:34 +00:00
|
|
|
PrimaryDomain string
|
|
|
|
Domains []*OrgDomain
|
2021-01-08 10:33:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Org) IsValid() bool {
|
2022-03-28 08:05:09 +00:00
|
|
|
return o != nil && o.Name != ""
|
2021-01-08 10:33:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Org) AddIAMDomain(iamDomain string) {
|
2021-04-19 14:43:36 +00:00
|
|
|
o.Domains = append(o.Domains, &OrgDomain{Domain: NewIAMDomainName(o.Name, iamDomain), Verified: true, Primary: true})
|
2021-01-08 10:33:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type OrgState int32
|
|
|
|
|
|
|
|
const (
|
2021-01-15 08:32:59 +00:00
|
|
|
OrgStateUnspecified OrgState = iota
|
|
|
|
OrgStateActive
|
2021-01-08 10:33:45 +00:00
|
|
|
OrgStateInactive
|
2021-01-18 10:24:15 +00:00
|
|
|
OrgStateRemoved
|
2021-01-08 10:33:45 +00:00
|
|
|
)
|