Exemplo n.º 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);
    }
  }
Exemplo n.º 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)));
   }
 }
Exemplo n.º 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()));
 }
Exemplo n.º 4
0
 /** returns the null */
 @Override
 public void visit(final OpNull opNull) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpNull");
   }
   addOp(opNull);
 }
Exemplo n.º 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)));
 }
Exemplo n.º 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()));
 }
Exemplo n.º 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)));
 }
Exemplo n.º 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()));
 }
Exemplo n.º 9
0
 /** Returns the Ext */
 @Override
 public void visit(final OpExt opExt) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpExt");
   }
   addOp(opExt);
 }
Exemplo n.º 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()));
 }
Exemplo n.º 11
0
 /** returns the dsNames */
 @Override
 public void visit(final OpDatasetNames dsNames) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpDatasetName");
   }
   addOp(dsNames);
 }
Exemplo n.º 12
0
 /** Returns the path */
 @Override
 public void visit(final OpPath opPath) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpPath");
   }
   addOp(opPath);
 }
Exemplo n.º 13
0
 @Override
 public void visit(OpQuadBlock quadBlock) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpQuadBlock");
   }
   addOp(quadBlock);
 }
Exemplo n.º 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()));
 }
Exemplo n.º 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()));
 }
Exemplo n.º 16
0
 /** returns the service */
 @Override
 public void visit(final OpService opService) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting opService");
   }
   addOp(opService);
 }
Exemplo n.º 17
0
 /** returns the table */
 @Override
 public void visit(final OpTable opTable) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpTable");
   }
   addOp(opTable);
 }
Exemplo n.º 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)));
 }
Exemplo n.º 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()));
 }
Exemplo n.º 20
0
 /** Returns the quadpattern */
 @Override
 public void visit(final OpQuadPattern quadPattern) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpQuadPattern");
   }
   addOp(quadPattern);
 }
Exemplo n.º 21
0
 /** Returns the quad */
 @Override
 public void visit(final OpQuad opQuad) {
   if (LOG.isDebugEnabled()) {
     LOG.debug("Starting visiting OpQuad");
   }
   addOp(opQuad);
 }
Exemplo n.º 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()));
 }
Exemplo n.º 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()));
 }
Exemplo n.º 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()));
 }
Exemplo n.º 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)));
 }