use of com.erudika.para.core.Webhook in project scoold by Erudika.
the class AdminController method deleteWebhook.
@PostMapping("/delete-webhook")
public String deleteWebhook(@RequestParam String id, HttpServletRequest req, HttpServletResponse res) {
Profile authUser = utils.getAuthUser(req);
if (!StringUtils.isBlank(id) && utils.isAdmin(authUser) && utils.isWebhooksEnabled()) {
Webhook webhook = new Webhook();
webhook.setId(id);
pc.delete(webhook);
}
if (utils.isAjaxRequest(req)) {
res.setStatus(200);
return "base";
} else {
return "redirect:" + ADMINLINK;
}
}
use of com.erudika.para.core.Webhook in project scoold by Erudika.
the class ApiController method deleteWebhook.
@DeleteMapping("/webhooks/{id}")
public void deleteWebhook(@PathVariable String id, HttpServletRequest req, HttpServletResponse res) {
if (!utils.isWebhooksEnabled()) {
res.setStatus(HttpStatus.FORBIDDEN.value());
}
Webhook webhook = pc.read(id);
if (webhook == null) {
res.setStatus(HttpStatus.NOT_FOUND.value());
return;
}
pc.delete(webhook);
}
Aggregations