use of org.vertexium.security.VisibilityEvaluator in project vertexium by visallo.
the class VisibilityUtils method canRead.
public static boolean canRead(String visibility, String[] authorizations) {
VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(new Authorizations(authorizations));
ColumnVisibility columnVisibility = new ColumnVisibility(visibility);
try {
return visibilityEvaluator.evaluate(columnVisibility);
} catch (VisibilityParseException ex) {
throw new RuntimeException("could not evaluate visibility " + visibility, ex);
}
}
use of org.vertexium.security.VisibilityEvaluator in project vertexium by visallo.
the class InMemoryAuthorizations method canRead.
@Override
public boolean canRead(Visibility visibility) {
Preconditions.checkNotNull(visibility, "visibility is required");
// this is just a shortcut so that we don't need to construct evaluators and visibility objects to check for an empty string.
if (visibility.getVisibilityString().length() == 0) {
return true;
}
VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(new Authorizations(this.getAuthorizations()));
ColumnVisibility columnVisibility = new ColumnVisibility(visibility.getVisibilityString());
try {
return visibilityEvaluator.evaluate(columnVisibility);
} catch (VisibilityParseException e) {
throw new VertexiumException("could not evaluate visibility " + visibility.getVisibilityString(), e);
}
}
Aggregations