Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8757451

Browse files
committed
fix: Allow fetching of non-personal workspaces (#1495)
RBAC should cover this anyways!
1 parent6bf6f8e commit8757451

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

‎coderd/httpmw/workspaceparam.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ func ExtractWorkspaceParam(db database.Store) func(http.Handler) http.Handler {
4444
return
4545
}
4646

47-
apiKey:=APIKey(r)
48-
ifapiKey.UserID!=workspace.OwnerID {
49-
httpapi.Write(rw,http.StatusUnauthorized, httpapi.Response{
50-
Message:"getting non-personal workspaces isn't supported",
51-
})
52-
return
53-
}
54-
5547
ctx:=context.WithValue(r.Context(),workspaceParamContextKey{},workspace)
5648
next.ServeHTTP(rw,r.WithContext(ctx))
5749
})

‎coderd/httpmw/workspaceparam_test.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,6 @@ func TestWorkspaceParam(t *testing.T) {
9292
require.Equal(t,http.StatusNotFound,res.StatusCode)
9393
})
9494

95-
t.Run("NonPersonal",func(t*testing.T) {
96-
t.Parallel()
97-
db:=databasefake.New()
98-
rtr:=chi.NewRouter()
99-
rtr.Use(
100-
httpmw.ExtractAPIKey(db,nil),
101-
httpmw.ExtractWorkspaceParam(db),
102-
)
103-
rtr.Get("/",nil)
104-
r,_:=setup(db)
105-
workspace,err:=db.InsertWorkspace(context.Background(), database.InsertWorkspaceParams{
106-
ID:uuid.New(),
107-
OwnerID:uuid.New(),
108-
Name:"hello",
109-
})
110-
require.NoError(t,err)
111-
chi.RouteContext(r.Context()).URLParams.Add("workspace",workspace.ID.String())
112-
rw:=httptest.NewRecorder()
113-
rtr.ServeHTTP(rw,r)
114-
115-
res:=rw.Result()
116-
deferres.Body.Close()
117-
require.Equal(t,http.StatusUnauthorized,res.StatusCode)
118-
})
119-
12095
t.Run("Found",func(t*testing.T) {
12196
t.Parallel()
12297
db:=databasefake.New()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp