Search in sources :

Example 6 with Report

use of com.erudika.scoold.core.Report in project scoold by Erudika.

the class ReportsController method delete.

@PostMapping("/{id}/delete")
public String delete(@PathVariable String id, HttpServletRequest req, HttpServletResponse res) {
    if (utils.isAuthenticated(req)) {
        Profile authUser = utils.getAuthUser(req);
        Report rep = pc.read(id);
        if (rep != null && utils.isAdmin(authUser)) {
            rep.delete();
        }
    }
    if (!utils.isAjaxRequest(req)) {
        return "redirect:" + reportslink;
    }
    return "base";
}
Also used : Report(com.erudika.scoold.core.Report) Profile(com.erudika.scoold.core.Profile) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

Report (com.erudika.scoold.core.Report)6 Profile (com.erudika.scoold.core.Profile)4 PostMapping (org.springframework.web.bind.annotation.PostMapping)4 ParaObject (com.erudika.para.core.ParaObject)1 Pager (com.erudika.para.utils.Pager)1 Comment (com.erudika.scoold.core.Comment)1 Post (com.erudika.scoold.core.Post)1 Map (java.util.Map)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1