diff --git a/internal/auth/repository/eventsourcing/eventstore/auth_request.go b/internal/auth/repository/eventsourcing/eventstore/auth_request.go index da68381f8e..0d2a1beaef 100644 --- a/internal/auth/repository/eventsourcing/eventstore/auth_request.go +++ b/internal/auth/repository/eventsourcing/eventstore/auth_request.go @@ -97,7 +97,7 @@ type orgViewProvider interface { type userGrantProvider interface { ProjectByOIDCClientID(context.Context, string) (*query.Project, error) - UserGrantsByProjectAndUserID(string, string) ([]*query.UserGrant, error) + UserGrantsByProjectAndUserID(context.Context, string, string) ([]*query.UserGrant, error) } type projectProvider interface { @@ -1266,7 +1266,7 @@ func userGrantRequired(ctx context.Context, request *domain.AuthRequest, user *u if !project.ProjectRoleCheck { return false, nil } - grants, err := userGrantProvider.UserGrantsByProjectAndUserID(project.ID, user.ID) + grants, err := userGrantProvider.UserGrantsByProjectAndUserID(ctx, project.ID, user.ID) if err != nil { return false, err } diff --git a/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go b/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go index a404a59618..14f35b45c2 100644 --- a/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go +++ b/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go @@ -195,7 +195,7 @@ func (m *mockUserGrants) ProjectByOIDCClientID(ctx context.Context, s string) (* return &query.Project{ProjectRoleCheck: m.roleCheck}, nil } -func (m *mockUserGrants) UserGrantsByProjectAndUserID(s string, s2 string) ([]*query.UserGrant, error) { +func (m *mockUserGrants) UserGrantsByProjectAndUserID(ctx context.Context, s string, s2 string) ([]*query.UserGrant, error) { var grants []*query.UserGrant if m.userGrants > 0 { grants = make([]*query.UserGrant, m.userGrants) diff --git a/internal/auth/repository/eventsourcing/repository.go b/internal/auth/repository/eventsourcing/repository.go index ce41cd5930..bd6d0c796e 100644 --- a/internal/auth/repository/eventsourcing/repository.go +++ b/internal/auth/repository/eventsourcing/repository.go @@ -115,7 +115,7 @@ type queryViewWrapper struct { *auth_view.View } -func (q queryViewWrapper) UserGrantsByProjectAndUserID(projectID, userID string) ([]*query.UserGrant, error) { +func (q queryViewWrapper) UserGrantsByProjectAndUserID(ctx context.Context, projectID, userID string) ([]*query.UserGrant, error) { userGrantProjectID, err := query.NewUserGrantProjectIDSearchQuery(projectID) if err != nil { return nil, err @@ -125,7 +125,7 @@ func (q queryViewWrapper) UserGrantsByProjectAndUserID(projectID, userID string) return nil, err } queries := &query.UserGrantsQueries{Queries: []query.SearchQuery{userGrantUserID, userGrantProjectID}} - grants, err := q.Queries.UserGrants(context.TODO(), queries) + grants, err := q.Queries.UserGrants(ctx, queries) if err != nil { return nil, err } diff --git a/internal/query/projection/project_grant.go b/internal/query/projection/project_grant.go index b0a669e9b1..7100f6895f 100644 --- a/internal/query/projection/project_grant.go +++ b/internal/query/projection/project_grant.go @@ -47,7 +47,7 @@ func NewProjectGrantProjection(ctx context.Context, config crdb.StatementHandler crdb.NewColumn(ProjectGrantColumnInstanceID, crdb.ColumnTypeText), crdb.NewColumn(ProjectGrantColumnProjectID, crdb.ColumnTypeText), crdb.NewColumn(ProjectGrantColumnGrantedOrgID, crdb.ColumnTypeText), - crdb.NewColumn(ProjectGrantColumnRoleKeys, crdb.ColumnTypeTextArray), + crdb.NewColumn(ProjectGrantColumnRoleKeys, crdb.ColumnTypeTextArray, crdb.Nullable()), }, crdb.NewPrimaryKey(ProjectGrantColumnInstanceID, ProjectGrantColumnGrantID), crdb.WithIndex(crdb.NewIndex("ro_idx", []string{ProjectGrantColumnResourceOwner})),