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

@@ -72,10 +72,6 @@ var (
name: projection.ProjectColumnState,
table: projectsTable,
}
ProjectColumnOwnerRemoved = Column{
name: projection.ProjectColumnOwnerRemoved,
table: projectsTable,
}
)
type Projects struct {
@@ -103,7 +99,7 @@ type ProjectSearchQueries struct {
Queries []SearchQuery
}
func (q *Queries) ProjectByID(ctx context.Context, shouldTriggerBulk bool, id string, withOwnerRemoved bool) (project *Project, err error) {
func (q *Queries) ProjectByID(ctx context.Context, shouldTriggerBulk bool, id string) (project *Project, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
@@ -119,9 +115,6 @@ func (q *Queries) ProjectByID(ctx context.Context, shouldTriggerBulk bool, id st
ProjectColumnID.identifier(): id,
ProjectColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
}
if !withOwnerRemoved {
eq[ProjectColumnOwnerRemoved.identifier()] = false
}
query, args, err := stmt.Where(eq).ToSql()
if err != nil {
return nil, errors.ThrowInternal(err, "QUERY-2m00Q", "Errors.Query.SQLStatment")
@@ -134,15 +127,12 @@ func (q *Queries) ProjectByID(ctx context.Context, shouldTriggerBulk bool, id st
return project, err
}
func (q *Queries) SearchProjects(ctx context.Context, queries *ProjectSearchQueries, withOwnerRemoved bool) (projects *Projects, err error) {
func (q *Queries) SearchProjects(ctx context.Context, queries *ProjectSearchQueries) (projects *Projects, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
query, scan := prepareProjectsQuery(ctx, q.client)
eq := sq.Eq{ProjectColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
if !withOwnerRemoved {
eq[ProjectColumnOwnerRemoved.identifier()] = false
}
stmt, args, err := queries.toQuery(query).Where(eq).ToSql()
if err != nil {
return nil, errors.ThrowInvalidArgument(err, "QUERY-fn9ew", "Errors.Query.InvalidRequest")