zitadel/internal/org/model/org_view.go
Fabi 7a6ca24625
feat: multiple domains (#188)
* check uniqueness on create and register user

* change user email, reserve release unique email

* usergrant unique aggregate

* usergrant uniqueness

* validate UserGrant

* fix tests

* domain is set on username in all orgs

* domain in admin

* org domain sql

* zitadel domain org name

* org domains

* org iam policy

* default org iam policy

* SETUP

* load login names

* login by login name

* login name

* fix: merge master

* fix: merge master

* Update internal/user/repository/eventsourcing/user.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* fix: fix unique domains

* fix: rename env variable

Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2020-06-16 11:40:18 +02:00

72 lines
1.3 KiB
Go

package model
import (
"time"
"github.com/caos/zitadel/internal/eventstore/models"
"github.com/caos/zitadel/internal/model"
)
type OrgView struct {
ID string
CreationDate time.Time
ChangeDate time.Time
State OrgState
ResourceOwner string
Sequence uint64
Name string
}
type OrgSearchRequest struct {
Offset uint64
Limit uint64
SortingColumn OrgSearchKey
Asc bool
Queries []*OrgSearchQuery
}
type OrgSearchKey int32
const (
ORGSEARCHKEY_UNSPECIFIED OrgSearchKey = iota
ORGSEARCHKEY_ORG_ID
ORGSEARCHKEY_ORG_NAME
ORGSEARCHKEY_ORG_DOMAIN
ORGSEARCHKEY_STATE
ORGSEARCHKEY_RESOURCEOWNER
)
type OrgSearchQuery struct {
Key OrgSearchKey
Method model.SearchMethod
Value interface{}
}
type OrgSearchResult struct {
Offset uint64
Limit uint64
TotalResult uint64
Result []*OrgView
}
func (r *OrgSearchRequest) EnsureLimit(limit uint64) {
if r.Limit == 0 || r.Limit > limit {
r.Limit = limit
}
}
func OrgViewToOrg(o *OrgView) *Org {
return &Org{
ObjectRoot: models.ObjectRoot{
AggregateID: o.ID,
ChangeDate: o.ChangeDate,
CreationDate: o.CreationDate,
ResourceOwner: o.ResourceOwner,
Sequence: o.Sequence,
},
Name: o.Name,
State: o.State,
}
}