SEC-147: Add processDomainObjectClass property to AfterInvocationProviders.
This commit is contained in:
parent
de4af379cc
commit
5d9ed78b50
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue