feat: Allow admins to access member workspace terminals (#2114)

* allow workspace update permissions to access agents

* do not show app links to users without workspace update access

* address CR comments

* initialize machine context in the hook

* revert scoped connected status check
This commit is contained in:
Abhineet Jain
2022-06-10 10:46:48 -04:00
committed by GitHub
parent 0260e39d11
commit 953e8c8fe6
11 changed files with 168 additions and 51 deletions

View File

@ -37,11 +37,11 @@ type userRolesKey struct{}
// AuthorizationUserRoles returns the roles used for authorization.
// Comes from the ExtractAPIKey handler.
func AuthorizationUserRoles(r *http.Request) database.GetAuthorizationUserRolesRow {
apiKey, ok := r.Context().Value(userRolesKey{}).(database.GetAuthorizationUserRolesRow)
userRoles, ok := r.Context().Value(userRolesKey{}).(database.GetAuthorizationUserRolesRow)
if !ok {
panic("developer error: user roles middleware not provided")
}
return apiKey
return userRoles
}
// OAuth2Configs is a collection of configurations for OAuth-based authentication.