mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore: merge authorization contexts (#12816)
* chore: merge authorization contexts Instead of 2 auth contexts from apikey and dbauthz, merge them to just use dbauthz. It is annoying to have two. * fixup authorization reference
This commit is contained in:
@ -476,8 +476,8 @@ type API struct {
|
||||
//
|
||||
// This header is used by the CLI to display warnings to the user without having
|
||||
// to make additional requests!
|
||||
func (api *API) writeEntitlementWarningsHeader(a httpmw.Authorization, header http.Header) {
|
||||
roles, err := a.Actor.Roles.Expand()
|
||||
func (api *API) writeEntitlementWarningsHeader(a rbac.Subject, header http.Header) {
|
||||
roles, err := a.Roles.Expand()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ func (p *provisionerDaemonAuth) authorize(r *http.Request, tags map[string]strin
|
||||
return tags, true
|
||||
}
|
||||
ua := httpmw.UserAuthorization(r)
|
||||
if err := p.authorizer.Authorize(ctx, ua.Actor, rbac.ActionCreate, rbac.ResourceProvisionerDaemon); err == nil {
|
||||
if err := p.authorizer.Authorize(ctx, ua, rbac.ActionCreate, rbac.ResourceProvisionerDaemon); err == nil {
|
||||
// User is allowed to create provisioner daemons
|
||||
return tags, true
|
||||
}
|
||||
|
Reference in New Issue
Block a user