Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! Merge branch 'main' into dean/app-sharing
  • Loading branch information
deansheather committed Oct 12, 2022
commit 89a75d0414f705f0f438ccd2cbed612cf7bc7931
1 change: 0 additions & 1 deletion coderd/httpmw/apikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,5 +427,4 @@ func RedirectToLogin(rw http.ResponseWriter, r *http.Request, message string) {
}

http.Redirect(rw, r, u.String(), http.StatusTemporaryRedirect)
return
}
2 changes: 2 additions & 0 deletions coderd/httpmw/userparam.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func UserParam(r *http.Request) database.User {

// ExtractUserParam extracts a user from an ID/username in the {user} URL
// parameter.
//
//nolint:revive
func ExtractUserParam(db database.Store, redirectToLoginOnMe bool) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
Expand Down
18 changes: 9 additions & 9 deletions coderd/workspaceapps.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ func (api *API) workspaceAppsProxyPath(rw http.ResponseWriter, r *http.Request)
return
}

AppSharingLevel := database.AppSharingLevelOwner
appSharingLevel := database.AppSharingLevelOwner
if app.SharingLevel != "" {
AppSharingLevel = app.SharingLevel
appSharingLevel = app.SharingLevel
}
authed, ok := api.fetchWorkspaceApplicationAuth(rw, r, workspace, AppSharingLevel)
authed, ok := api.fetchWorkspaceApplicationAuth(rw, r, workspace, appSharingLevel)
if !ok {
return
}
Expand Down Expand Up @@ -191,11 +191,11 @@ func (api *API) handleSubdomainApplications(middlewares ...func(http.Handler) ht

// Verify application auth. This function will redirect or
// return an error page if the user doesn't have permission.
SharingLevel := database.AppSharingLevelOwner
sharingLevel := database.AppSharingLevelOwner
if workspaceAppPtr != nil && workspaceAppPtr.SharingLevel != "" {
SharingLevel = workspaceAppPtr.SharingLevel
sharingLevel = workspaceAppPtr.SharingLevel
}
if !api.verifyWorkspaceApplicationSubdomainAuth(rw, r, host, workspace, SharingLevel) {
if !api.verifyWorkspaceApplicationSubdomainAuth(rw, r, host, workspace, sharingLevel) {
return
}

Expand Down Expand Up @@ -598,11 +598,11 @@ type proxyApplication struct {
func (api *API) proxyWorkspaceApplication(proxyApp proxyApplication, rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()

SharingLevel := database.AppSharingLevelOwner
sharingLevel := database.AppSharingLevelOwner
if proxyApp.App != nil && proxyApp.App.SharingLevel != "" {
SharingLevel = proxyApp.App.SharingLevel
sharingLevel = proxyApp.App.SharingLevel
}
if !api.checkWorkspaceApplicationAuth(rw, r, proxyApp.Workspace, SharingLevel) {
if !api.checkWorkspaceApplicationAuth(rw, r, proxyApp.Workspace, sharingLevel) {
return
}

Expand Down
4 changes: 2 additions & 2 deletions enterprise/coderd/workspaceagents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func setupWorkspaceAgent(t *testing.T, client *codersdk.Client, user codersdk.Cr
defer cancel()

resources := coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
agent, err := client.WorkspaceAgent(ctx, resources[0].Agents[0].ID)
agnt, err := client.WorkspaceAgent(ctx, resources[0].Agents[0].ID)
require.NoError(t, err)

return workspace, agent
return workspace, agnt
}