コード例 #1
0
  public String input() {
    if (userText != null) {
      for (String str : userText.split("\n")) {
        str = str.trim();

        if (str.length() == 0) {
          continue;
        }

        String username = str;
        UserDTO userDto = userConnector.findByUsername(username, ScopeHolder.getUserRepoRef());

        if (userDto == null) {
          addActionMessage(str + " is not exists.");
        } else {
          UserStatus userStatus =
              authService.createOrGetUserStatus(
                  username,
                  userDto.getId(),
                  ScopeHolder.getUserRepoRef(),
                  ScopeHolder.getScopeId());

          try {
            userStatusChecker.check(userStatus);
            userStatuses.add(userStatus);
          } catch (CheckUserStatusException ex) {
            addActionMessage(ex.getMessage());
          }
        }
      }
    }

    roles = roleManager.find("from Role where scopeId=?", ScopeHolder.getScopeId());
    roleDtos.addAll(convertRoleDtos(roles, false));

    List<ScopeInfo> sharedScopeInfos = scopeConnector.findSharedScopes();

    logger.info("{}", sharedScopeInfos);

    for (ScopeInfo scopeInfo : sharedScopeInfos) {
      List<Role> sharedRoles = authService.findRoles(scopeInfo.getId());
      roleDtos.addAll(convertRoleDtos(sharedRoles, true));
    }

    return INPUT;
  }
コード例 #2
0
  public String save() {
    logger.debug("userIds: {}, roleIds: {}", userIds, roleIds);

    for (Long userId : userIds) {
      authService.configUserRole(
          userId, roleIds, ScopeHolder.getUserRepoRef(), ScopeHolder.getScopeId(), false);
    }

    return RELOAD;
  }
コード例 #3
0
  @RequestMapping("user-statuc-batch-save")
  public String save(
      @RequestParam("userIds") List<Long> userIds, @RequestParam("roleIds") List<Long> roleIds) {
    logger.debug("userIds: {}, roleIds: {}", userIds, roleIds);

    for (Long userId : userIds) {
      authService.configUserRole(
          userId, roleIds, tenantHolder.getUserRepoRef(), tenantHolder.getTenantId(), false);
    }

    return "redirect:/auth/user-status-batch-input.do";
  }