2021-01-08 10:33:45 +00:00
|
|
|
package domain
|
|
|
|
|
|
|
|
import (
|
2022-08-19 13:00:14 +00:00
|
|
|
"strings"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/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-08-19 13:00:14 +00:00
|
|
|
if o == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
o.Name = strings.TrimSpace(o.Name)
|
|
|
|
return 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
|
|
|
)
|