Esempio n. 1
0
  @RequestMapping(value = "{type}/create", method = RequestMethod.POST)
  public String createWithType(
      Model model,
      @RequestParam(value = "userIds", required = false) Long[] userIds,
      @RequestParam(value = "groupIds", required = false) Long[] groupIds,
      @RequestParam(value = "organizationIds", required = false) Long[] organizationIds,
      @RequestParam(value = "jobIds", required = false) Long[][] jobIds,
      @Valid @ModelAttribute("m") Auth m,
      BindingResult result,
      RedirectAttributes redirectAttributes) {

    this.permissionList.assertHasCreatePermission();

    if (hasError(m, result)) {
      return showCreateForm(model);
    }

    if (m.getType() == AuthType.user) {
      authService.addUserAuth(userIds, m);
    } else if (m.getType() == AuthType.user_group || m.getType() == AuthType.organization_group) {
      authService.addGroupAuth(groupIds, m);
    } else if (m.getType() == AuthType.organization_job) {
      authService.addOrganizationJobAuth(organizationIds, jobIds, m);
    }
    redirectAttributes.addFlashAttribute(Constants.MESSAGE, "新增成功");
    return redirectToUrl("/admin/sys/auth?search.type_eq=" + m.getType());
  }
Esempio n. 2
0
 @RequestMapping(value = "{type}/create", method = RequestMethod.GET)
 public String showCreateFormWithType(@PathVariable("type") AuthType type, Model model) {
   Auth auth = new Auth();
   auth.setType(type);
   model.addAttribute("m", auth);
   return super.showCreateForm(model);
 }