perf: remove owner removed columns from projections for oidc (#6925)

* fix: remove owner removed columns from login names projection

* fix: remove owner removed columns from flow projection

* fix: remove owner removed columns from project, projectgrant and member projections

* fix: correct unit tests for session projection

* fix: correct unit tests for session projection
This commit is contained in:
Stefan Benz
2023-11-20 16:21:08 +01:00
committed by GitHub
parent 3bed5f50a8
commit 0ec7a74877
65 changed files with 358 additions and 654 deletions

View File

@@ -52,10 +52,6 @@ var (
name: projection.FlowActionIDCol,
table: flowsTriggersTable,
}
FlowsTriggersOwnerRemovedCol = Column{
name: projection.FlowOwnerRemovedCol,
table: flowsTriggersTable,
}
)
type Flow struct {
@@ -67,7 +63,7 @@ type Flow struct {
TriggerActions map[domain.TriggerType][]*Action
}
func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID string, withOwnerRemoved bool) (flow *Flow, err error) {
func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID string) (flow *Flow, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
@@ -77,9 +73,6 @@ func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID s
FlowsTriggersColumnResourceOwner.identifier(): orgID,
FlowsTriggersColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
}
if !withOwnerRemoved {
eq[FlowsTriggersOwnerRemovedCol.identifier()] = false
}
stmt, args, err := query.Where(eq).ToSql()
if err != nil {
return nil, errors.ThrowInvalidArgument(err, "QUERY-HBRh3", "Errors.Query.InvalidRequest")
@@ -92,7 +85,7 @@ func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID s
return flow, err
}
func (q *Queries) GetActiveActionsByFlowAndTriggerType(ctx context.Context, flowType domain.FlowType, triggerType domain.TriggerType, orgID string, withOwnerRemoved bool) (actions []*Action, err error) {
func (q *Queries) GetActiveActionsByFlowAndTriggerType(ctx context.Context, flowType domain.FlowType, triggerType domain.TriggerType, orgID string) (actions []*Action, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
@@ -104,9 +97,6 @@ func (q *Queries) GetActiveActionsByFlowAndTriggerType(ctx context.Context, flow
FlowsTriggersColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
ActionColumnState.identifier(): domain.ActionStateActive,
}
if !withOwnerRemoved {
eq[FlowsTriggersOwnerRemovedCol.identifier()] = false
}
query, args, err := stmt.Where(eq).ToSql()
if err != nil {
return nil, errors.ThrowInternal(err, "QUERY-Dgff3", "Errors.Query.SQLStatement")
@@ -119,7 +109,7 @@ func (q *Queries) GetActiveActionsByFlowAndTriggerType(ctx context.Context, flow
return actions, err
}
func (q *Queries) GetFlowTypesOfActionID(ctx context.Context, actionID string, withOwnerRemoved bool) (types []domain.FlowType, err error) {
func (q *Queries) GetFlowTypesOfActionID(ctx context.Context, actionID string) (types []domain.FlowType, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
@@ -128,9 +118,6 @@ func (q *Queries) GetFlowTypesOfActionID(ctx context.Context, actionID string, w
FlowsTriggersColumnActionID.identifier(): actionID,
FlowsTriggersColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
}
if !withOwnerRemoved {
eq[FlowsTriggersOwnerRemovedCol.identifier()] = false
}
query, args, err := stmt.Where(eq).ToSql()
if err != nil {
return nil, errors.ThrowInvalidArgument(err, "QUERY-Dh311", "Errors.Query.InvalidRequest")