Ejemplo n.º 1
0
 public List<String> selectGroupPermissions(String groupName, @Nullable Long resourceId) {
   SqlSession session = mybatis.openSession(false);
   RoleMapper mapper = session.getMapper(RoleMapper.class);
   try {
     return mapper.selectGroupPermissions(
         groupName, resourceId, DefaultGroups.isAnyone(groupName));
   } finally {
     MyBatis.closeQuietly(session);
   }
 }
  Long getGroupId() {
    if (DefaultGroups.isAnyone(updatedReference)) {
      return null;
    }

    DbSession dbSession = dbClient.openSession(false);
    try {
      GroupDto groupDto = dbClient.groupDao().selectByName(dbSession, updatedReference);
      if (groupDto == null) {
        throw new BadRequestException("Unknown group: " + updatedReference);
      }
      return groupDto.getId();
    } finally {
      dbClient.closeSession(dbSession);
    }
  }