2019-05-24 06:04:58 +00:00
|
|
|
package roles
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
httperror "github.com/portainer/libhttp/error"
|
|
|
|
"github.com/portainer/libhttp/response"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GET request on /api/Role
|
|
|
|
func (handler *Handler) roleList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
2020-05-20 05:23:15 +00:00
|
|
|
roles, err := handler.DataStore.Role().Roles()
|
2019-05-24 06:04:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve authorization sets from the database", err}
|
|
|
|
}
|
|
|
|
|
|
|
|
return response.JSON(w, roles)
|
|
|
|
}
|