* Verify if a resolution request has access granted, and update the resolution constraints
* accordingly
*/
public void addGrantConstraints(RelToResolve relation) {
PendingRequest request = PendingRequest.isRetry() ?
PendingRequest.current() :
new PendingRequest(CST.apamResolver,relation.getLinkSource(),relation.getRelationDefinition());
for (OwnedComponentDeclaration ownedDeclaration : getOwned()) {
GrantDeclaration grant = getCurrentGrant(ownedDeclaration);
boolean granted = grant == null || match(grant, request);
/*
* Add a constraint to avoid that a request be resolved against an owned instance that
* is not granted to the source of the request
*/
for (Instance ownedInstance : getOwned(ownedDeclaration)) {
if (!granted && request.isSatisfiedBy(ownedInstance)) {
relation.getMngInstanceConstraints().add("(! ("+CST.INSTNAME+" = "+ownedInstance.getName()+"))");
}
}
}