mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
refactor: Return the display_name and name in the roles endpoint (#1328)
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/coder/coder/coderd/httpmw"
|
||||
"github.com/coder/coder/codersdk"
|
||||
|
||||
"github.com/coder/coder/coderd/httpapi"
|
||||
"github.com/coder/coder/coderd/rbac"
|
||||
@ -14,7 +15,7 @@ func (*api) assignableSiteRoles(rw http.ResponseWriter, _ *http.Request) {
|
||||
// TODO: @emyrk in the future, allow granular subsets of roles to be returned based on the
|
||||
// role of the user.
|
||||
roles := rbac.SiteRoles()
|
||||
httpapi.Write(rw, http.StatusOK, roles)
|
||||
httpapi.Write(rw, http.StatusOK, codersdk.ConvertRoles(roles))
|
||||
}
|
||||
|
||||
// assignableSiteRoles returns all site wide roles that can be assigned.
|
||||
@ -23,5 +24,5 @@ func (*api) assignableOrgRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
// role of the user.
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
roles := rbac.OrganizationRoles(organization.ID)
|
||||
httpapi.Write(rw, http.StatusOK, roles)
|
||||
httpapi.Write(rw, http.StatusOK, codersdk.ConvertRoles(roles))
|
||||
}
|
||||
|
Reference in New Issue
Block a user