SEC-147: Add processDomainObjectClass property to AfterInvocationProviders.

This commit is contained in:
Ben Alex 2006-04-26 03:30:27 +00:00
parent de4af379cc
commit 5d9ed78b50
2 changed files with 25 additions and 1 deletions

View File

@ -113,9 +113,16 @@ public class BasicAclEntryAfterInvocationCollectionFilteringProvider
private AclManager aclManager;
private String processConfigAttribute = "AFTER_ACL_COLLECTION_READ";
private int[] requirePermission = {SimpleAclEntry.READ};
private Class processDomainObjectClass = Object.class;
//~ Methods ================================================================
public void setProcessDomainObjectClass(Class processDomainObjectClass) {
Assert.notNull(processDomainObjectClass,
"processDomainObjectClass cannot be set to null");
this.processDomainObjectClass = processDomainObjectClass;
}
public void setAclManager(AclManager aclManager) {
this.aclManager = aclManager;
}
@ -195,6 +202,8 @@ public class BasicAclEntryAfterInvocationCollectionFilteringProvider
if (domainObject == null) {
hasPermission = true;
} else if (!processDomainObjectClass.isAssignableFrom(domainObject.getClass())) {
hasPermission = true;
} else {
acls = aclManager.getAcls(domainObject, authentication);
}

View File

@ -100,10 +100,17 @@ public class BasicAclEntryAfterInvocationProvider
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor();
private String processConfigAttribute = "AFTER_ACL_READ";
private int[] requirePermission = {SimpleAclEntry.READ};
private Class processDomainObjectClass = Object.class;
//~ Methods ================================================================
public void afterPropertiesSet() throws Exception {
public void setProcessDomainObjectClass(Class processDomainObjectClass) {
Assert.notNull(processDomainObjectClass,
"processDomainObjectClass cannot be set to null");
this.processDomainObjectClass = processDomainObjectClass;
}
public void afterPropertiesSet() throws Exception {
Assert.notNull(processConfigAttribute,
"A processConfigAttribute is mandatory");
Assert.notNull(aclManager, "An aclManager is mandatory");
@ -134,6 +141,14 @@ public class BasicAclEntryAfterInvocationProvider
return null;
}
if (!processDomainObjectClass.isAssignableFrom(returnedObject.getClass())) {
if (logger.isDebugEnabled()) {
logger.debug("Return object is not applicable for this provider, skipping");
}
return null;
}
AclEntry[] acls = aclManager.getAcls(returnedObject,
authentication);