Wire up events for creating new public reports

This involved moving a lot of stuff to the platform layer since I don't
want event interfaces leaking out.

Also this includes a fix to the user authentication which I had
previously broken by making a platform-layer user object independent of
the database layer.
This commit is contained in:
Eli Ribble 2026-03-13 17:33:39 +00:00
parent 9a5cc4cf97
commit e8d865d0ab
No known key found for this signature in database
24 changed files with 915 additions and 541 deletions

View file

@ -84,3 +84,19 @@ func postSudoSMS(ctx context.Context, r *http.Request, u platform.User, sms Form
}
return "/sudo", nil
}
type FormSSE struct {
Content string `schema:"content"`
OrganizationID int32 `schema:"organizationID"`
}
func postSudoSSE(ctx context.Context, r *http.Request, u platform.User, sse FormSSE) (string, *nhttp.ErrorWithStatus) {
if !u.HasRoot() {
return "", &nhttp.ErrorWithStatus{
Message: "You must have sudo powers to do this",
Status: http.StatusForbidden,
}
}
platform.SudoEvent(sse.OrganizationID, sse.Content)
return "/sudo", nil
}