mirror of
https://github.com/zitadel/zitadel
synced 2024-11-22 18:44:40 +00:00
fix: sort admin orgs by name (#1536)
* fix: sort admin orgs by name * handle nil pointer in webauthn methods * rename
This commit is contained in:
parent
e4fe097ec4
commit
f9286574a9
@ -2,7 +2,9 @@ package eventstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/logging"
|
||||
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
@ -195,7 +197,8 @@ func (repo *UserGrantRepo) SearchMyProjectPermissions(ctx context.Context) ([]st
|
||||
|
||||
func (repo *UserGrantRepo) SearchAdminOrgs(request *grant_model.UserGrantSearchRequest) (*grant_model.ProjectOrgSearchResponse, error) {
|
||||
searchRequest := &org_model.OrgSearchRequest{
|
||||
SortingColumn: org_model.OrgSearchKeyOrgName,
|
||||
SortingColumn: org_model.OrgSearchKeyOrgNameIgnoreCase,
|
||||
Asc: true,
|
||||
}
|
||||
if len(request.Queries) > 0 {
|
||||
for _, q := range request.Queries {
|
||||
|
@ -322,6 +322,10 @@ func (c *Commands) HumanFinishU2FLogin(ctx context.Context, userID, resourceOwne
|
||||
|
||||
userAgg, token, signCount, err := c.finishWebAuthNLogin(ctx, userID, resourceOwner, credentialData, webAuthNLogin, u2fTokens, isLoginUI)
|
||||
if err != nil {
|
||||
if userAgg == nil {
|
||||
logging.LogWithFields("EVENT-Addqd", "userID", userID, "resourceOwner", resourceOwner).WithError(err).Warn("missing userAggregate for pushing failed u2f check event")
|
||||
return err
|
||||
}
|
||||
_, pushErr := c.eventstore.PushEvents(ctx,
|
||||
usr_repo.NewHumanU2FCheckFailedEvent(
|
||||
ctx,
|
||||
@ -329,7 +333,7 @@ func (c *Commands) HumanFinishU2FLogin(ctx context.Context, userID, resourceOwne
|
||||
authRequestDomainToAuthRequestInfo(authRequest),
|
||||
),
|
||||
)
|
||||
logging.Log("EVENT-33M9f").OnError(pushErr).WithField("userID", userID).Warn("could not push failed passwordless check event")
|
||||
logging.LogWithFields("EVENT-Bdgd2", "userID", userID, "resourceOwner", resourceOwner).OnError(pushErr).Warn("could not push failed u2f check event")
|
||||
return err
|
||||
}
|
||||
|
||||
@ -363,6 +367,10 @@ func (c *Commands) HumanFinishPasswordlessLogin(ctx context.Context, userID, res
|
||||
|
||||
userAgg, token, signCount, err := c.finishWebAuthNLogin(ctx, userID, resourceOwner, credentialData, webAuthNLogin, passwordlessTokens, isLoginUI)
|
||||
if err != nil {
|
||||
if userAgg == nil {
|
||||
logging.LogWithFields("EVENT-Dbbbw", "userID", userID, "resourceOwner", resourceOwner).WithError(err).Warn("missing userAggregate for pushing failed passwordless check event")
|
||||
return err
|
||||
}
|
||||
_, pushErr := c.eventstore.PushEvents(ctx,
|
||||
usr_repo.NewHumanPasswordlessCheckFailedEvent(
|
||||
ctx,
|
||||
@ -370,7 +378,7 @@ func (c *Commands) HumanFinishPasswordlessLogin(ctx context.Context, userID, res
|
||||
authRequestDomainToAuthRequestInfo(authRequest),
|
||||
),
|
||||
)
|
||||
logging.Log("EVENT-33M9f").OnError(pushErr).WithField("userID", userID).Warn("could not push failed passwordless check event")
|
||||
logging.LogWithFields("EVENT-33M9f", "userID", userID, "resourceOwner", resourceOwner).OnError(pushErr).Warn("could not push failed passwordless check event")
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errors "github.com/caos/zitadel/internal/errors"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errors "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
@ -37,6 +36,7 @@ const (
|
||||
OrgSearchKeyOrgDomain
|
||||
OrgSearchKeyState
|
||||
OrgSearchKeyResourceOwner
|
||||
OrgSearchKeyOrgNameIgnoreCase //used for lowercase search
|
||||
)
|
||||
|
||||
type OrgSearchQuery struct {
|
||||
|
@ -57,6 +57,8 @@ func (key OrgSearchKey) ToColumnName() string {
|
||||
return OrgKeyOrgID
|
||||
case usr_model.OrgSearchKeyOrgName:
|
||||
return OrgKeyOrgName
|
||||
case usr_model.OrgSearchKeyOrgNameIgnoreCase:
|
||||
return "LOWER(" + OrgKeyOrgName + ")" //used for lowercase search
|
||||
case usr_model.OrgSearchKeyResourceOwner:
|
||||
return OrgKeyResourceOwner
|
||||
case usr_model.OrgSearchKeyState:
|
||||
|
@ -31,7 +31,7 @@ func OrgByPrimaryDomain(db *gorm.DB, table, primaryDomain string) (*model.OrgVie
|
||||
|
||||
func SearchOrgs(db *gorm.DB, table string, req *org_model.OrgSearchRequest) ([]*model.OrgView, uint64, error) {
|
||||
orgs := make([]*model.OrgView, 0)
|
||||
query := repository.PrepareSearchQuery(table, model.OrgSearchRequest{Limit: req.Limit, Offset: req.Offset, Queries: req.Queries, SortingColumn: req.SortingColumn})
|
||||
query := repository.PrepareSearchQuery(table, model.OrgSearchRequest{Limit: req.Limit, Offset: req.Offset, Queries: req.Queries, SortingColumn: req.SortingColumn, Asc: req.Asc})
|
||||
count, err := query(db, &orgs)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
|
Loading…
Reference in New Issue
Block a user