mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: replace original GetPrebuiltWorkspaces with optimized version (#18832)
Fixes https://github.com/coder/internal/issues/715 Follow-up from https://github.com/coder/coder/pull/18717 Now that we've determined the updated query is safe, remove the duplication.
This commit is contained in:
@@ -2654,14 +2654,6 @@ func (q *querier) GetRunningPrebuiltWorkspaces(ctx context.Context) ([]database.
|
||||
return q.db.GetRunningPrebuiltWorkspaces(ctx)
|
||||
}
|
||||
|
||||
func (q *querier) GetRunningPrebuiltWorkspacesOptimized(ctx context.Context) ([]database.GetRunningPrebuiltWorkspacesOptimizedRow, error) {
|
||||
// This query returns only prebuilt workspaces, but we decided to require permissions for all workspaces.
|
||||
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceWorkspace.All()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return q.db.GetRunningPrebuiltWorkspacesOptimized(ctx)
|
||||
}
|
||||
|
||||
func (q *querier) GetRuntimeConfig(ctx context.Context, key string) (string, error) {
|
||||
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil {
|
||||
return "", err
|
||||
|
||||
@@ -178,8 +178,7 @@ func TestDBAuthzRecursive(t *testing.T) {
|
||||
if method.Name == "InTx" ||
|
||||
method.Name == "Ping" ||
|
||||
method.Name == "Wrappers" ||
|
||||
method.Name == "PGLocks" ||
|
||||
method.Name == "GetRunningPrebuiltWorkspacesOptimized" {
|
||||
method.Name == "PGLocks" {
|
||||
continue
|
||||
}
|
||||
// easy to know which method failed.
|
||||
|
||||
@@ -41,8 +41,6 @@ var skipMethods = map[string]string{
|
||||
"Wrappers": "Not relevant",
|
||||
"AcquireLock": "Not relevant",
|
||||
"TryAcquireLock": "Not relevant",
|
||||
// This method will be removed once we know this works correctly.
|
||||
"GetRunningPrebuiltWorkspacesOptimized": "Not relevant",
|
||||
}
|
||||
|
||||
// TestMethodTestSuite runs MethodTestSuite.
|
||||
|
||||
Reference in New Issue
Block a user