You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
529 B

package api
import "net/http"
func (r *Router) handleClearSystemLogs(w http.ResponseWriter, req *http.Request) {
ctx, ok := r.authorizeCommand(w, req, commandSpec{Action: "log.system.clear", Target: "system", Permission: "log.clear"})
if !ok {
return
}
var body struct {
Password string `json:"password"`
}
if ok, _ := decodeJSONBody(w, req, &body, false); !ok {
return
}
if !r.verifyCurrentPassword(w, ctx, body.Password) {
return
}
result, err := r.store.ClearSystemLogs(ctx)
writeResult(w, result, err)
}