refactor: remove unused code (#2798)

* refactor(domain): add user type

* fix(projections): start with login names

* fix(login_policy): correct handling of user domain claimed event

* fix(projections): add members

* refactor: simplify member projections

* add migration for members

* add metadata to member projections

* refactor: login name projection

* fix: set correct suffixes on login name projections

* test(projections): login name reduces

* fix: correct cols in reduce member

* test(projections): org, iam, project members

* member additional cols and conds as opt,
add project grant members

* fix(migration): members

* fix(migration): correct database name

* migration version

* migs

* better naming for member cond and col

* split project and project grant members

* prepare member columns

* feat(queries): membership query

* test(queries): membership prepare

* fix(queries): multiple projections for latest sequence

* fix(api): use query for membership queries in auth and management

* feat: org member queries

* fix(api): use query for iam member calls

* fix(queries): org members

* fix(queries): project members

* fix(queries): project grant members

* refactor: remove unsued methods in repo-interfaces

* refactor(eventstore): rename EventPusher to Command, EventReader to Event, PushEvents to Push and FilterEvents to Filter
This commit is contained in:
Silvan 2022-01-03 11:50:38 +01:00 committed by GitHub
parent 09be70949f
commit 5640a0ef33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 48 deletions

View File

@ -79,7 +79,7 @@ func (s *Server) ReactivateOrgIDP(ctx context.Context, req *mgmt_pb.ReactivateOr
}
func (s *Server) RemoveOrgIDP(ctx context.Context, req *mgmt_pb.RemoveOrgIDPRequest) (*mgmt_pb.RemoveOrgIDPResponse, error) {
idpProviders, err := s.org.GetIDPProvidersByIDPConfigID(ctx, authz.GetCtxData(ctx).OrgID, req.IdpId)
idp, err := s.query.IDPByIDAndResourceOwner(ctx, req.IdpId, authz.GetCtxData(ctx).OrgID)
if err != nil {
return nil, err
}
@ -87,7 +87,7 @@ func (s *Server) RemoveOrgIDP(ctx context.Context, req *mgmt_pb.RemoveOrgIDPRequ
if err != nil {
return nil, err
}
_, err = s.command.RemoveIDPConfig(ctx, req.IdpId, authz.GetCtxData(ctx).OrgID, len(idpProviders) > 0, externalIDPViewsToDomain(externalIDPs)...)
_, err = s.command.RemoveIDPConfig(ctx, req.IdpId, authz.GetCtxData(ctx).OrgID, idp != nil, externalIDPViewsToDomain(externalIDPs)...)
if err != nil {
return nil, err
}

View File

@ -15,13 +15,8 @@ type OrgRepository interface {
Languages(ctx context.Context) ([]language.Tag, error)
OrgChanges(ctx context.Context, id string, lastSequence uint64, limit uint64, sortAscending bool, auditLogRetention time.Duration) (*org_model.OrgChanges, error)
SearchMyOrgMembers(ctx context.Context, request *org_model.OrgMemberSearchRequest) (*org_model.OrgMemberSearchResponse, error)
GetOrgMemberRoles() []string
SearchIDPConfigs(ctx context.Context, request *iam_model.IDPConfigSearchRequest) (*iam_model.IDPConfigSearchResponse, error)
IDPConfigByID(ctx context.Context, id string) (*iam_model.IDPConfigView, error)
SearchIDPProviders(ctx context.Context, request *iam_model.IDPProviderSearchRequest) (*iam_model.IDPProviderSearchResponse, error)
GetIDPProvidersByIDPConfigID(ctx context.Context, aggregateID, idpConfigID string) ([]*iam_model.IDPProviderView, error)
}

View File

@ -10,17 +10,12 @@ import (
)
type ProjectRepository interface {
ProjectMemberByID(ctx context.Context, projectID, userID string) (*model.ProjectMemberView, error)
SearchProjectMembers(ctx context.Context, request *model.ProjectMemberSearchRequest) (*model.ProjectMemberSearchResponse, error)
GetProjectMemberRoles(ctx context.Context) ([]string, error)
ProjectChanges(ctx context.Context, id string, lastSequence uint64, limit uint64, sortAscending bool, retention time.Duration) (*model.ProjectChanges, error)
ApplicationChanges(ctx context.Context, projectID string, appID string, lastSequence uint64, limit uint64, sortAscending bool, retention time.Duration) (*model.ApplicationChanges, error)
SearchProjectGrantMembers(ctx context.Context, request *model.ProjectGrantMemberSearchRequest) (*model.ProjectGrantMemberSearchResponse, error)
ProjectGrantMemberByID(ctx context.Context, projectID, userID string) (*model.ProjectGrantMemberView, error)
GetProjectGrantMemberRoles() []string
GetIAMByID(ctx context.Context) (*iam_model.IAM, error)

View File

@ -50,6 +50,10 @@ func (p *OrgMemberProjection) reducers() []handler.AggregateReducer {
Event: org.MemberRemovedEventType,
Reduce: p.reduceRemoved,
},
{
Event: org.OrgRemovedEventType,
Reduce: p.reduceOrgRemoved,
},
},
},
{
@ -61,15 +65,6 @@ func (p *OrgMemberProjection) reducers() []handler.AggregateReducer {
},
},
},
{
Aggregate: org.AggregateType,
EventRedusers: []handler.EventReducer{
{
Event: org.OrgRemovedEventType,
Reduce: p.reduceOrgRemoved,
},
},
},
}
}

View File

@ -52,6 +52,14 @@ func (p *ProjectGrantMemberProjection) reducers() []handler.AggregateReducer {
Event: project.GrantMemberRemovedType,
Reduce: p.reduceRemoved,
},
{
Event: project.ProjectRemovedType,
Reduce: p.reduceProjectRemoved,
},
{
Event: project.GrantRemovedType,
Reduce: p.reduceProjectGrantRemoved,
},
},
},
{
@ -72,24 +80,6 @@ func (p *ProjectGrantMemberProjection) reducers() []handler.AggregateReducer {
},
},
},
{
Aggregate: project.AggregateType,
EventRedusers: []handler.EventReducer{
{
Event: project.ProjectRemovedType,
Reduce: p.reduceProjectRemoved,
},
},
},
{
Aggregate: project.AggregateType,
EventRedusers: []handler.EventReducer{
{
Event: project.GrantRemovedType,
Reduce: p.reduceProjectGrantRemoved,
},
},
},
}
}

View File

@ -52,6 +52,10 @@ func (p *ProjectMemberProjection) reducers() []handler.AggregateReducer {
Event: project.MemberRemovedType,
Reduce: p.reduceRemoved,
},
{
Event: project.ProjectRemovedType,
Reduce: p.reduceProjectRemoved,
},
},
},
{
@ -72,15 +76,6 @@ func (p *ProjectMemberProjection) reducers() []handler.AggregateReducer {
},
},
},
{
Aggregate: project.AggregateType,
EventRedusers: []handler.EventReducer{
{
Event: project.ProjectRemovedType,
Reduce: p.reduceProjectRemoved,
},
},
},
}
}