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

Commitda23bf5

Browse files
committed
only allow me on users
1 parentf1a33dc commitda23bf5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

‎coderd/httpmw/httpmw.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func parseUUID(rw http.ResponseWriter, r *http.Request, param string) (uuid.UUID
2121
}
2222

2323
// Automatically set uuid.Nil to the acting users id.
24-
ifrawID=="me" {
24+
ifparam==UserKey&&rawID=="me" {
2525
key:=APIKey(r)
2626
returnkey.UserID,true
2727
}

‎coderd/httpmw/userparam.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"github.com/coder/coder/coderd/httpapi"
1010
)
1111

12+
constUserKey="user"
13+
1214
typeuserParamContextKeystruct{}
1315

1416
// UserParam returns the user from the ExtractUserParam handler.
@@ -24,7 +26,7 @@ func UserParam(r *http.Request) database.User {
2426
funcExtractUserParam(db database.Store)func(http.Handler) http.Handler {
2527
returnfunc(next http.Handler) http.Handler {
2628
returnhttp.HandlerFunc(func(rw http.ResponseWriter,r*http.Request) {
27-
userID,ok:=parseUUID(rw,r,"user")
29+
userID,ok:=parseUUID(rw,r,UserKey)
2830
if!ok {
2931
return
3032
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp