Restore api role access in SecurityCheck

This commit is contained in:
2023-06-20 12:54:26 +02:00
parent 25acb2eaa5
commit c973a29734
2 changed files with 5 additions and 6 deletions

View File

@@ -192,6 +192,7 @@ func decode(r io.Reader, val interface{}) error {
// @security ApiKeyAuth
// @router /jobs/ [get]
func (api *RestApi) getJobs(rw http.ResponseWriter, r *http.Request) {
if user := auth.GetUser(r.Context()); user != nil && !user.HasRole(auth.RoleApi) {
handleError(fmt.Errorf("missing role: %v", auth.GetRoleString(auth.RoleApi)), http.StatusForbidden, rw)
return