[ 
https://issues.apache.org/jira/browse/RYA-119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15705859#comment-15705859
 ] 

ASF GitHub Bot commented on RYA-119:
------------------------------------

Github user ejwhite922 commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/124#discussion_r90055207
  
    --- Diff: 
dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBRyaDAO.java ---
    @@ -164,26 +174,31 @@ public void add(final Iterator<RyaStatement> 
statement) throws RyaDAOException {
             final List<DBObject> dbInserts = new ArrayList<DBObject>();
             while (statement.hasNext()){
                 final RyaStatement ryaStatement = statement.next();
    -            final DBObject insert = 
storageStrategy.serialize(ryaStatement);
    -            dbInserts.add(insert);
    -
    -            try {
    -                for (final RyaSecondaryIndexer index : secondaryIndexers) {
    -                    index.storeStatement(ryaStatement);
    +            final boolean canAdd = 
DocumentVisibilityUtil.doesUserHaveDocumentAccess(auths, 
ryaStatement.getColumnVisibility());
    +            if (canAdd) {
    +                final DBObject insert = 
storageStrategy.serialize(ryaStatement);
    +                dbInserts.add(insert);
    +
    +                try {
    +                    for (final RyaSecondaryIndexer index : 
secondaryIndexers) {
    +                        index.storeStatement(ryaStatement);
    +                    }
    +                } catch (final IOException e) {
    +                    log.error("Failed to add: " + ryaStatement.toString() 
+ " to the indexer");
                     }
    -            } catch (final IOException e) {
    -                log.error("Failed to add: " + ryaStatement.toString() + " 
to the indexer");
                 }
    -
             }
             coll.insert(dbInserts, new InsertOptions().continueOnError(true));
         }
     
         @Override
         public void delete(final RyaStatement statement, final 
MongoDBRdfConfiguration conf)
                 throws RyaDAOException {
    -        final DBObject obj = storageStrategy.getQuery(statement);
    -        coll.remove(obj);
    +        final boolean canDelete = 
DocumentVisibilityUtil.doesUserHaveDocumentAccess(auths, 
statement.getColumnVisibility());
    +        if (canDelete) {
    +            final DBObject obj = storageStrategy.getQuery(statement);
    +            coll.remove(obj);
    --- End diff --
    
    This PR was rebased off master before posting so I don't think I took out 
anybody's code.  I'll rebase again if I make any more updates.


> Add visibility support to MongoDB
> ---------------------------------
>
>                 Key: RYA-119
>                 URL: https://issues.apache.org/jira/browse/RYA-119
>             Project: Rya
>          Issue Type: Improvement
>          Components: dao
>    Affects Versions: 3.2.10
>            Reporter: Andrew Smith
>            Assignee: Eric White
>
> Currently, when querying mongo, visibility is ignored.  Need to add support 
> for visibility when querying mongo.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to