mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
7a6ca24625
* 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>
78 lines
1.9 KiB
Go
78 lines
1.9 KiB
Go
package model
|
|
|
|
import (
|
|
global_model "github.com/caos/zitadel/internal/model"
|
|
usr_model "github.com/caos/zitadel/internal/user/model"
|
|
"github.com/caos/zitadel/internal/view"
|
|
)
|
|
|
|
type UserSearchRequest usr_model.UserSearchRequest
|
|
type UserSearchQuery usr_model.UserSearchQuery
|
|
type UserSearchKey usr_model.UserSearchKey
|
|
|
|
func (req UserSearchRequest) GetLimit() uint64 {
|
|
return req.Limit
|
|
}
|
|
|
|
func (req UserSearchRequest) GetOffset() uint64 {
|
|
return req.Offset
|
|
}
|
|
|
|
func (req UserSearchRequest) GetSortingColumn() view.ColumnKey {
|
|
if req.SortingColumn == usr_model.USERSEARCHKEY_UNSPECIFIED {
|
|
return nil
|
|
}
|
|
return UserSearchKey(req.SortingColumn)
|
|
}
|
|
|
|
func (req UserSearchRequest) GetAsc() bool {
|
|
return req.Asc
|
|
}
|
|
|
|
func (req UserSearchRequest) GetQueries() []view.SearchQuery {
|
|
result := make([]view.SearchQuery, len(req.Queries))
|
|
for i, q := range req.Queries {
|
|
result[i] = UserSearchQuery{Key: q.Key, Value: q.Value, Method: q.Method}
|
|
}
|
|
return result
|
|
}
|
|
|
|
func (req UserSearchQuery) GetKey() view.ColumnKey {
|
|
return UserSearchKey(req.Key)
|
|
}
|
|
|
|
func (req UserSearchQuery) GetMethod() global_model.SearchMethod {
|
|
return req.Method
|
|
}
|
|
|
|
func (req UserSearchQuery) GetValue() interface{} {
|
|
return req.Value
|
|
}
|
|
|
|
func (key UserSearchKey) ToColumnName() string {
|
|
switch usr_model.UserSearchKey(key) {
|
|
case usr_model.USERSEARCHKEY_USER_ID:
|
|
return UserKeyUserID
|
|
case usr_model.USERSEARCHKEY_USER_NAME:
|
|
return UserKeyUserName
|
|
case usr_model.USERSEARCHKEY_FIRST_NAME:
|
|
return UserKeyFirstName
|
|
case usr_model.USERSEARCHKEY_LAST_NAME:
|
|
return UserKeyLastName
|
|
case usr_model.USERSEARCHKEY_DISPLAY_NAME:
|
|
return UserKeyDisplayName
|
|
case usr_model.USERSEARCHKEY_NICK_NAME:
|
|
return UserKeyNickName
|
|
case usr_model.USERSEARCHKEY_EMAIL:
|
|
return UserKeyEmail
|
|
case usr_model.USERSEARCHKEY_STATE:
|
|
return UserKeyState
|
|
case usr_model.USERSEARCHKEY_RESOURCEOWNER:
|
|
return UserKeyResourceOwner
|
|
case usr_model.USERSEARCHKEY_LOGIN_NAMES:
|
|
return UserKeyLoginNames
|
|
default:
|
|
return ""
|
|
}
|
|
}
|