mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
fix(query): realtime data on defined requests (#3726)
* feat: directly specify factors on addCustomLoginPolicy and return on LoginPolicy responses * fix proto * update login policy * feat: directly specify idp on addCustomLoginPolicy and return on LoginPolicy responses * fix: tests * fix(projection): trigger bulk * refactor: clean projection pkg * instance should bulk * fix(query): should trigger bulk on id calls * tests * build prerelease * fix: add shouldTriggerBulk * fix: test Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
@@ -59,7 +59,7 @@ type labelPolicyProvider interface {
|
||||
}
|
||||
|
||||
type privacyPolicyProvider interface {
|
||||
PrivacyPolicyByOrg(context.Context, string) (*query.PrivacyPolicy, error)
|
||||
PrivacyPolicyByOrg(context.Context, bool, string) (*query.PrivacyPolicy, error)
|
||||
}
|
||||
|
||||
type userSessionViewProvider interface {
|
||||
@@ -71,11 +71,11 @@ type userViewProvider interface {
|
||||
}
|
||||
|
||||
type loginPolicyViewProvider interface {
|
||||
LoginPolicyByID(context.Context, string) (*query.LoginPolicy, error)
|
||||
LoginPolicyByID(context.Context, bool, string) (*query.LoginPolicy, error)
|
||||
}
|
||||
|
||||
type lockoutPolicyViewProvider interface {
|
||||
LockoutPolicyByOrg(context.Context, string) (*query.LockoutPolicy, error)
|
||||
LockoutPolicyByOrg(context.Context, bool, string) (*query.LockoutPolicy, error)
|
||||
}
|
||||
|
||||
type idpProviderViewProvider interface {
|
||||
@@ -91,7 +91,7 @@ type userCommandProvider interface {
|
||||
}
|
||||
|
||||
type orgViewProvider interface {
|
||||
OrgByID(context.Context, string) (*query.Org, error)
|
||||
OrgByID(context.Context, bool, string) (*query.Org, error)
|
||||
OrgByDomainGlobal(context.Context, string) (*query.Org, error)
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ func (repo *AuthRequestRepo) getAuthRequest(ctx context.Context, id, userAgentID
|
||||
}
|
||||
|
||||
func (repo *AuthRequestRepo) getLoginPolicyAndIDPProviders(ctx context.Context, orgID string) (*query.LoginPolicy, []*domain.IDPProvider, error) {
|
||||
policy, err := repo.LoginPolicyViewProvider.LoginPolicyByID(ctx, orgID)
|
||||
policy, err := repo.LoginPolicyViewProvider.LoginPolicyByID(ctx, false, orgID)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -964,7 +964,7 @@ func (repo *AuthRequestRepo) mfaSkippedOrSetUp(user *user_model.UserView, reques
|
||||
}
|
||||
|
||||
func (repo *AuthRequestRepo) GetPrivacyPolicy(ctx context.Context, orgID string) (*domain.PrivacyPolicy, error) {
|
||||
policy, err := repo.PrivacyPolicyProvider.PrivacyPolicyByOrg(ctx, orgID)
|
||||
policy, err := repo.PrivacyPolicyProvider.PrivacyPolicyByOrg(ctx, false, orgID)
|
||||
if errors.IsNotFound(err) {
|
||||
return new(domain.PrivacyPolicy), nil
|
||||
}
|
||||
@@ -992,7 +992,7 @@ func privacyPolicyToDomain(p *query.PrivacyPolicy) *domain.PrivacyPolicy {
|
||||
}
|
||||
|
||||
func (repo *AuthRequestRepo) getLockoutPolicy(ctx context.Context, orgID string) (*query.LockoutPolicy, error) {
|
||||
policy, err := repo.LockoutPolicyViewProvider.LockoutPolicyByOrg(ctx, orgID)
|
||||
policy, err := repo.LockoutPolicyViewProvider.LockoutPolicyByOrg(ctx, false, orgID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1178,7 +1178,7 @@ func activeUserByID(ctx context.Context, userViewProvider userViewProvider, user
|
||||
if !(user.State == user_model.UserStateActive || user.State == user_model.UserStateInitial) {
|
||||
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-FJ262", "Errors.User.NotActive")
|
||||
}
|
||||
org, err := queries.OrgByID(ctx, user.ResourceOwner)
|
||||
org, err := queries.OrgByID(ctx, false, user.ResourceOwner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@@ -128,7 +128,7 @@ type mockLoginPolicy struct {
|
||||
policy *query.LoginPolicy
|
||||
}
|
||||
|
||||
func (m *mockLoginPolicy) LoginPolicyByID(ctx context.Context, id string) (*query.LoginPolicy, error) {
|
||||
func (m *mockLoginPolicy) LoginPolicyByID(ctx context.Context, _ bool, id string) (*query.LoginPolicy, error) {
|
||||
return m.policy, nil
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ type mockLockoutPolicy struct {
|
||||
policy *query.LockoutPolicy
|
||||
}
|
||||
|
||||
func (m *mockLockoutPolicy) LockoutPolicyByOrg(context.Context, string) (*query.LockoutPolicy, error) {
|
||||
func (m *mockLockoutPolicy) LockoutPolicyByOrg(context.Context, bool, string) (*query.LockoutPolicy, error) {
|
||||
return m.policy, nil
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ type mockViewOrg struct {
|
||||
State domain.OrgState
|
||||
}
|
||||
|
||||
func (m *mockViewOrg) OrgByID(context.Context, string) (*query.Org, error) {
|
||||
func (m *mockViewOrg) OrgByID(context.Context, bool, string) (*query.Org, error) {
|
||||
return &query.Org{
|
||||
State: m.State,
|
||||
}, nil
|
||||
@@ -178,7 +178,7 @@ func (m *mockViewOrg) OrgByDomainGlobal(context.Context, string) (*query.Org, er
|
||||
|
||||
type mockViewErrOrg struct{}
|
||||
|
||||
func (m *mockViewErrOrg) OrgByID(context.Context, string) (*query.Org, error) {
|
||||
func (m *mockViewErrOrg) OrgByID(context.Context, bool, string) (*query.Org, error) {
|
||||
return nil, errors.ThrowInternal(nil, "id", "internal error")
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ func (repo *OrgRepository) GetIDPConfigByID(ctx context.Context, idpConfigID str
|
||||
}
|
||||
|
||||
func (repo *OrgRepository) GetMyPasswordComplexityPolicy(ctx context.Context) (*iam_model.PasswordComplexityPolicyView, error) {
|
||||
policy, err := repo.Query.PasswordComplexityPolicyByOrg(ctx, authz.GetCtxData(ctx).OrgID)
|
||||
policy, err := repo.Query.PasswordComplexityPolicyByOrg(ctx, true, authz.GetCtxData(ctx).OrgID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@@ -208,9 +208,9 @@ func (i *IDPProvider) OnSuccess() error {
|
||||
}
|
||||
|
||||
func (i *IDPProvider) getOrgIDPConfig(instanceID, aggregateID, idpConfigID string) (*query2.IDP, error) {
|
||||
return i.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), idpConfigID, aggregateID)
|
||||
return i.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), false, idpConfigID, aggregateID)
|
||||
}
|
||||
|
||||
func (u *IDPProvider) getDefaultIDPConfig(instanceID, idpConfigID string) (*query2.IDP, error) {
|
||||
return u.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), idpConfigID, instanceID)
|
||||
return u.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), false, idpConfigID, instanceID)
|
||||
}
|
||||
|
@@ -197,9 +197,9 @@ func (i *ExternalIDP) OnSuccess() error {
|
||||
}
|
||||
|
||||
func (i *ExternalIDP) getOrgIDPConfig(instanceID, aggregateID, idpConfigID string) (*query2.IDP, error) {
|
||||
return i.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), idpConfigID, aggregateID)
|
||||
return i.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), false, idpConfigID, aggregateID)
|
||||
}
|
||||
|
||||
func (i *ExternalIDP) getDefaultIDPConfig(instanceID, idpConfigID string) (*query2.IDP, error) {
|
||||
return i.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), idpConfigID, instanceID)
|
||||
return i.queries.IDPByIDAndResourceOwner(withInstanceID(context.Background(), instanceID), false, idpConfigID, instanceID)
|
||||
}
|
||||
|
Reference in New Issue
Block a user