mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
d8e42744b4
* fix: move eventstore pkgs * fix: move eventstore pkgs * fix: remove v2 view * fix: remove v2 view
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package domain
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
|
)
|
|
|
|
type Org struct {
|
|
models.ObjectRoot
|
|
|
|
State OrgState
|
|
Name string
|
|
|
|
PrimaryDomain string
|
|
Domains []*OrgDomain
|
|
Members []*Member
|
|
OrgIamPolicy *OrgIAMPolicy
|
|
LoginPolicy *LoginPolicy
|
|
LabelPolicy *LabelPolicy
|
|
PasswordComplexityPolicy *PasswordComplexityPolicy
|
|
PasswordAgePolicy *PasswordAgePolicy
|
|
PasswordLockoutPolicy *PasswordLockoutPolicy
|
|
IDPs []*IDPConfig
|
|
}
|
|
|
|
func (o *Org) IsValid() bool {
|
|
return o.Name != ""
|
|
}
|
|
|
|
func (o *Org) AddIAMDomain(iamDomain string) {
|
|
o.Domains = append(o.Domains, &OrgDomain{Domain: o.nameForDomain(iamDomain), Verified: true, Primary: true})
|
|
}
|
|
|
|
func (o *Org) nameForDomain(iamDomain string) string {
|
|
return strings.ToLower(strings.ReplaceAll(o.Name, " ", "-") + "." + iamDomain)
|
|
}
|
|
|
|
type OrgState int32
|
|
|
|
const (
|
|
OrgStateUnspecified OrgState = iota
|
|
OrgStateActive
|
|
OrgStateInactive
|
|
OrgStateRemoved
|
|
)
|