コード例 #1
0
 @RequestMapping(value = MappingConstants.USER_LIST, method = RequestMethod.GET)
 @PreAuthorize("hasRole('" + PermissionConstants.ADMIN_USER_LIST + "')")
 public String displayUserList(
     Model model, @AuthenticationPrincipal CustomUserDetails userDetails) {
   languageDelegate.addAvailableLanguages(model);
   languageDelegate.addNotAvailableLanguages(model);
   model.addAttribute(
       AUTHENTICATED_USER_FIRST_NAME, userDetails != null ? userDetails.getFirstName() : null);
   return ViewConstants.ADMIN + "/" + ViewConstants.USER_LIST;
 }
コード例 #2
0
 @RequestMapping(value = MappingConstants.ARTICLE, method = RequestMethod.GET)
 @PreAuthorize("hasRole('" + PermissionConstants.ADMIN_CREATE_ARTICLE + "')")
 public String createArticleForm(
     Model model,
     Locale locale,
     @AuthenticationPrincipal CustomUserDetails userDetails,
     @RequestParam(required = false, value = "id") Long articleId) {
   languageDelegate.addAvailableLanguages(model);
   languageDelegate.addNotAvailableLanguages(model);
   if (articleId != null) {
     Optional<Article> article = articleService.find(articleId, locale.getLanguage());
     if (article.isPresent()) {
       model.addAttribute("article", article.get());
     }
   }
   model.addAttribute(
       AUTHENTICATED_USER_FIRST_NAME, userDetails != null ? userDetails.getFirstName() : null);
   return ViewConstants.ADMIN + "/" + ViewConstants.CREATE_ARTICLE;
 }