zitadel/internal/domain/org.go
Miguel Cabrerizo 2d4cd331da
fix: allow unicode characters in org domains (#6675)
Co-authored-by: Elio Bischof <eliobischof@gmail.com>
2023-10-11 09:55:01 +02:00

40 lines
661 B
Go

package domain
import (
"strings"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
type Org struct {
models.ObjectRoot
State OrgState
Name string
PrimaryDomain string
Domains []*OrgDomain
}
func (o *Org) IsValid() bool {
if o == nil {
return false
}
o.Name = strings.TrimSpace(o.Name)
return o.Name != ""
}
func (o *Org) AddIAMDomain(iamDomain string) {
orgDomain, _ := NewIAMDomainName(o.Name, iamDomain)
o.Domains = append(o.Domains, &OrgDomain{Domain: orgDomain, Verified: true, Primary: true})
}
type OrgState int32
const (
OrgStateUnspecified OrgState = iota
OrgStateActive
OrgStateInactive
OrgStateRemoved
)