mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:17:32 +00:00
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:
@@ -78,14 +78,6 @@ var (
|
||||
name: projection.OrgColumnName,
|
||||
table: orgsTable.setAlias(ProjectGrantResourceOwnerTableAlias),
|
||||
}
|
||||
ProjectGrantColumnOwnerRemoved = Column{
|
||||
name: projection.ProjectGrantColumnOwnerRemoved,
|
||||
table: projectGrantsTable,
|
||||
}
|
||||
ProjectGrantColumnGrantGrantedOrgRemoved = Column{
|
||||
name: projection.ProjectGrantColumnGrantedOrgRemoved,
|
||||
table: projectGrantsTable,
|
||||
}
|
||||
)
|
||||
|
||||
type ProjectGrants struct {
|
||||
@@ -114,7 +106,7 @@ type ProjectGrantSearchQueries struct {
|
||||
Queries []SearchQuery
|
||||
}
|
||||
|
||||
func (q *Queries) ProjectGrantByID(ctx context.Context, shouldTriggerBulk bool, id string, withOwnerRemoved bool) (grant *ProjectGrant, err error) {
|
||||
func (q *Queries) ProjectGrantByID(ctx context.Context, shouldTriggerBulk bool, id string) (grant *ProjectGrant, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
@@ -130,10 +122,6 @@ func (q *Queries) ProjectGrantByID(ctx context.Context, shouldTriggerBulk bool,
|
||||
ProjectGrantColumnGrantID.identifier(): id,
|
||||
ProjectGrantColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||
}
|
||||
if !withOwnerRemoved {
|
||||
eq[ProjectGrantColumnOwnerRemoved.identifier()] = false
|
||||
eq[ProjectGrantColumnGrantGrantedOrgRemoved.identifier()] = false
|
||||
}
|
||||
query, args, err := stmt.Where(eq).ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "QUERY-Nf93d", "Errors.Query.SQLStatment")
|
||||
@@ -146,7 +134,7 @@ func (q *Queries) ProjectGrantByID(ctx context.Context, shouldTriggerBulk bool,
|
||||
return grant, err
|
||||
}
|
||||
|
||||
func (q *Queries) ProjectGrantByIDAndGrantedOrg(ctx context.Context, id, grantedOrg string, withOwnerRemoved bool) (grant *ProjectGrant, err error) {
|
||||
func (q *Queries) ProjectGrantByIDAndGrantedOrg(ctx context.Context, id, grantedOrg string) (grant *ProjectGrant, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
@@ -156,10 +144,6 @@ func (q *Queries) ProjectGrantByIDAndGrantedOrg(ctx context.Context, id, granted
|
||||
ProjectGrantColumnGrantedOrgID.identifier(): grantedOrg,
|
||||
ProjectGrantColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||
}
|
||||
if !withOwnerRemoved {
|
||||
eq[ProjectGrantColumnOwnerRemoved.identifier()] = false
|
||||
eq[ProjectGrantColumnGrantGrantedOrgRemoved.identifier()] = false
|
||||
}
|
||||
query, args, err := stmt.Where(eq).ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "QUERY-MO9fs", "Errors.Query.SQLStatment")
|
||||
@@ -172,7 +156,7 @@ func (q *Queries) ProjectGrantByIDAndGrantedOrg(ctx context.Context, id, granted
|
||||
return grant, err
|
||||
}
|
||||
|
||||
func (q *Queries) SearchProjectGrants(ctx context.Context, queries *ProjectGrantSearchQueries, withOwnerRemoved bool) (grants *ProjectGrants, err error) {
|
||||
func (q *Queries) SearchProjectGrants(ctx context.Context, queries *ProjectGrantSearchQueries) (grants *ProjectGrants, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
@@ -180,10 +164,6 @@ func (q *Queries) SearchProjectGrants(ctx context.Context, queries *ProjectGrant
|
||||
eq := sq.Eq{
|
||||
ProjectGrantColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||
}
|
||||
if !withOwnerRemoved {
|
||||
eq[ProjectGrantColumnOwnerRemoved.identifier()] = false
|
||||
eq[ProjectGrantColumnGrantGrantedOrgRemoved.identifier()] = false
|
||||
}
|
||||
stmt, args, err := queries.toQuery(query).Where(eq).ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInvalidArgument(err, "QUERY-N9fsg", "Errors.Query.InvalidRequest")
|
||||
@@ -201,7 +181,7 @@ func (q *Queries) SearchProjectGrants(ctx context.Context, queries *ProjectGrant
|
||||
return grants, err
|
||||
}
|
||||
|
||||
func (q *Queries) SearchProjectGrantsByProjectIDAndRoleKey(ctx context.Context, projectID, roleKey string, withOwnerRemoved bool) (projects *ProjectGrants, err error) {
|
||||
func (q *Queries) SearchProjectGrantsByProjectIDAndRoleKey(ctx context.Context, projectID, roleKey string) (projects *ProjectGrants, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
@@ -217,7 +197,7 @@ func (q *Queries) SearchProjectGrantsByProjectIDAndRoleKey(ctx context.Context,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return q.SearchProjectGrants(ctx, searchQuery, withOwnerRemoved)
|
||||
return q.SearchProjectGrants(ctx, searchQuery)
|
||||
}
|
||||
|
||||
func NewProjectGrantProjectIDSearchQuery(value string) (SearchQuery, error) {
|
||||
|
Reference in New Issue
Block a user