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