Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query): pw complexity policy #2417

Merged
merged 194 commits into from Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
ed99c83
job queue
adlerhurst Apr 14, 2021
3887dcc
wg improvements
adlerhurst Apr 15, 2021
6b79086
start handler
adlerhurst Apr 15, 2021
4cafc64
statement
adlerhurst Apr 16, 2021
badc26b
statements
adlerhurst Apr 16, 2021
37be328
imporve handler
adlerhurst Apr 16, 2021
e87fb10
improve statement
adlerhurst Apr 20, 2021
d1ea989
statement in seperate file
adlerhurst Apr 20, 2021
789d957
move handlers
adlerhurst Apr 30, 2021
86ad07f
Merge branch 'main' into query-side
adlerhurst Apr 30, 2021
1c58fb5
move query/old to query
adlerhurst Apr 30, 2021
eaa4ebc
handler
adlerhurst May 3, 2021
fb754fc
read models
adlerhurst May 11, 2021
93b9486
Merge branch 'main' into query-side
adlerhurst May 11, 2021
245ead2
bulk works
adlerhurst May 12, 2021
2a4d81c
cleanup
adlerhurst May 12, 2021
da3a7a6
contrib
adlerhurst May 12, 2021
6ec00f4
rename readmodel to projection
adlerhurst May 12, 2021
3c0a8c1
rename read_models schema to projections
adlerhurst May 12, 2021
a6934ad
rename read_models schema to projections
adlerhurst May 12, 2021
f3b34ed
search query as func,
adlerhurst May 14, 2021
c616e3b
add event sequence less query
adlerhurst May 14, 2021
53ae7db
update checks for events between current sequence and sequence of fir…
adlerhurst May 14, 2021
c8467e5
cleanup crdb projection
adlerhurst May 14, 2021
eee7ca3
refactor projection handler
adlerhurst May 14, 2021
c434cde
start with testing
adlerhurst May 14, 2021
e9f35bc
tests for handler
adlerhurst May 16, 2021
962bb3c
remove todo
adlerhurst May 16, 2021
4708aa4
refactor statement: remove table name,
adlerhurst May 16, 2021
88ae824
improve projection handler shutdown,
adlerhurst May 17, 2021
5b64e6f
tests
adlerhurst May 17, 2021
7db1e26
start failed events
adlerhurst May 19, 2021
d4a9f7e
seperate branch for contrib
adlerhurst May 19, 2021
9e96f55
move statement constructors to crdb pkg
adlerhurst May 19, 2021
63a5353
correct import
adlerhurst May 27, 2021
65991ec
Subscribe for eventtypes (#1800)
adlerhurst Jun 1, 2021
3fa551c
Merge branch 'query-side' of https://github.com/caos/zitadel into que…
adlerhurst Jun 1, 2021
847ad73
remove comment
adlerhurst Jun 1, 2021
c7c7446
Merge branch 'main' into query-side
adlerhurst Jun 1, 2021
fd2eabc
Merge branch 'main' into query-side
adlerhurst Jun 1, 2021
015970f
aggregate reducer
adlerhurst Jun 1, 2021
6fa79ed
remove eventtypes
adlerhurst Jun 1, 2021
bf705a5
add protoc-get-validate to mod
adlerhurst Jun 1, 2021
0ea4219
fix transaltion
adlerhurst Jun 1, 2021
2290a1a
upsert
adlerhurst Jun 1, 2021
28549ee
add gender on org admins,
adlerhurst Jun 1, 2021
e00c3c8
remove if
adlerhurst Jun 1, 2021
df8bb93
sub queries
adlerhurst Jun 1, 2021
1883fb0
fix: tests
adlerhurst Jun 2, 2021
52ab32b
add builder to tests
adlerhurst Jun 2, 2021
6800877
new search query
adlerhurst Jun 2, 2021
f2caace
rename searchquerybuilder to builder
adlerhurst Jun 2, 2021
2255e55
remove comment from code
adlerhurst Jun 2, 2021
c975ee8
test with multiple queries
adlerhurst Jun 2, 2021
4ca37ae
add filters test
adlerhurst Jun 2, 2021
5fb498d
Merge branch 'main' into eventstore-multi-query
adlerhurst Jun 3, 2021
308c0bc
Merge branch 'main' into query-side
adlerhurst Jun 3, 2021
aada4ca
Merge branch 'eventstore-multi-query' into query-side
adlerhurst Jun 3, 2021
b71879e
current sequences
adlerhurst Jun 3, 2021
45d28c5
make org and org_admins work again
adlerhurst Jun 3, 2021
103e6a5
Merge branch 'main' into eventstore-multi-query
adlerhurst Jun 3, 2021
2ca8c5b
add aggregate type to current sequence
adlerhurst Jun 4, 2021
30a2614
Merge branch 'main' into eventstore-multi-query
adlerhurst Jun 25, 2021
3f084e1
fix(contibute): listing
adlerhurst Jun 25, 2021
316f1ce
add validate module
adlerhurst Jun 25, 2021
9e1e1af
fix: search queries
adlerhurst Jun 25, 2021
212ecd6
Merge branch 'eventstore-multi-query' into query-side
adlerhurst Jun 25, 2021
ab26c80
feat(eventstore): previous aggregate root sequence (#1810)
adlerhurst Jun 29, 2021
b59b09d
small refactorings
adlerhurst Jun 29, 2021
5cf201e
Merge branch 'query-side' of https://github.com/caos/zitadel into que…
adlerhurst Jun 29, 2021
7a580ea
allow update multiple current sequences
adlerhurst Jun 29, 2021
8dafd60
unique log id
adlerhurst Jun 29, 2021
2255403
fix migrations
adlerhurst Jun 29, 2021
6d8bd14
rename org admin to org owner
adlerhurst Jun 29, 2021
1954d72
improve error handling and logging
adlerhurst Jul 1, 2021
17e2191
fix(migration): optimize prev agg root seq
adlerhurst Jul 5, 2021
48997bc
fix: projection handler test
adlerhurst Jul 5, 2021
e1ebcb2
Merge branch 'main' into query-side
adlerhurst Jul 5, 2021
1313a2f
fix: sub queries
adlerhurst Jul 5, 2021
577cd37
Merge branch 'main' into query-side
adlerhurst Jul 6, 2021
4c491b3
small fixes
adlerhurst Jul 7, 2021
c8feaa0
additional event types
adlerhurst Jul 9, 2021
b20c46b
correct org owner projection
adlerhurst Jul 9, 2021
fcb819b
fix primary key
adlerhurst Jul 9, 2021
1861804
feat(eventstore): jobs for projections (#2026)
adlerhurst Jul 16, 2021
e9bd6fc
env file
adlerhurst Jul 16, 2021
fc326b5
Merge branch 'main' into query-side
adlerhurst Jul 16, 2021
a62a14c
typo
adlerhurst Jul 16, 2021
bbde03f
correct users
adlerhurst Jul 16, 2021
053779f
correct migration
adlerhurst Jul 16, 2021
7b6cc68
fix: merge fail
adlerhurst Jul 16, 2021
b23d243
fix test
adlerhurst Jul 16, 2021
d4a663f
Merge branch 'main' into query-side
adlerhurst Aug 3, 2021
151c44a
fix(tests): unordered matcher
adlerhurst Aug 3, 2021
71b93b3
improve currentSequenceMatcher
adlerhurst Aug 3, 2021
2a45028
correct certs
adlerhurst Aug 4, 2021
47003c2
correct certs
adlerhurst Aug 4, 2021
00bb27b
add zitadel database on database list
adlerhurst Aug 5, 2021
45002d3
refctor switch in match
adlerhurst Aug 5, 2021
5e88f45
enable all handlers
adlerhurst Aug 5, 2021
63be33b
Delete io.env
adlerhurst Aug 5, 2021
3bb65dc
cleanup
adlerhurst Aug 5, 2021
20c71b2
Merge branch 'query-side' of https://github.com/caos/zitadel into que…
adlerhurst Aug 5, 2021
60267b7
add handlers
adlerhurst Aug 5, 2021
eac653a
rename view to projection
adlerhurst Aug 6, 2021
f2513b7
rename view to projection
adlerhurst Aug 6, 2021
b723bee
fix type typo
adlerhurst Aug 9, 2021
83960f2
remove unnecessary logs
adlerhurst Aug 11, 2021
ad5594d
refactor stmts
adlerhurst Aug 12, 2021
4335c8b
simplify interval calculation
adlerhurst Aug 12, 2021
15815f4
fix tests
adlerhurst Aug 12, 2021
cccf13a
fix unlock test
adlerhurst Aug 12, 2021
86e27ff
fix migration
adlerhurst Aug 12, 2021
6a8da2e
migs
adlerhurst Aug 13, 2021
4658085
Merge branch 'main' into query-side
adlerhurst Aug 13, 2021
322a1cf
fix(operator): update cockroach and flyway versions (#2138)
adlerhurst Aug 13, 2021
6fd21e7
fix import
adlerhurst Aug 13, 2021
bc789bc
fix typo
adlerhurst Aug 13, 2021
7472797
fix(migration): add org projection
adlerhurst Aug 13, 2021
45c683b
fix(projection): correct table for org events in org owners
adlerhurst Aug 13, 2021
8c01f10
better insert stmt
adlerhurst Aug 16, 2021
f63ac3d
fix typo
adlerhurst Aug 16, 2021
54a3546
fix typo
adlerhurst Aug 16, 2021
5dfed79
set max connection lifetime
adlerhurst Aug 17, 2021
05e601f
set max conns and conn lifetime in eventstore v1
adlerhurst Aug 17, 2021
f1c8fcd
configure sql connection settings
adlerhurst Aug 17, 2021
7195f99
add mig for agg type index
adlerhurst Aug 17, 2021
15e1302
fix replace tab in yaml
adlerhurst Aug 17, 2021
e4a8389
handler interfaces
adlerhurst Aug 18, 2021
6e54629
subscription
adlerhurst Aug 18, 2021
2943fd6
first try
adlerhurst Aug 19, 2021
d49c798
handler
adlerhurst Aug 24, 2021
fd9f58d
move sql client initialization
adlerhurst Aug 26, 2021
3c9dfef
first part implemented
adlerhurst Sep 1, 2021
f3164e4
removed all occurencies of org by id and search orgs
adlerhurst Sep 9, 2021
89fec6e
Merge branch 'main' into org-projection
adlerhurst Sep 9, 2021
9ec4d65
fix merge issues
adlerhurst Sep 9, 2021
b75f4e4
cleanup code
adlerhurst Sep 9, 2021
eaff93e
fix: queries implements orgviewprovider
adlerhurst Sep 10, 2021
37fe9d2
cleanup
adlerhurst Sep 10, 2021
06015c1
refactor text comparison
adlerhurst Sep 10, 2021
5745aeb
remove unused file
adlerhurst Sep 10, 2021
4a4480d
remove unused code
adlerhurst Sep 10, 2021
f6ceccb
log
adlerhurst Sep 10, 2021
1d010b8
remove unused code
adlerhurst Sep 10, 2021
d8929e6
remove unused field
adlerhurst Sep 10, 2021
5798852
remove unused file
adlerhurst Sep 10, 2021
4a235f0
refactor
adlerhurst Sep 10, 2021
2c6da6c
tests for search query
adlerhurst Sep 10, 2021
67c4548
remove try
adlerhurst Sep 10, 2021
9728576
simplify state change mappers
adlerhurst Sep 12, 2021
8e7229d
projection tests
adlerhurst Sep 12, 2021
9683065
query functions
adlerhurst Sep 12, 2021
25f6d44
move reusable objects to separate files
adlerhurst Sep 15, 2021
7c62283
rename domain column to primar_domain
adlerhurst Sep 15, 2021
202b838
fix tests
adlerhurst Sep 15, 2021
bc6c49d
add current sequence
adlerhurst Sep 15, 2021
8364bbf
remove log prints
adlerhurst Sep 15, 2021
19ff8d2
fix tests
adlerhurst Sep 15, 2021
65578b3
Merge branch 'main' into org-projection
adlerhurst Sep 16, 2021
61eb42c
fix: verifier
adlerhurst Sep 16, 2021
6d7b7b9
fix test
adlerhurst Sep 16, 2021
3797ce8
rename domain col migrations
adlerhurst Sep 16, 2021
b2907a6
Merge branch 'main' into org-projection
adlerhurst Sep 16, 2021
4575a86
simplify search response
adlerhurst Sep 16, 2021
920c70b
add custom column constructors
adlerhurst Sep 17, 2021
8e70f2d
fix: org projection table const
hifabienne Sep 21, 2021
a2ce62b
Merge branch 'org-projection' of https://github.com/caos/zitadel into…
adlerhurst Sep 21, 2021
8629f03
fix: full column name
hifabienne Sep 22, 2021
2dd90c6
feat: text query extension
hifabienne Sep 23, 2021
9d445ff
fix: tests for query
adlerhurst Sep 23, 2021
5d48096
number query
adlerhurst Sep 23, 2021
3f25b72
add deprection message
adlerhurst Sep 23, 2021
f2e96a3
projection
adlerhurst Sep 23, 2021
567bbdc
correct migration
adlerhurst Sep 24, 2021
1e749d4
column in a single place (#2416)
adlerhurst Sep 27, 2021
5fcd0c6
column for current sequences
adlerhurst Sep 27, 2021
2681676
Merge branch 'org-projection' into pw-complexity-policy
adlerhurst Sep 27, 2021
5c62b84
global counter column
adlerhurst Sep 27, 2021
cf8c21f
fix is org unique
adlerhurst Sep 27, 2021
e21a59c
Merge branch 'org-projection' into pw-complexity-policy
adlerhurst Sep 27, 2021
2c2893a
query
adlerhurst Sep 27, 2021
2531e88
fix wrong code
adlerhurst Sep 27, 2021
1f9ff37
remove unused code
adlerhurst Sep 27, 2021
5b756ab
remove unused code
adlerhurst Sep 27, 2021
34e6430
remove unused code
adlerhurst Sep 27, 2021
0e5c6ad
tests
adlerhurst Sep 28, 2021
baa2190
Merge branch 'main' into pw-complexity-policy
adlerhurst Oct 19, 2021
0b9a59c
fix: tests
adlerhurst Oct 19, 2021
8a76b1f
migrations
adlerhurst Oct 19, 2021
08dfc6e
fixes
adlerhurst Oct 19, 2021
92b789f
errors
adlerhurst Oct 19, 2021
5ff3dfc
add converter option
adlerhurst Oct 20, 2021
6091d2a
Merge branch 'main' into pw-complexity-policy
adlerhurst Oct 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions go.mod
Expand Up @@ -15,11 +15,10 @@ require (
github.com/VictoriaMetrics/fastcache v1.7.0
github.com/ajstarks/svgo v0.0.0-20210406150507-75cfd577ce75
github.com/allegro/bigcache v1.2.1
github.com/aws/aws-sdk-go-v2 v1.6.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.3.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.2.1 // indirect
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.3.1 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.10.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.6.0
github.com/aws/aws-sdk-go-v2/config v1.3.0
github.com/aws/aws-sdk-go-v2/credentials v1.2.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.10.0
github.com/boombuler/barcode v1.0.1
github.com/caos/logging v0.0.2
github.com/caos/oidc v0.15.10
Expand Down
360 changes: 3 additions & 357 deletions go.sum

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions internal/admin/repository/eventsourcing/eventstore/iam.go
Expand Up @@ -167,32 +167,6 @@ func (repo *IAMRepository) SearchDefaultIDPProviders(ctx context.Context, reques
return result, nil
}

func (repo *IAMRepository) GetDefaultPasswordComplexityPolicy(ctx context.Context) (*iam_model.PasswordComplexityPolicyView, error) {
policy, viewErr := repo.View.PasswordComplexityPolicyByAggregateID(repo.SystemDefaults.IamID)
if viewErr != nil && !caos_errs.IsNotFound(viewErr) {
return nil, viewErr
}
if caos_errs.IsNotFound(viewErr) {
policy = new(iam_es_model.PasswordComplexityPolicyView)
}

events, esErr := repo.getIAMEvents(ctx, policy.Sequence)
if caos_errs.IsNotFound(viewErr) && len(events) == 0 {
return nil, caos_errs.ThrowNotFound(nil, "EVENT-1Mc0s", "Errors.IAM.PasswordComplexityPolicy.NotFound")
}
if esErr != nil {
logging.Log("EVENT-3M0xs").WithError(esErr).Debug("error retrieving new events")
return iam_es_model.PasswordComplexityViewToModel(policy), nil
}
policyCopy := *policy
for _, event := range events {
if err := policyCopy.AppendEvent(event); err != nil {
return iam_es_model.PasswordComplexityViewToModel(policy), nil
}
}
return iam_es_model.PasswordComplexityViewToModel(policy), nil
}

func (repo *IAMRepository) GetDefaultPasswordAgePolicy(ctx context.Context) (*iam_model.PasswordAgePolicyView, error) {
policy, viewErr := repo.View.PasswordAgePolicyByAggregateID(repo.SystemDefaults.IamID)
if viewErr != nil && !caos_errs.IsNotFound(viewErr) {
Expand Down
2 changes: 0 additions & 2 deletions internal/admin/repository/eventsourcing/handler/handler.go
Expand Up @@ -45,8 +45,6 @@ func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es
newUser(
handler{view, bulkLimit, configs.cycleDuration("User"), errorCount, es},
defaults),
newPasswordComplexityPolicy(
handler{view, bulkLimit, configs.cycleDuration("PasswordComplexityPolicy"), errorCount, es}),
newPasswordAgePolicy(
handler{view, bulkLimit, configs.cycleDuration("PasswordAgePolicy"), errorCount, es}),
newLockoutPolicy(
Expand Down

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions internal/admin/repository/iam.go
Expand Up @@ -35,8 +35,6 @@ type IAMRepository interface {
GetDefaultLoginTexts(ctx context.Context, lang string) (*domain.CustomLoginText, error)
GetCustomLoginTexts(ctx context.Context, lang string) (*domain.CustomLoginText, error)

GetDefaultPasswordComplexityPolicy(ctx context.Context) (*iam_model.PasswordComplexityPolicyView, error)

GetDefaultPasswordAgePolicy(ctx context.Context) (*iam_model.PasswordAgePolicyView, error)

GetDefaultLockoutPolicy(ctx context.Context) (*iam_model.LockoutPolicyView, error)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/grpc/admin/password_complexity.go
Expand Up @@ -9,7 +9,7 @@ import (
)

func (s *Server) GetPasswordComplexityPolicy(ctx context.Context, _ *admin_pb.GetPasswordComplexityPolicyRequest) (*admin_pb.GetPasswordComplexityPolicyResponse, error) {
policy, err := s.iam.GetDefaultPasswordComplexityPolicy(ctx)
policy, err := s.query.DefaultPasswordComplexityPolicy(ctx)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion internal/api/grpc/auth/password_complexity.go
Expand Up @@ -3,12 +3,13 @@ package auth
import (
"context"

"github.com/caos/zitadel/internal/api/authz"
policy_grpc "github.com/caos/zitadel/internal/api/grpc/policy"
auth_pb "github.com/caos/zitadel/pkg/grpc/auth"
)

func (s *Server) GetMyPasswordComplexityPolicy(ctx context.Context, _ *auth_pb.GetMyPasswordComplexityPolicyRequest) (*auth_pb.GetMyPasswordComplexityPolicyResponse, error) {
policy, err := s.repo.GetMyPasswordComplexityPolicy(ctx)
policy, err := s.query.PasswordComplexityPolicyByOrg(ctx, authz.GetCtxData(ctx).OrgID)
if err != nil {
return nil, err
}
Expand Down
7 changes: 4 additions & 3 deletions internal/api/grpc/management/policy_password_complexity.go
Expand Up @@ -2,22 +2,23 @@ package management

import (
"context"

"github.com/caos/zitadel/internal/api/authz"
"github.com/caos/zitadel/internal/api/grpc/object"
policy_grpc "github.com/caos/zitadel/internal/api/grpc/policy"
mgmt_pb "github.com/caos/zitadel/pkg/grpc/management"
)

func (s *Server) GetPasswordComplexityPolicy(ctx context.Context, req *mgmt_pb.GetPasswordComplexityPolicyRequest) (*mgmt_pb.GetPasswordComplexityPolicyResponse, error) {
policy, err := s.org.GetPasswordComplexityPolicy(ctx)
policy, err := s.query.PasswordComplexityPolicyByOrg(ctx, authz.GetCtxData(ctx).OrgID)
if err != nil {
return nil, err
}
return &mgmt_pb.GetPasswordComplexityPolicyResponse{Policy: policy_grpc.ModelPasswordComplexityPolicyToPb(policy), IsDefault: policy.Default}, nil
return &mgmt_pb.GetPasswordComplexityPolicyResponse{Policy: policy_grpc.ModelPasswordComplexityPolicyToPb(policy), IsDefault: policy.IsDefault}, nil
}

func (s *Server) GetDefaultPasswordComplexityPolicy(ctx context.Context, req *mgmt_pb.GetDefaultPasswordComplexityPolicyRequest) (*mgmt_pb.GetDefaultPasswordComplexityPolicyResponse, error) {
policy, err := s.org.GetDefaultPasswordComplexityPolicy(ctx)
policy, err := s.query.DefaultPasswordComplexityPolicy(ctx)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions internal/api/grpc/policy/password_complexity_policy.go
Expand Up @@ -2,13 +2,13 @@ package policy

import (
"github.com/caos/zitadel/internal/api/grpc/object"
"github.com/caos/zitadel/internal/iam/model"
"github.com/caos/zitadel/internal/query"
policy_pb "github.com/caos/zitadel/pkg/grpc/policy"
)

func ModelPasswordComplexityPolicyToPb(policy *model.PasswordComplexityPolicyView) *policy_pb.PasswordComplexityPolicy {
func ModelPasswordComplexityPolicyToPb(policy *query.PasswordComplexityPolicy) *policy_pb.PasswordComplexityPolicy {
return &policy_pb.PasswordComplexityPolicy{
IsDefault: policy.Default,
IsDefault: policy.IsDefault,
MinLength: policy.MinLength,
HasUppercase: policy.HasUppercase,
HasLowercase: policy.HasLowercase,
Expand All @@ -18,7 +18,7 @@ func ModelPasswordComplexityPolicyToPb(policy *model.PasswordComplexityPolicyVie
policy.Sequence,
policy.CreationDate,
policy.ChangeDate,
"", //TODO: ro
policy.ResourceOwner,
),
}
}
11 changes: 3 additions & 8 deletions internal/auth/repository/eventsourcing/eventstore/org.go
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/caos/zitadel/internal/eventstore/v1/models"
iam_model "github.com/caos/zitadel/internal/iam/model"
iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model"
"github.com/caos/zitadel/internal/query"
"github.com/caos/zitadel/internal/repository/iam"
)

Expand All @@ -27,6 +28,7 @@ type OrgRepository struct {
Eventstore eventstore.Eventstore
View *auth_view.View
SystemDefaults systemdefaults.SystemDefaults
Query query.Queries
}

func (repo *OrgRepository) GetDefaultOrgIAMPolicy(ctx context.Context) (*iam_model.OrgIAMPolicyView, error) {
Expand Down Expand Up @@ -59,14 +61,7 @@ func (repo *OrgRepository) GetIDPConfigByID(ctx context.Context, idpConfigID str
}

func (repo *OrgRepository) GetMyPasswordComplexityPolicy(ctx context.Context) (*iam_model.PasswordComplexityPolicyView, error) {
policy, err := repo.View.PasswordComplexityPolicyByAggregateID(authz.GetCtxData(ctx).OrgID)
if errors.IsNotFound(err) {
policy, err = repo.View.PasswordComplexityPolicyByAggregateID(repo.SystemDefaults.IamID)
if err != nil {
return nil, err
}
policy.Default = true
}
policy, err := repo.Query.PasswordComplexityPolicyByOrg(ctx, authz.GetCtxData(ctx).OrgID)
if err != nil {
return nil, err
}
Expand Down
2 changes: 0 additions & 2 deletions internal/auth/repository/eventsourcing/handler/handler.go
Expand Up @@ -58,8 +58,6 @@ func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es
newExternalIDP(
handler{view, bulkLimit, configs.cycleDuration("ExternalIDP"), errorCount, es},
systemDefaults),
newPasswordComplexityPolicy(
handler{view, bulkLimit, configs.cycleDuration("PasswordComplexityPolicy"), errorCount, es}),
newOrgIAMPolicy(
handler{view, bulkLimit, configs.cycleDuration("OrgIAMPolicy"), errorCount, es}),
newProjectRole(handler{view, bulkLimit, configs.cycleDuration("ProjectRole"), errorCount, es}),
Expand Down