2020-05-26 14:46:16 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2021-03-22 13:40:25 +00:00
|
|
|
|
|
|
|
"github.com/caos/zitadel/internal/domain"
|
2021-04-06 14:03:07 +00:00
|
|
|
caos_errors "github.com/caos/zitadel/internal/errors"
|
2020-05-26 14:46:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type OrgMemberView struct {
|
2021-03-22 13:40:25 +00:00
|
|
|
UserID string
|
|
|
|
OrgID string
|
|
|
|
UserName string
|
|
|
|
Email string
|
|
|
|
FirstName string
|
|
|
|
LastName string
|
|
|
|
DisplayName string
|
|
|
|
PreferredLoginName string
|
2021-06-11 11:20:39 +00:00
|
|
|
AvatarURL string
|
|
|
|
UserResourceOwner string
|
2021-03-22 13:40:25 +00:00
|
|
|
Roles []string
|
|
|
|
CreationDate time.Time
|
|
|
|
ChangeDate time.Time
|
|
|
|
Sequence uint64
|
2020-05-26 14:46:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type OrgMemberSearchRequest struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
SortingColumn OrgMemberSearchKey
|
|
|
|
Asc bool
|
|
|
|
Queries []*OrgMemberSearchQuery
|
|
|
|
}
|
|
|
|
|
|
|
|
type OrgMemberSearchKey int32
|
|
|
|
|
|
|
|
const (
|
2020-06-23 12:47:47 +00:00
|
|
|
OrgMemberSearchKeyUnspecified OrgMemberSearchKey = iota
|
|
|
|
OrgMemberSearchKeyUserName
|
|
|
|
OrgMemberSearchKeyEmail
|
|
|
|
OrgMemberSearchKeyFirstName
|
|
|
|
OrgMemberSearchKeyLastName
|
|
|
|
OrgMemberSearchKeyOrgID
|
|
|
|
OrgMemberSearchKeyUserID
|
2020-05-26 14:46:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type OrgMemberSearchQuery struct {
|
|
|
|
Key OrgMemberSearchKey
|
2021-03-01 07:48:50 +00:00
|
|
|
Method domain.SearchMethod
|
2020-06-16 09:40:18 +00:00
|
|
|
Value interface{}
|
2020-05-26 14:46:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type OrgMemberSearchResponse struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
TotalResult uint64
|
|
|
|
Result []*OrgMemberView
|
2020-07-15 11:24:36 +00:00
|
|
|
Sequence uint64
|
|
|
|
Timestamp time.Time
|
2020-05-26 14:46:16 +00:00
|
|
|
}
|
|
|
|
|
2021-04-06 14:03:07 +00:00
|
|
|
func (r *OrgMemberSearchRequest) EnsureLimit(limit uint64) error {
|
|
|
|
if r.Limit > limit {
|
|
|
|
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-77fu3", "Errors.Limit.ExceedsDefault")
|
|
|
|
}
|
|
|
|
if r.Limit == 0 {
|
2020-05-26 14:46:16 +00:00
|
|
|
r.Limit = limit
|
|
|
|
}
|
2021-04-06 14:03:07 +00:00
|
|
|
return nil
|
2020-05-26 14:46:16 +00:00
|
|
|
}
|