private AuthorisationDecision checkPriviledge(Priviledge p, boolean includeOptional) {
if(!sealed)
throw new RuntimeException("Should be sealed before policy decisions are evaluated");
AuthorisationDecision decision = new AuthorisationDecision(true);
for(ResourceRef ref : requiredResources)
{
if(ref.optional) continue; // skip optional ones
final Constraints model = getConstraints(ref.address, false);
if(model!=null)
{
if(!p.isGranted(model))
{
decision.getErrorMessages().add(ref.address);
}
}
else
{
decision.getErrorMessages().add("Missing constraints for "+ ref.address);
}
if(decision.hasErrorMessages())
{
decision.setGranted(false);
break;
}
}
return decision;