fix: bug fixes (#2595)

This commit is contained in:
Silvan
2021-10-29 11:00:42 +02:00
committed by GitHub
parent d689b2192a
commit 60aa4874ed
3 changed files with 8 additions and 12 deletions

View File

@@ -14,7 +14,7 @@ import (
) )
func (s *Server) GetLoginPolicy(ctx context.Context, req *mgmt_pb.GetLoginPolicyRequest) (*mgmt_pb.GetLoginPolicyResponse, error) { func (s *Server) GetLoginPolicy(ctx context.Context, req *mgmt_pb.GetLoginPolicyRequest) (*mgmt_pb.GetLoginPolicyResponse, error) {
policy, err := s.query.LoginPolicyByID(ctx, "") policy, err := s.query.LoginPolicyByID(ctx, authz.GetCtxData(ctx).OrgID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@@ -73,6 +73,7 @@ func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string, querie
NotificationDir: statikNotificationFS, NotificationDir: statikNotificationFS,
LoginTranslationFileContents: make(map[string][]byte), LoginTranslationFileContents: make(map[string][]byte),
NotificationTranslationFileContents: make(map[string][]byte), NotificationTranslationFileContents: make(map[string][]byte),
Query: queries,
}, },
ProjectRepo: eventstore.ProjectRepo{es, conf.SearchLimit, view, roles, systemDefaults.IamID, assetsAPI}, ProjectRepo: eventstore.ProjectRepo{es, conf.SearchLimit, view, roles, systemDefaults.IamID, assetsAPI},
UserRepo: eventstore.UserRepo{es, conf.SearchLimit, view, systemDefaults, assetsAPI}, UserRepo: eventstore.UserRepo{es, conf.SearchLimit, view, systemDefaults, assetsAPI},

View File

@@ -91,7 +91,7 @@ var (
name: projection.IDPStylingTypeCol, name: projection.IDPStylingTypeCol,
table: idpTable, table: idpTable,
} }
IDPOwnerCol = Column{ IDPOwnerTypeCol = Column{
name: projection.IDPOwnerTypeCol, name: projection.IDPOwnerTypeCol,
table: idpTable, table: idpTable,
} }
@@ -203,6 +203,8 @@ func (q *Queries) SearchIDPs(ctx context.Context, resourceOwner string, queries
sq.Or{ sq.Or{
sq.Eq{ sq.Eq{
IDPResourceOwnerCol.identifier(): resourceOwner, IDPResourceOwnerCol.identifier(): resourceOwner,
},
sq.Eq{
IDPResourceOwnerCol.identifier(): q.iamID, IDPResourceOwnerCol.identifier(): q.iamID,
}, },
}, },
@@ -235,14 +237,7 @@ func NewIDPIDSearchQuery(id string) (SearchQuery, error) {
} }
func NewIDPOwnerTypeSearchQuery(ownerType domain.IdentityProviderType) (SearchQuery, error) { func NewIDPOwnerTypeSearchQuery(ownerType domain.IdentityProviderType) (SearchQuery, error) {
switch ownerType { return NewNumberQuery(IDPOwnerTypeCol, ownerType, NumberEquals)
case domain.IdentityProviderTypeOrg:
return NewBoolQuery(LoginPolicyColumnIsDefault, false)
case domain.IdentityProviderTypeSystem:
return NewBoolQuery(LoginPolicyColumnIsDefault, true)
default:
return nil, errors.ThrowUnimplemented(nil, "QUERY-8yZAI", "Errors.Query.InvalidRequest")
}
} }
func NewIDPNameSearchQuery(method TextComparison, value string) (SearchQuery, error) { func NewIDPNameSearchQuery(method TextComparison, value string) (SearchQuery, error) {
@@ -267,7 +262,7 @@ func prepareIDPByIDQuery() (sq.SelectBuilder, func(*sql.Row) (*IDP, error)) {
IDPStateCol.identifier(), IDPStateCol.identifier(),
IDPNameCol.identifier(), IDPNameCol.identifier(),
IDPStylingTypeCol.identifier(), IDPStylingTypeCol.identifier(),
IDPOwnerCol.identifier(), IDPOwnerTypeCol.identifier(),
IDPAutoRegisterCol.identifier(), IDPAutoRegisterCol.identifier(),
OIDCIDPColIDPID.identifier(), OIDCIDPColIDPID.identifier(),
OIDCIDPColClientID.identifier(), OIDCIDPColClientID.identifier(),
@@ -375,7 +370,7 @@ func prepareIDPsQuery() (sq.SelectBuilder, func(*sql.Rows) (*IDPs, error)) {
IDPStateCol.identifier(), IDPStateCol.identifier(),
IDPNameCol.identifier(), IDPNameCol.identifier(),
IDPStylingTypeCol.identifier(), IDPStylingTypeCol.identifier(),
IDPOwnerCol.identifier(), IDPOwnerTypeCol.identifier(),
IDPAutoRegisterCol.identifier(), IDPAutoRegisterCol.identifier(),
OIDCIDPColIDPID.identifier(), OIDCIDPColIDPID.identifier(),
OIDCIDPColClientID.identifier(), OIDCIDPColClientID.identifier(),