agent: avoid masking errors when ACLs deny a request

This commit is contained in:
Ryan Uber 2015-06-18 17:34:35 -07:00
parent beb27fb3ef
commit 5bde81bcdc
1 changed files with 7 additions and 3 deletions

View File

@ -62,9 +62,13 @@ func (s *HTTPServer) EventFire(resp http.ResponseWriter, req *http.Request) (int
// Try to fire the event // Try to fire the event
if err := s.agent.UserEvent(dc, token, event); err != nil { if err := s.agent.UserEvent(dc, token, event); err != nil {
resp.WriteHeader(403) if strings.Contains(err.Error(), permissionDenied) {
resp.Write([]byte(permissionDenied)) resp.WriteHeader(403)
return nil, nil resp.Write([]byte(permissionDenied))
return nil, nil
}
resp.WriteHeader(500)
return nil, err
} }
// Return the event // Return the event