Пример #1
0
  @Override
  public void visit(final OpBGP opBGP) throws ReadDeniedException, AuthenticationRequiredException {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Starting visiting OpBGP");
    }
    Object principal = securityEvaluator.getPrincipal();
    if (!securityEvaluator.evaluate(principal, Action.Read, graphIRI)) {
      if (silentFail) {
        return;
      } else {
        throw new ReadDeniedException(SecuredItem.Util.modelPermissionMsg(graphIRI));
      }
    }

    // if the user can read any triple just add the opBGP
    if (securityEvaluator.evaluate(principal, Action.Read, graphIRI, Triple.ANY)) {
      addOp(opBGP);
    } else {
      // add security filtering to the resulting triples
      final List<Triple> newBGP = new ArrayList<>();
      final List<Node> variables = new ArrayList<>();
      // register all variables
      for (final Triple t : opBGP.getPattern().getList()) {
        newBGP.add(registerBGPTriple(t, variables));
      }
      // create the security function.
      final SecuredFunction secFunc =
          new SecuredFunction(graphIRI, securityEvaluator, variables, newBGP);
      // create the filter
      Op filter = OpFilter.filter(secFunc, new OpBGP(BasicPattern.wrap(newBGP)));
      // add the filter
      addOp(filter);
    }
  }
Пример #2
0
 /** rewrites the subop of proc. */
 @Override
 public void visit(final OpProcedure opProc) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpProc");
   }
   if (opProc.getProcId() != null) {
     addOp(new OpProcedure(opProc.getProcId(), opProc.getArgs(), rewriteOp1(opProc)));
   } else {
     addOp(new OpProcedure(opProc.getURI(), opProc.getArgs(), rewriteOp1(opProc)));
   }
 }
Пример #3
0
 /** rewrites the subop of order. */
 @Override
 public void visit(final OpOrder opOrder) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpOrder");
   }
   addOp(new OpOrder(rewriteOp1(opOrder), opOrder.getConditions()));
 }
Пример #4
0
 /** returns the null */
 @Override
 public void visit(final OpNull opNull) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpNull");
   }
   addOp(opNull);
 }
Пример #5
0
 /** rewrites the subop of list. */
 @Override
 public void visit(final OpList opList) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpList");
   }
   addOp(new OpList(rewriteOp1(opList)));
 }
Пример #6
0
 /** rewrites the subop of group. */
 @Override
 public void visit(final OpGroup opGroup) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpGroup");
   }
   addOp(new OpGroup(rewriteOp1(opGroup), opGroup.getGroupVars(), opGroup.getAggregators()));
 }
Пример #7
0
 /** rewrites the subop of filter. */
 @Override
 public void visit(final OpFilter opFilter) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpFilter");
   }
   addOp(OpFilter.filterBy(opFilter.getExprs(), rewriteOp1(opFilter)));
 }
Пример #8
0
 /** rewrites the subop of extend. */
 @Override
 public void visit(final OpExtend opExtend) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpExtend");
   }
   addOp(OpExtend.extend(rewriteOp1(opExtend), opExtend.getVarExprList()));
 }
Пример #9
0
 /** Returns the Ext */
 @Override
 public void visit(final OpExt opExt) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpExt");
   }
   addOp(opExt);
 }
Пример #10
0
 /** Rewrite sequence elements */
 @Override
 public void visit(final OpDisjunction opDisjunction) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpDisjunction");
   }
   addOp(rewriteOpN(opDisjunction, OpDisjunction.create()));
 }
Пример #11
0
 /** returns the dsNames */
 @Override
 public void visit(final OpDatasetNames dsNames) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpDatasetName");
   }
   addOp(dsNames);
 }
Пример #12
0
 /** Returns the path */
 @Override
 public void visit(final OpPath opPath) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpPath");
   }
   addOp(opPath);
 }
Пример #13
0
 @Override
 public void visit(OpQuadBlock quadBlock) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpQuadBlock");
   }
   addOp(quadBlock);
 }
Пример #14
0
 /** rewrites the subop of assign. */
 @Override
 public void visit(final OpAssign opAssign) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpAssign");
   }
   addOp(OpAssign.assign(rewriteOp1(opAssign), opAssign.getVarExprList()));
 }
Пример #15
0
 /** rewrites the subop of top. */
 @Override
 public void visit(final OpTopN opTop) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpTop");
   }
   addOp(new OpTopN(rewriteOp1(opTop), opTop.getLimit(), opTop.getConditions()));
 }
Пример #16
0
 /** returns the service */
 @Override
 public void visit(final OpService opService) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting opService");
   }
   addOp(opService);
 }
Пример #17
0
 /** returns the table */
 @Override
 public void visit(final OpTable opTable) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpTable");
   }
   addOp(opTable);
 }
Пример #18
0
 /** rewrites the subop of reduced. */
 @Override
 public void visit(final OpReduced opReduced) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpReduced");
   }
   addOp(OpReduced.create(rewriteOp1(opReduced)));
 }
Пример #19
0
 /** Rewrite sequence elements */
 @Override
 public void visit(final OpSequence opSequence) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpSequence");
   }
   addOp(rewriteOpN(opSequence, OpSequence.create()));
 }
Пример #20
0
 /** Returns the quadpattern */
 @Override
 public void visit(final OpQuadPattern quadPattern) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpQuadPattern");
   }
   addOp(quadPattern);
 }
Пример #21
0
 /** Returns the quad */
 @Override
 public void visit(final OpQuad opQuad) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpQuad");
   }
   addOp(opQuad);
 }
Пример #22
0
 /** rewrites the subop of project. */
 @Override
 public void visit(final OpProject opProject) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpProject");
   }
   addOp(new OpProject(rewriteOp1(opProject), opProject.getVars()));
 }
Пример #23
0
 /** Rewrite left and right */
 @Override
 public void visit(final OpUnion opUnion) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpUnion");
   }
   final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
   addOp(OpUnion.create(rewriteOp2(opUnion, rewriter), rewriter.getResult()));
 }
Пример #24
0
 /** rewrites the subop of graph. */
 @Override
 public void visit(final OpGraph opGraph) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpGraph");
   }
   final OpRewriter rewriter = new OpRewriter(securityEvaluator, opGraph.getNode());
   opGraph.getSubOp().visit(rewriter);
   addOp(new OpGraph(opGraph.getNode(), rewriter.getResult()));
 }
Пример #25
0
 /** rewrites the subop of propFunc. */
 @Override
 public void visit(final OpPropFunc opPropFunc) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpPropFunc");
   }
   addOp(
       new OpPropFunc(
           opPropFunc.getProperty(),
           opPropFunc.getSubjectArgs(),
           opPropFunc.getObjectArgs(),
           rewriteOp1(opPropFunc)));
 }