MCPcopy Index your code
hub / github.com/coder/coder / convertToTemplateRole

Function convertToTemplateRole

enterprise/coderd/templates.go:336–345  ·  view source on GitHub ↗
(actions []policy.Action)

Source from the content-addressed store, hash-verified

334}
335
336func convertToTemplateRole(actions []policy.Action) codersdk.TemplateRole {
337 switch {
338 case slice.SameElements(actions, db2sdk.TemplateRoleActions(codersdk.TemplateRoleAdmin)):
339 return codersdk.TemplateRoleAdmin
340 case slice.SameElements(actions, db2sdk.TemplateRoleActions(codersdk.TemplateRoleUse)):
341 return codersdk.TemplateRoleUse
342 }
343
344 return codersdk.TemplateRoleDeleted
345}
346
347// TODO move to api.RequireFeatureMW when we are OK with changing the behavior.
348func (api *API) templateRBACEnabledMW(next http.Handler) http.Handler {

Callers 2

templateACLMethod · 0.85
convertTemplateUsersFunction · 0.85

Calls 2

SameElementsFunction · 0.92
TemplateRoleActionsFunction · 0.92

Tested by

no test coverage detected