Skip to content

Commit f99c778

Browse files
committed
fix compile errors
1 parent bebe638 commit f99c778

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

coderd/coderd.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,13 @@ func New(options *Options) *API {
327327
Optional: true,
328328
}),
329329
// TODO: We should remove this auth context after middleware.
330-
httpmw.SystemAuthCtx,
331-
// Redirect to the login page if the user tries to open an app with
332-
// "me" as the username and they are not logged in.
333-
httpmw.ExtractUserParam(api.Database, true),
334-
// Extracts the <workspace.agent> from the url
335-
httpmw.ExtractWorkspaceAndAgentParam(api.Database),
330+
httpmw.AsAuthzSystem(
331+
// Redirect to the login page if the user tries to open an app with
332+
// "me" as the username and they are not logged in.
333+
httpmw.ExtractUserParam(api.Database, true),
334+
// Extracts the <workspace.agent> from the url
335+
httpmw.ExtractWorkspaceAndAgentParam(api.Database),
336+
),
336337
)
337338
r.HandleFunc("/*", api.workspaceAppsProxyPath)
338339
}

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestInTX(t *testing.T) {
4242
}
4343

4444
w := dbgen.Workspace(t, db, database.Workspace{})
45-
ctx := dbauthz.WithAuthorizeContext(context.Background(), actor)
45+
ctx := dbauthz.As(context.Background(), actor)
4646
err := q.InTx(func(tx database.Store) error {
4747
// The inner tx should use the parent's authz
4848
_, err := tx.GetWorkspaceByID(ctx, w.ID)
@@ -63,7 +63,7 @@ func TestNew(t *testing.T) {
6363
Wrapped: &coderdtest.FakeAuthorizer{AlwaysReturn: nil},
6464
}
6565
subj = rbac.Subject{}
66-
ctx = dbauthz.WithAuthorizeContext(context.Background(), rbac.Subject{})
66+
ctx = dbauthz.As(context.Background(), rbac.Subject{})
6767
)
6868

6969
// Double wrap should not cause an actual double wrap. So only 1 rbac call
@@ -95,7 +95,7 @@ func TestDBAuthzRecursive(t *testing.T) {
9595
}
9696
for i := 0; i < reflect.TypeOf(q).NumMethod(); i++ {
9797
var ins []reflect.Value
98-
ctx := dbauthz.WithAuthorizeContext(context.Background(), actor)
98+
ctx := dbauthz.As(context.Background(), actor)
9999

100100
ins = append(ins, reflect.ValueOf(ctx))
101101
method := reflect.TypeOf(q).Method(i)

coderd/database/dbauthz/setup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (s *MethodTestSuite) Subtest(testCaseF func(db database.Store, check *expec
113113
Groups: []string{},
114114
Scope: rbac.ScopeAll,
115115
}
116-
ctx := dbauthz.WithAuthorizeContext(context.Background(), actor)
116+
ctx := dbauthz.As(context.Background(), actor)
117117

118118
var testCase expects
119119
testCaseF(db, &testCase)

0 commit comments

Comments
 (0)