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.
|
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
|
|
func (r *Router) handleClearLinkLogs(w http.ResponseWriter, req *http.Request) {
|
|
|
|
|
ctx, ok := r.authorizeCommand(w, req, commandSpec{Action: "log.links.clear", Target: "links", 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.ClearLinkLogs(ctx)
|
|
|
|
|
writeResult(w, result, err)
|
|
|
|
|
}
|