@@ -17,7 +17,6 @@ import (
17
17
"golang.org/x/xerrors"
18
18
19
19
"github.com/coder/coder/coderd"
20
- "github.com/coder/coder/coderd/database/dbfake"
21
20
"github.com/coder/coder/coderd/rbac"
22
21
"github.com/coder/coder/coderd/rbac/regosql"
23
22
"github.com/coder/coder/codersdk"
@@ -26,12 +25,6 @@ import (
26
25
)
27
26
28
27
func AGPLRoutes (a * AuthTester ) (map [string ]string , map [string ]RouteCheck ) {
29
- // For any route using SQL filters, we need to know if the database is an
30
- // in memory fake. This is because the in memory fake does not use SQL, and
31
- // still uses rego. So this boolean indicates how to assert the expected
32
- // behavior.
33
- _ , isMemoryDB := a .api .Database .(dbfake.FakeDatabase )
34
-
35
28
// Some quick reused objects
36
29
workspaceRBACObj := rbac .ResourceWorkspace .WithID (a .Workspace .ID ).InOrg (a .Organization .ID ).WithOwner (a .Workspace .OwnerID .String ())
37
30
workspaceExecObj := rbac .ResourceWorkspaceExecution .WithID (a .Workspace .ID ).InOrg (a .Organization .ID ).WithOwner (a .Workspace .OwnerID .String ())
@@ -265,16 +258,17 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) {
265
258
"POST:/api/v2/workspaces/{workspace}/builds" : {StatusCode : http .StatusBadRequest , NoAuthorize : true },
266
259
"POST:/api/v2/organizations/{organization}/templateversions" : {StatusCode : http .StatusBadRequest , NoAuthorize : true },
267
260
268
- // Endpoints that use the SQLQuery filter.
261
+ // For any route using SQL filters, we do not check authorization.
262
+ // This is because the in memory fake does not use SQL.
269
263
"GET:/api/v2/workspaces/" : {
270
264
StatusCode : http .StatusOK ,
271
- NoAuthorize : ! isMemoryDB ,
265
+ NoAuthorize : true ,
272
266
AssertAction : rbac .ActionRead ,
273
267
AssertObject : rbac .ResourceWorkspace ,
274
268
},
275
269
"GET:/api/v2/organizations/{organization}/templates" : {
276
270
StatusCode : http .StatusOK ,
277
- NoAuthorize : ! isMemoryDB ,
271
+ NoAuthorize : true ,
278
272
AssertAction : rbac .ActionRead ,
279
273
AssertObject : rbac .ResourceTemplate ,
280
274
},
0 commit comments