code: private AuthorisationDecision checkPriviledge(Priviledge p, boolean includeOptional) {
  
  
          AuthorisationDecision decision = new AuthorisationDecision(true);
          for(AddressTemplate ref : requiredResources)
          {
              if(ref.isOptional()) continue; // skip optional ones
  
              final Constraints model = getConstraints(ref, includeOptional);
              if(model!=null)
              {
                  if(!p.isGranted(model))
                  {
                      decision.getErrorMessages().add(ref.toString());
                  }
              }
              else
              {
                  decision.getErrorMessages().add("Missing constraints for "+ ref.toString());
              }
  
              if(decision.hasErrorMessages())
              {
                  decision.setGranted(false);
                  break;
              }
          }
  
          return decision;
      }
docs: Iterates over all required (and optional) resources, grabs the related constraints and checks if the given
  privilege for these constraints holds true.
  @return granted if the privilege holds true for *all* tested resources