Allow sudo to send structured SSEs
This commit is contained in:
parent
be1e49e524
commit
6fb964852f
4 changed files with 53 additions and 10 deletions
|
|
@ -86,8 +86,10 @@ func postSudoSMS(ctx context.Context, r *http.Request, u platform.User, sms Form
|
|||
}
|
||||
|
||||
type FormSSE struct {
|
||||
Content string `schema:"content"`
|
||||
OrganizationID int32 `schema:"organizationID"`
|
||||
Resource string `schema:"resource"`
|
||||
Type string `schema:"type"`
|
||||
URIPath string `schema:"uriPath"`
|
||||
}
|
||||
|
||||
func postSudoSSE(ctx context.Context, r *http.Request, u platform.User, sse FormSSE) (string, *nhttp.ErrorWithStatus) {
|
||||
|
|
@ -97,6 +99,6 @@ func postSudoSSE(ctx context.Context, r *http.Request, u platform.User, sse Form
|
|||
Status: http.StatusForbidden,
|
||||
}
|
||||
}
|
||||
platform.SudoEvent(sse.OrganizationID, sse.Content)
|
||||
platform.SudoEvent(sse.OrganizationID, sse.Resource, sse.Type, sse.URIPath)
|
||||
return "/sudo", nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue