IndexController.java 文件源码

java
阅读 82 收藏 0 点赞 0 评论 0

项目:timesheet-upload 作者:
@GetMapping("/settings")
public String settings(HttpSession session, Model model) {
    log.info("Inside settings method of IndexController");
    Employee employee = (Employee) session.getAttribute("user");
    //Check if the employee object exist in the session.
    if (employee == null) {
        log.error("Cannot find employee object in the session, so forwarding to Login page");
        model.addAttribute("css", "danger");
        model.addAttribute("msg", "Your session expired, please login to continue!!");
        return "redirect:/login";
    }
    //Check for employee role and forward to corresponding page.
    if (employee.isEmployeeRole()) {
        return "employee/settings";
    } else if (employee.isSupervisorRole()) {
        return "staff/settings";
    } else if (employee.isAdminRole()) {
        return "staff/settings";
    } else {
        log.error("Cannot validate the role. Redirecting to the Login page.");
        model.addAttribute("css", "danger");
        model.addAttribute("msg", "Cannot validate the role, please login to continue!!");
        return "redirect:/login";
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号