List of usage examples for javax.servlet.http HttpServletRequest isUserInRole
public boolean isUserInRole(String role);
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = { "status" }) public String status(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { List<FireFighterStatusModel> statuss = statusRepository.findAll(); model.addAttribute("statuss", statuss); }// ww w . j a v a 2 s .c o m return "status"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = { "funktionen" }) public String funktionen(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { List<FireEngineAbbreviationModel> fireEngineAbbreviations = fireEngineAbbreviationRepository.findAll(); model.addAttribute("fireEngineAbbreviations", fireEngineAbbreviations); }/*w w w .j a v a2s. c o m*/ return "funktionen"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = { "dienstgrade" }) public String dienstgrade(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { List<RankModel> ranks = rankRepository.findAll(); model.addAttribute("ranks", ranks); }// www .j a v a 2 s.c om return "dienstgrade"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = { "mitglieder" }) public String mitglieder(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { List<FireFighterModel> fireFighters = fireFighterRepository.findAll(); model.addAttribute("fireFighters", fireFighters); } else {//from w w w .j av a 2 s . c o m List<FireFighterModel> fireFighters = fireFighterRepository.findByFireBrigade(getSessionFireBrigade()); model.addAttribute("fireFighters", fireFighters); } return "mitglieder"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = { "fahrzeuge" }) public String fahrzeuge(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { List<FireEngineModel> fireEngines = fireEngineRepository.findAll(); model.addAttribute("fireEngines", fireEngines); } else {//w ww.j av a2 s .c o m List<FireEngineModel> fireEngines = fireEngineRepository.findByFireBrigade(getSessionFireBrigade()); model.addAttribute("fireEngines", fireEngines); } return "fahrzeuge"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@Transactional @RequestMapping("deleteFireEngine") public String deleteFireEngine(Model model, @RequestParam int id, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { fireEngineRepository.delete(id); } else {//from w ww .j ava 2s . com fireEngineRepository.deleteByFireBrigadeAndId(getSessionFireBrigade(), id); } return "forward:fahrzeuge"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@ModelAttribute public void addAttributes(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { model.addAttribute("count", messageRepository.countByRole("admin")); } else if (request.isUserInRole("ROLE_ADMIN")) { model.addAttribute("count", messageRepository.countByFireBrigadeAndRole(getSessionFireBrigade(), "user")); } else {/*from w ww .ja v a2s . c o m*/ } }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = { "feuerwehr" }) public String feuerwehr(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { List<FireBrigadeModel> fireBrigades = fireBrigadeRepository.findAll(); model.addAttribute("fireBrigades", fireBrigades); } else {// www. j a va 2 s . c o m FireBrigadeModel fireBrigade = fireBrigadeRepository.findById(getSessionFireBrigade().getId()); model.addAttribute("fireBrigades", fireBrigade); } return "feuerwehr"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = { "nachrichten" }) public String nachrichten(Model model, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { List<MessageModel> messages = messageRepository.findByRole("admin"); model.addAttribute("messages", messages); } else {/* ww w . j a va2 s. c om*/ List<MessageModel> messages = messageRepository.findByFireBrigadeAndRole(getSessionFireBrigade(), "user"); model.addAttribute("messages", messages); } // model.addAttribute("count", fireBrigades.size()); return "nachrichten"; }
From source file:at.fh.swenga.firefighters.controller.FireFighterController.java
@RequestMapping(value = "editFireBrigade", method = RequestMethod.GET) public String showEditFireBrigade(Model model, @RequestParam int id, HttpServletRequest request) { if (request.isUserInRole("ROLE_GLOBAL_ADMIN")) { FireBrigadeModel fireBrigade = fireBrigadeRepository.findById(id); if (fireBrigade != null) { model.addAttribute("fireBrigade", fireBrigade); return "editFireBrigade"; } else {// ww w .j a v a2 s.co m model.addAttribute("errorMessage", "Feuerwehr mit der ID " + id + " konnte nicht gefunden werden."); return "forward:feuerwehr"; } } else { FireBrigadeModel fireBrigade = fireBrigadeRepository.findByIdAndName(id, getSessionFireBrigade().getName()); if (fireBrigade != null) { model.addAttribute("fireBrigade", fireBrigade); return "editFireBrigade"; } else { model.addAttribute("errorMessage", "Feuerwehr mit der ID " + id + " konnte nicht gefunden werden."); return "forward:feuerwehr"; } } }