2020-06-25 08:12:29 +02:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
2021-03-01 08:48:50 +01:00
|
|
|
"github.com/caos/zitadel/internal/domain"
|
2021-04-06 16:03:07 +02:00
|
|
|
caos_errors "github.com/caos/zitadel/internal/errors"
|
|
|
|
|
2020-06-25 08:12:29 +02:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-08-26 09:56:23 +02:00
|
|
|
type IAMMemberView struct {
|
2021-03-22 14:40:25 +01:00
|
|
|
UserID string
|
|
|
|
IAMID string
|
|
|
|
UserName string
|
|
|
|
Email string
|
|
|
|
FirstName string
|
|
|
|
LastName string
|
|
|
|
DisplayName string
|
|
|
|
PreferredLoginName string
|
2021-06-11 13:20:39 +02:00
|
|
|
AvatarURL string
|
|
|
|
UserResourceOwner string
|
2021-03-22 14:40:25 +01:00
|
|
|
Roles []string
|
|
|
|
CreationDate time.Time
|
|
|
|
ChangeDate time.Time
|
|
|
|
Sequence uint64
|
2020-06-25 08:12:29 +02:00
|
|
|
}
|
|
|
|
|
2020-08-26 09:56:23 +02:00
|
|
|
type IAMMemberSearchRequest struct {
|
2020-06-25 08:12:29 +02:00
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
2020-08-26 09:56:23 +02:00
|
|
|
SortingColumn IAMMemberSearchKey
|
2020-06-25 08:12:29 +02:00
|
|
|
Asc bool
|
2020-08-26 09:56:23 +02:00
|
|
|
Queries []*IAMMemberSearchQuery
|
2020-06-25 08:12:29 +02:00
|
|
|
}
|
|
|
|
|
2020-08-26 09:56:23 +02:00
|
|
|
type IAMMemberSearchKey int32
|
2020-06-25 08:12:29 +02:00
|
|
|
|
|
|
|
const (
|
2020-08-26 09:56:23 +02:00
|
|
|
IAMMemberSearchKeyUnspecified IAMMemberSearchKey = iota
|
|
|
|
IAMMemberSearchKeyUserName
|
|
|
|
IAMMemberSearchKeyEmail
|
|
|
|
IAMMemberSearchKeyFirstName
|
|
|
|
IAMMemberSearchKeyLastName
|
|
|
|
IAMMemberSearchKeyIamID
|
|
|
|
IAMMemberSearchKeyUserID
|
2020-06-25 08:12:29 +02:00
|
|
|
)
|
|
|
|
|
2020-08-26 09:56:23 +02:00
|
|
|
type IAMMemberSearchQuery struct {
|
|
|
|
Key IAMMemberSearchKey
|
2021-03-01 08:48:50 +01:00
|
|
|
Method domain.SearchMethod
|
2020-06-25 08:12:29 +02:00
|
|
|
Value interface{}
|
|
|
|
}
|
|
|
|
|
2020-08-26 09:56:23 +02:00
|
|
|
type IAMMemberSearchResponse struct {
|
2020-06-25 08:12:29 +02:00
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
TotalResult uint64
|
2020-08-26 09:56:23 +02:00
|
|
|
Result []*IAMMemberView
|
2020-07-15 13:24:36 +02:00
|
|
|
Sequence uint64
|
|
|
|
Timestamp time.Time
|
2020-06-25 08:12:29 +02:00
|
|
|
}
|
|
|
|
|
2021-04-06 16:03:07 +02:00
|
|
|
func (r *IAMMemberSearchRequest) EnsureLimit(limit uint64) error {
|
|
|
|
if r.Limit > limit {
|
|
|
|
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-vn8ds", "Errors.Limit.ExceedsDefault")
|
|
|
|
}
|
|
|
|
if r.Limit == 0 {
|
2020-06-25 08:12:29 +02:00
|
|
|
r.Limit = limit
|
|
|
|
}
|
2021-04-06 16:03:07 +02:00
|
|
|
return nil
|
2020-06-25 08:12:29 +02:00
|
|
|
}
|