use of org.apache.jena.permissions.model.SecuredSeq in project jena by apache.
the class SecuredSeqImpl method getSeq.
/**
* @sec.graph Read if {@link SecurityEvaluator#isHardReadError()} is true and
* the user does not have read access then SeqIndexBoundsException is
* thrown
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
* @throws AuthenticationRequiredException if user is not authenticated and is
* required to be.
*/
@Override
public SecuredSeq getSeq(final int index) throws ReadDeniedException, AuthenticationRequiredException {
if (checkSoftRead()) {
final Seq retval = holder.getBaseItem().getSeq(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), retval.asNode()));
return SecuredSeqImpl.getInstance(getModel(), retval);
}
throw new SeqIndexBoundsException(index, 0);
}
use of org.apache.jena.permissions.model.SecuredSeq in project jena by apache.
the class SecuredSeqImpl method getInstance.
/**
* get a SecuredSeq.
*
* @param securedModel The secured model that provides the security context
* @param seq The Seq to secure.
* @return the SecuredSeq
*/
public static SecuredSeq getInstance(final SecuredModel securedModel, final Seq seq) {
if (securedModel == null) {
throw new IllegalArgumentException("Secured securedModel may not be null");
}
if (seq == null) {
throw new IllegalArgumentException("Seq may not be null");
}
final ItemHolder<Seq, SecuredSeq> holder = new ItemHolder<>(seq);
final SecuredSeqImpl checker = new SecuredSeqImpl(securedModel, holder);
// one.
if (seq instanceof SecuredSeq) {
if (checker.isEquivalent((SecuredSeq) seq)) {
return (SecuredSeq) seq;
}
}
return holder.setSecuredItem(new SecuredItemInvoker(seq.getClass(), checker));
}
Aggregations