@@ -36,15 +36,15 @@ func UserParam(r *http.Request) database.User {
36
36
// parameter.
37
37
//
38
38
//nolint:revive
39
- func ExtractUserParam (db database.Store , redirectToLoginOnMe bool ) func (http.Handler ) http.Handler {
39
+ func ExtractUserParam (db database.Store ) func (http.Handler ) http.Handler {
40
40
return func (next http.Handler ) http.Handler {
41
41
return http .HandlerFunc (func (rw http.ResponseWriter , r * http.Request ) {
42
42
ctx := r .Context ()
43
43
// We need to call as SystemRestricted because this middleware is called from
44
44
// organizations/{organization}/members/{user}/ paths, and we need to allow
45
45
// org-admins to call these paths --- they might not have sitewide read permissions on users.
46
46
// nolint:gocritic
47
- user , ok := extractUserContext (dbauthz .AsSystemRestricted (ctx ), db , rw , r , redirectToLoginOnMe )
47
+ user , ok := extractUserContext (dbauthz .AsSystemRestricted (ctx ), db , rw , r )
48
48
if ! ok {
49
49
// response already handled
50
50
return
@@ -56,7 +56,7 @@ func ExtractUserParam(db database.Store, redirectToLoginOnMe bool) func(http.Han
56
56
}
57
57
58
58
// extractUserContext queries the database for the parameterized `{user}` from the request URL.
59
- func extractUserContext (ctx context.Context , db database.Store , rw http.ResponseWriter , r * http.Request , redirectToLoginOnMe bool ) (user database.User , ok bool ) {
59
+ func extractUserContext (ctx context.Context , db database.Store , rw http.ResponseWriter , r * http.Request ) (user database.User , ok bool ) {
60
60
// userQuery is either a uuid, a username, or 'me'
61
61
userQuery := chi .URLParam (r , "user" )
62
62
if userQuery == "" {
@@ -69,11 +69,6 @@ func extractUserContext(ctx context.Context, db database.Store, rw http.Response
69
69
if userQuery == "me" {
70
70
apiKey , ok := APIKeyOptional (r )
71
71
if ! ok {
72
- if redirectToLoginOnMe {
73
- RedirectToLogin (rw , r , nil , SignedOutErrorMessage )
74
- return database.User {}, false
75
- }
76
-
77
72
httpapi .Write (ctx , rw , http .StatusBadRequest , codersdk.Response {
78
73
Message : "Cannot use \" me\" without a valid session." ,
79
74
})
0 commit comments