Ejemplo n.º 1
0
  public static Set<String> getAuthorizations(Vertex userVertex) {
    String authorizationsString = UserVisalloProperties.AUTHORIZATIONS.getPropertyValue(userVertex);
    if (authorizationsString == null) {
      return new HashSet<>();
    }
    String[] authorizationsArray = authorizationsString.split(",");
    if (authorizationsArray.length == 1 && authorizationsArray[0].length() == 0) {
      authorizationsArray = new String[0];
    }
    HashSet<String> authorizations = new HashSet<>();
    for (String s : authorizationsArray) {
      // Accumulo doesn't like zero length strings. they shouldn't be in the auth string to begin
      // with but this just protects from that happening.
      if (s.trim().length() == 0) {
        continue;
      }

      authorizations.add(s);
    }
    return authorizations;
  }