mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-01 12:32:20 +00:00
fix: todos (#1346)
* fix: pub sub in new eventstore * fix: todos * fix: todos * fix: todos * fix: todos * fix: todos
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@ const (
|
||||
|
||||
type ExternalIDPSearchQuery struct {
|
||||
Key ExternalIDPSearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
@@ -57,5 +57,5 @@ func (r *ExternalIDPSearchRequest) EnsureLimit(limit uint64) {
|
||||
}
|
||||
|
||||
func (r *ExternalIDPSearchRequest) AppendUserQuery(userID string) {
|
||||
r.Queries = append(r.Queries, &ExternalIDPSearchQuery{Key: ExternalIDPSearchKeyUserID, Method: model.SearchMethodEquals, Value: userID})
|
||||
r.Queries = append(r.Queries, &ExternalIDPSearchQuery{Key: ExternalIDPSearchKeyUserID, Method: domain.SearchMethodEquals, Value: userID})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -45,7 +45,7 @@ const (
|
||||
|
||||
type NotifyUserSearchQuery struct {
|
||||
Key NotifyUserSearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value string
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
)
|
||||
|
||||
type TokenView struct {
|
||||
@@ -43,7 +42,7 @@ const (
|
||||
|
||||
type TokenSearchQuery struct {
|
||||
Key TokenSearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
)
|
||||
|
||||
type UserMembershipView struct {
|
||||
@@ -53,7 +52,7 @@ const (
|
||||
|
||||
type UserMembershipSearchQuery struct {
|
||||
Key UserMembershipSearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
@@ -82,9 +81,9 @@ func (r *UserMembershipSearchRequest) GetSearchQuery(key UserMembershipSearchKey
|
||||
}
|
||||
|
||||
func (r *UserMembershipSearchRequest) AppendResourceOwnerAndIamQuery(orgID, iamID string) {
|
||||
r.Queries = append(r.Queries, &UserMembershipSearchQuery{Key: UserMembershipSearchKeyResourceOwner, Method: model.SearchMethodIsOneOf, Value: []string{orgID, iamID}})
|
||||
r.Queries = append(r.Queries, &UserMembershipSearchQuery{Key: UserMembershipSearchKeyResourceOwner, Method: domain.SearchMethodIsOneOf, Value: []string{orgID, iamID}})
|
||||
}
|
||||
|
||||
func (r *UserMembershipSearchRequest) AppendUserIDQuery(userID string) {
|
||||
r.Queries = append(r.Queries, &UserMembershipSearchQuery{Key: UserMembershipSearchKeyUserID, Method: model.SearchMethodEquals, Value: userID})
|
||||
r.Queries = append(r.Queries, &UserMembershipSearchQuery{Key: UserMembershipSearchKeyUserID, Method: domain.SearchMethodEquals, Value: userID})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"time"
|
||||
|
||||
req_model "github.com/caos/zitadel/internal/auth_request/model"
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
)
|
||||
|
||||
type UserSessionView struct {
|
||||
@@ -48,7 +48,7 @@ const (
|
||||
|
||||
type UserSessionSearchQuery struct {
|
||||
Key UserSessionSearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
"github.com/caos/zitadel/internal/model"
|
||||
)
|
||||
|
||||
type UserView struct {
|
||||
@@ -95,7 +94,7 @@ const (
|
||||
|
||||
type UserSearchQuery struct {
|
||||
Key UserSearchKey
|
||||
Method model.SearchMethod
|
||||
Method domain.SearchMethod
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
@@ -136,7 +135,7 @@ func (r *UserSearchRequest) EnsureLimit(limit uint64) {
|
||||
}
|
||||
|
||||
func (r *UserSearchRequest) AppendMyOrgQuery(orgID string) {
|
||||
r.Queries = append(r.Queries, &UserSearchQuery{Key: UserSearchKeyResourceOwner, Method: model.SearchMethodEquals, Value: orgID})
|
||||
r.Queries = append(r.Queries, &UserSearchQuery{Key: UserSearchKeyResourceOwner, Method: domain.SearchMethodEquals, Value: orgID})
|
||||
}
|
||||
|
||||
func (u *UserView) MFATypesSetupPossible(level domain.MFALevel, policy *domain.LoginPolicy) []domain.MFAType {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
)
|
||||
@@ -15,12 +15,12 @@ func ExternalIDPByExternalUserIDAndIDPConfigID(db *gorm.DB, table, externalUserI
|
||||
user := new(model.ExternalIDPView)
|
||||
userIDQuery := &model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyExternalUserID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: externalUserID,
|
||||
}
|
||||
idpConfigIDQuery := &model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyIdpConfigID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: idpConfigID,
|
||||
}
|
||||
query := repository.PrepareGetByQuery(table, userIDQuery, idpConfigIDQuery)
|
||||
@@ -35,17 +35,17 @@ func ExternalIDPByExternalUserIDAndIDPConfigIDAndResourceOwner(db *gorm.DB, tabl
|
||||
user := new(model.ExternalIDPView)
|
||||
userIDQuery := &model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyExternalUserID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: externalUserID,
|
||||
}
|
||||
idpConfigIDQuery := &model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyIdpConfigID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: idpConfigID,
|
||||
}
|
||||
resourceOwnerQuery := &model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyResourceOwner,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: resourceOwner,
|
||||
}
|
||||
query := repository.PrepareGetByQuery(table, userIDQuery, idpConfigIDQuery, resourceOwnerQuery)
|
||||
@@ -60,7 +60,7 @@ func ExternalIDPsByIDPConfigID(db *gorm.DB, table, idpConfigID string) ([]*model
|
||||
externalIDPs := make([]*model.ExternalIDPView, 0)
|
||||
orgIDQuery := &usr_model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyIdpConfigID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: idpConfigID,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.ExternalIDPSearchRequest{
|
||||
@@ -74,12 +74,12 @@ func ExternalIDPsByIDPConfigIDAndResourceOwner(db *gorm.DB, table, idpConfigID,
|
||||
externalIDPs := make([]*model.ExternalIDPView, 0)
|
||||
idpConfigIDQuery := &usr_model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyIdpConfigID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: idpConfigID,
|
||||
}
|
||||
orgIDQuery := &usr_model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyResourceOwner,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: resourceOwner,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.ExternalIDPSearchRequest{
|
||||
@@ -93,12 +93,12 @@ func ExternalIDPsByIDPConfigIDAndResourceOwners(db *gorm.DB, table, idpConfigID
|
||||
externalIDPs := make([]*model.ExternalIDPView, 0)
|
||||
idpConfigIDQuery := &usr_model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyIdpConfigID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: idpConfigID,
|
||||
}
|
||||
orgIDQuery := &usr_model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyResourceOwner,
|
||||
Method: global_model.SearchMethodIsOneOf,
|
||||
Method: domain.SearchMethodIsOneOf,
|
||||
Value: resourceOwners,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.ExternalIDPSearchRequest{
|
||||
@@ -112,7 +112,7 @@ func ExternalIDPsByUserID(db *gorm.DB, table, userID string) ([]*model.ExternalI
|
||||
externalIDPs := make([]*model.ExternalIDPView, 0)
|
||||
orgIDQuery := &usr_model.ExternalIDPSearchQuery{
|
||||
Key: usr_model.ExternalIDPSearchKeyUserID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: userID,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.ExternalIDPSearchRequest{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
@@ -41,7 +41,7 @@ func (req ExternalIDPSearchQuery) GetKey() repository.ColumnKey {
|
||||
return ExternalIDPSearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req ExternalIDPSearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req ExternalIDPSearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
@@ -41,7 +41,7 @@ func (req NotifyUserSearchQuery) GetKey() repository.ColumnKey {
|
||||
return NotifyUserSearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req NotifyUserSearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req NotifyUserSearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
@@ -41,7 +41,7 @@ func (req TokenSearchQuery) GetKey() repository.ColumnKey {
|
||||
return TokenSearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req TokenSearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req TokenSearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
@@ -41,7 +41,7 @@ func (req UserMembershipSearchQuery) GetKey() repository.ColumnKey {
|
||||
return UserMembershipSearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req UserMembershipSearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req UserMembershipSearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
@@ -41,7 +41,7 @@ func (req UserSearchQuery) GetKey() repository.ColumnKey {
|
||||
return UserSearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req UserSearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req UserSearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
)
|
||||
@@ -41,7 +41,7 @@ func (req UserSessionSearchQuery) GetKey() repository.ColumnKey {
|
||||
return UserSessionSearchKey(req.Key)
|
||||
}
|
||||
|
||||
func (req UserSessionSearchQuery) GetMethod() global_model.SearchMethod {
|
||||
func (req UserSessionSearchQuery) GetMethod() domain.SearchMethod {
|
||||
return req.Method
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
@@ -23,7 +23,7 @@ func NotifyUsersByOrgID(db *gorm.DB, table, orgID string) ([]*model.NotifyUser,
|
||||
users := make([]*model.NotifyUser, 0)
|
||||
orgIDQuery := &usr_model.NotifyUserSearchQuery{
|
||||
Key: usr_model.NotifyUserSearchKeyResourceOwner,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: orgID,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.NotifyUserSearchRequest{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/user/model"
|
||||
usr_model "github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
@@ -24,7 +24,7 @@ func TokensByUserID(db *gorm.DB, table, userID string) ([]*usr_model.TokenView,
|
||||
tokens := make([]*usr_model.TokenView, 0)
|
||||
userIDQuery := &model.TokenSearchQuery{
|
||||
Key: model.TokenSearchKeyUserID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: userID,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, usr_model.TokenSearchRequest{
|
||||
|
||||
@@ -2,11 +2,11 @@ package view
|
||||
|
||||
import (
|
||||
auth_model "github.com/caos/zitadel/internal/auth_request/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
"github.com/jinzhu/gorm"
|
||||
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
)
|
||||
@@ -15,12 +15,12 @@ func UserSessionByIDs(db *gorm.DB, table, agentID, userID string) (*model.UserSe
|
||||
userSession := new(model.UserSessionView)
|
||||
userAgentQuery := model.UserSessionSearchQuery{
|
||||
Key: usr_model.UserSessionSearchKeyUserAgentID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: agentID,
|
||||
}
|
||||
userQuery := model.UserSessionSearchQuery{
|
||||
Key: usr_model.UserSessionSearchKeyUserID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: userID,
|
||||
}
|
||||
query := repository.PrepareGetByQuery(table, userAgentQuery, userQuery)
|
||||
@@ -35,7 +35,7 @@ func UserSessionsByUserID(db *gorm.DB, table, userID string) ([]*model.UserSessi
|
||||
userSessions := make([]*model.UserSessionView, 0)
|
||||
userAgentQuery := &usr_model.UserSessionSearchQuery{
|
||||
Key: usr_model.UserSessionSearchKeyUserID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: userID,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.UserSessionSearchRequest{
|
||||
@@ -49,7 +49,7 @@ func UserSessionsByAgentID(db *gorm.DB, table, agentID string) ([]*model.UserSes
|
||||
userSessions := make([]*model.UserSessionView, 0)
|
||||
userAgentQuery := &usr_model.UserSessionSearchQuery{
|
||||
Key: usr_model.UserSessionSearchKeyUserAgentID,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: agentID,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.UserSessionSearchRequest{
|
||||
@@ -63,7 +63,7 @@ func ActiveUserSessions(db *gorm.DB, table string) ([]*model.UserSessionView, er
|
||||
userSessions := make([]*model.UserSessionView, 0)
|
||||
activeQuery := &usr_model.UserSessionSearchQuery{
|
||||
Key: usr_model.UserSessionSearchKeyState,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: auth_model.UserSessionStateActive,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.UserSessionSearchRequest{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
)
|
||||
@@ -35,7 +35,7 @@ func UserByLoginName(db *gorm.DB, table, loginName string) (*model.UserView, err
|
||||
user := new(model.UserView)
|
||||
loginNameQuery := &model.UserSearchQuery{
|
||||
Key: usr_model.UserSearchKeyLoginNames,
|
||||
Method: global_model.SearchMethodListContains,
|
||||
Method: domain.SearchMethodListContains,
|
||||
Value: loginName,
|
||||
}
|
||||
query := repository.PrepareGetByQuery(table, loginNameQuery)
|
||||
@@ -50,12 +50,12 @@ func UserByLoginNameAndResourceOwner(db *gorm.DB, table, loginName, resourceOwne
|
||||
user := new(model.UserView)
|
||||
loginNameQuery := &model.UserSearchQuery{
|
||||
Key: usr_model.UserSearchKeyLoginNames,
|
||||
Method: global_model.SearchMethodListContains,
|
||||
Method: domain.SearchMethodListContains,
|
||||
Value: loginName,
|
||||
}
|
||||
resourceOwnerQuery := &model.UserSearchQuery{
|
||||
Key: usr_model.UserSearchKeyResourceOwner,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: resourceOwner,
|
||||
}
|
||||
query := repository.PrepareGetByQuery(table, loginNameQuery, resourceOwnerQuery)
|
||||
@@ -70,7 +70,7 @@ func UsersByOrgID(db *gorm.DB, table, orgID string) ([]*model.UserView, error) {
|
||||
users := make([]*model.UserView, 0)
|
||||
orgIDQuery := &usr_model.UserSearchQuery{
|
||||
Key: usr_model.UserSearchKeyResourceOwner,
|
||||
Method: global_model.SearchMethodEquals,
|
||||
Method: domain.SearchMethodEquals,
|
||||
Value: orgID,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.UserSearchRequest{
|
||||
@@ -80,15 +80,15 @@ func UsersByOrgID(db *gorm.DB, table, orgID string) ([]*model.UserView, error) {
|
||||
return users, err
|
||||
}
|
||||
|
||||
func UserIDsByDomain(db *gorm.DB, table, domain string) ([]string, error) {
|
||||
func UserIDsByDomain(db *gorm.DB, table, orgDomain string) ([]string, error) {
|
||||
type id struct {
|
||||
Id string
|
||||
}
|
||||
ids := make([]id, 0)
|
||||
orgIDQuery := &usr_model.UserSearchQuery{
|
||||
Key: usr_model.UserSearchKeyUserName,
|
||||
Method: global_model.SearchMethodEndsWithIgnoreCase,
|
||||
Value: "%" + domain,
|
||||
Method: domain.SearchMethodEndsWithIgnoreCase,
|
||||
Value: "%" + orgDomain,
|
||||
}
|
||||
query := repository.PrepareSearchQuery(table, model.UserSearchRequest{
|
||||
Queries: []*usr_model.UserSearchQuery{orgIDQuery},
|
||||
@@ -116,7 +116,7 @@ func SearchUsers(db *gorm.DB, table string, req *usr_model.UserSearchRequest) ([
|
||||
|
||||
func GetGlobalUserByLoginName(db *gorm.DB, table, loginName string) (*model.UserView, error) {
|
||||
user := new(model.UserView)
|
||||
query := repository.PrepareGetByQuery(table, &model.UserSearchQuery{Key: usr_model.UserSearchKeyLoginNames, Value: loginName, Method: global_model.SearchMethodListContains})
|
||||
query := repository.PrepareGetByQuery(table, &model.UserSearchQuery{Key: usr_model.UserSearchKeyLoginNames, Value: loginName, Method: domain.SearchMethodListContains})
|
||||
err := query(db, user)
|
||||
if caos_errs.IsNotFound(err) {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "VIEW-8uWer", "Errors.User.NotFound")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
"github.com/jinzhu/gorm"
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
|
||||
func UserMembershipByIDs(db *gorm.DB, table, userID, aggregateID, objectID string, membertype usr_model.MemberType) (*model.UserMembershipView, error) {
|
||||
memberships := new(model.UserMembershipView)
|
||||
userIDQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyUserID, Value: userID, Method: global_model.SearchMethodEquals}
|
||||
aggregateIDQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyAggregateID, Value: aggregateID, Method: global_model.SearchMethodEquals}
|
||||
objectIDQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyObjectID, Value: objectID, Method: global_model.SearchMethodEquals}
|
||||
memberTypeQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyMemberType, Value: int32(membertype), Method: global_model.SearchMethodEquals}
|
||||
userIDQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyUserID, Value: userID, Method: domain.SearchMethodEquals}
|
||||
aggregateIDQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyAggregateID, Value: aggregateID, Method: domain.SearchMethodEquals}
|
||||
objectIDQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyObjectID, Value: objectID, Method: domain.SearchMethodEquals}
|
||||
memberTypeQuery := &model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyMemberType, Value: int32(membertype), Method: domain.SearchMethodEquals}
|
||||
|
||||
query := repository.PrepareGetByQuery(table, userIDQuery, aggregateIDQuery, objectIDQuery, memberTypeQuery)
|
||||
err := query(db, memberships)
|
||||
@@ -27,7 +27,7 @@ func UserMembershipByIDs(db *gorm.DB, table, userID, aggregateID, objectID strin
|
||||
|
||||
func UserMembershipsByAggregateID(db *gorm.DB, table, aggregateID string) ([]*model.UserMembershipView, error) {
|
||||
memberships := make([]*model.UserMembershipView, 0)
|
||||
aggregateIDQuery := &usr_model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyAggregateID, Value: aggregateID, Method: global_model.SearchMethodEquals}
|
||||
aggregateIDQuery := &usr_model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyAggregateID, Value: aggregateID, Method: domain.SearchMethodEquals}
|
||||
query := repository.PrepareSearchQuery(table, model.UserMembershipSearchRequest{
|
||||
Queries: []*usr_model.UserMembershipSearchQuery{aggregateIDQuery},
|
||||
})
|
||||
@@ -37,7 +37,7 @@ func UserMembershipsByAggregateID(db *gorm.DB, table, aggregateID string) ([]*mo
|
||||
|
||||
func UserMembershipsByResourceOwner(db *gorm.DB, table, resourceOwner string) ([]*model.UserMembershipView, error) {
|
||||
memberships := make([]*model.UserMembershipView, 0)
|
||||
aggregateIDQuery := &usr_model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyResourceOwner, Value: resourceOwner, Method: global_model.SearchMethodEquals}
|
||||
aggregateIDQuery := &usr_model.UserMembershipSearchQuery{Key: usr_model.UserMembershipSearchKeyResourceOwner, Value: resourceOwner, Method: domain.SearchMethodEquals}
|
||||
query := repository.PrepareSearchQuery(table, model.UserMembershipSearchRequest{
|
||||
Queries: []*usr_model.UserMembershipSearchQuery{aggregateIDQuery},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user