mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
feat: add get my password policy (#346)
* feat: add get my password policy * fix: failed merges
This commit is contained in:
18
internal/auth/repository/eventsourcing/eventstore/policy.go
Normal file
18
internal/auth/repository/eventsourcing/eventstore/policy.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package eventstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/auth"
|
||||
pol_model "github.com/caos/zitadel/internal/policy/model"
|
||||
pol_event "github.com/caos/zitadel/internal/policy/repository/eventsourcing"
|
||||
)
|
||||
|
||||
type PolicyRepo struct {
|
||||
PolicyEvents *pol_event.PolicyEventstore
|
||||
}
|
||||
|
||||
func (repo *PolicyRepo) GetMyPasswordComplexityPolicy(ctx context.Context) (*pol_model.PasswordComplexityPolicy, error) {
|
||||
ctxData := auth.GetCtxData(ctx)
|
||||
return repo.PolicyEvents.GetPasswordComplexityPolicy(ctx, ctxData.OrgID)
|
||||
}
|
@@ -44,6 +44,7 @@ type EsRepository struct {
|
||||
eventstore.UserGrantRepo
|
||||
eventstore.OrgRepository
|
||||
eventstore.IamRepository
|
||||
eventstore.PolicyRepo
|
||||
}
|
||||
|
||||
func Start(conf Config, authZ auth.Config, systemDefaults sd.SystemDefaults, authZRepo *authz_repo.EsRepository) (*EsRepository, error) {
|
||||
@@ -173,6 +174,9 @@ func Start(conf Config, authZ auth.Config, systemDefaults sd.SystemDefaults, aut
|
||||
IamEvents: iam,
|
||||
IamID: systemDefaults.IamID,
|
||||
},
|
||||
eventstore.PolicyRepo{
|
||||
PolicyEvents: policy,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
10
internal/auth/repository/policy.go
Normal file
10
internal/auth/repository/policy.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/policy/model"
|
||||
)
|
||||
|
||||
type PolicyRepository interface {
|
||||
GetMyPasswordComplexityPolicy(ctx context.Context) (*model.PasswordComplexityPolicy, error)
|
||||
}
|
@@ -13,4 +13,5 @@ type Repository interface {
|
||||
KeyRepository
|
||||
UserSessionRepository
|
||||
UserGrantRepository
|
||||
PolicyRepository
|
||||
}
|
||||
|
Reference in New Issue
Block a user