org.apache.accumulo.core.security.VisibilityParseException Java Examples

The following examples show how to use org.apache.accumulo.core.security.VisibilityParseException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecureEventSequenceFileRecordReader.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
    boolean result;
    do {
        result = super.nextKeyValue();
        if (!result)
            break;
        // Need to create a Key from the Event
        RawRecordContainerImpl e = (RawRecordContainerImpl) this.getCurrentValue();
        if (null != e) {
            ColumnVisibility colviz = e.getVisibility();
            if (null != colviz && colviz.getParseTree() != null) {
                try {
                    result = filter.evaluate(colviz);
                } catch (VisibilityParseException e1) {
                    throw new IOException("Error evaluating column visibility: " + colviz, e1);
                }
            } else {
                // Event has no column visibility, should not return it.
                result = false;
            }
        }
    } while (!result);
    
    return result;
}
 
Example #2
Source File: DocumentVisibilityUtil.java    From rya with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if the user's authorizations allows them to have access to the
 * provided document based on its document visibility.
 * @param authorizations the {@link Authorizations}.
 * @param documentVisibility the {@link DocumentVisibility}.
 * @param doesEmptyAccessPass {@code true} if an empty authorization pass
 * allows access to everything. {@code false} otherwise.
 * @return {@code true} if the user has access to the document.
 * {@code false} otherwise.
 */
public static boolean doesUserHaveDocumentAccess(final Authorizations authorizations, final DocumentVisibility documentVisibility, final boolean doesEmptyAccessPass) {
    final Authorizations userAuths = authorizations != null ? authorizations : MongoDbRdfConstants.ALL_AUTHORIZATIONS;
    final VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(userAuths);
    boolean accept = false;
    if (doesEmptyAccessPass && MongoDbRdfConstants.ALL_AUTHORIZATIONS.equals(userAuths)) {
        accept = true;
    } else {
        try {
            accept = visibilityEvaluator.evaluate(documentVisibility);
        } catch (final VisibilityParseException e) {
            log.error("Could not parse document visibility.");
        }
    }

    return accept;
}
 
Example #3
Source File: VisibilityFilter.java    From timely with Apache License 2.0 5 votes vote down vote up
protected boolean accept(ColumnVisibility visibility) {

        Boolean b = (Boolean) cache.get(visibility);
        if (b != null)
            return b;

        try {
            Boolean bb = ve.evaluate(visibility);
            cache.put(visibility, bb);
            return bb;
        } catch (VisibilityParseException | BadArgumentException e) {
            log.error("Parse Error", e);
            return false;
        }
    }