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) {
|
2023-10-11 07:55:01 +00:00
|
|
|
orgDomain, _ := NewIAMDomainName(o.Name, iamDomain)
|
|
|
|
o.Domains = append(o.Domains, &OrgDomain{Domain: orgDomain, 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
|
|
|
)
|