This commit is contained in:
Luke Taylor 2009-10-07 19:07:22 +00:00
parent 6aee4f0ee4
commit 2b99c6331e
2 changed files with 11 additions and 10 deletions

View File

@ -52,15 +52,18 @@ import org.springframework.web.util.ExpressionEvaluationUtils;
* principal. * principal.
* <p> * <p>
* One or more comma separate numeric are specified via the <tt>hasPermission</tt> attribute. * One or more comma separate numeric are specified via the <tt>hasPermission</tt> attribute.
* These permissions are then converted into {@link Permission} instances. These instances are then presented as an * These permissions are then converted into {@link Permission} instances using the {@link PermissionFactory}
* array to the {@link Acl#isGranted(Permission[], org.springframework.security.acls.model.Sid[], boolean)} method. * instance obtained from the application context, or a {@link DefaultPermissionFactory} if one isn't found.
* The <tt>Permission</tt> instances are then presented as a list
* array to the {@link Acl#isGranted(List, List, boolean)} method.
* The {@link Sid} presented is determined by the {@link SidRetrievalStrategy}. * The {@link Sid} presented is determined by the {@link SidRetrievalStrategy}.
* <p> * <p>
* For this class to operate it must be able to access the application context via the * For this class to operate it must be able to access the application context via the
* <code>WebApplicationContextUtils</code> and attempt to locate an {@link AclService} and {@link SidRetrievalStrategy}. * <code>WebApplicationContextUtils</code> and attempt to locate an {@link AclService},
* {@link ObjectIdentityRetrievalStrategy} and {@link SidRetrievalStrategy}.
* There cannot be more than one of these present. The <tt>AclService</tt> must be provided, but a * There cannot be more than one of these present. The <tt>AclService</tt> must be provided, but a
* {@link SidRetrievalStrategyImpl} instance will be created as the default retrieval strategy if no implementation * {@link SidRetrievalStrategyImpl} and/or an {@link ObjectIdentityRetrievalStrategyImpl} will be created if no
* is supplied by the application context. * implementations are found in the application context.
* *
* @author Ben Alex * @author Ben Alex
* @version $Id$ * @version $Id$

View File

@ -16,12 +16,10 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockPageContext; import org.springframework.mock.web.MockPageContext;
import org.springframework.mock.web.MockServletContext; import org.springframework.mock.web.MockServletContext;
import org.springframework.security.acls.AclPermissionEvaluator;
import org.springframework.security.acls.model.Acl; import org.springframework.security.acls.model.Acl;
import org.springframework.security.acls.model.AclService; import org.springframework.security.acls.model.AclService;
import org.springframework.security.acls.model.ObjectIdentity; import org.springframework.security.acls.model.ObjectIdentity;
import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy; import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;
import org.springframework.security.acls.model.SidRetrievalStrategy;
import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
@ -44,12 +42,12 @@ public class AccessControlListTagTests {
WebApplicationContext ctx = mock(WebApplicationContext.class); WebApplicationContext ctx = mock(WebApplicationContext.class);
AclService service = mock(AclService.class); AclService service = mock(AclService.class);
AclPermissionEvaluator pe = new AclPermissionEvaluator(service);
ObjectIdentity oid = mock(ObjectIdentity.class); ObjectIdentity oid = mock(ObjectIdentity.class);
ObjectIdentityRetrievalStrategy oidStrategy = mock(ObjectIdentityRetrievalStrategy.class); ObjectIdentityRetrievalStrategy oidStrategy = mock(ObjectIdentityRetrievalStrategy.class);
when(oidStrategy.getObjectIdentity(anyObject())).thenReturn(oid); when(oidStrategy.getObjectIdentity(anyObject())).thenReturn(oid);
pe.setObjectIdentityRetrievalStrategy(oidStrategy); // AclPermissionEvaluator pe = new AclPermissionEvaluator(service);
pe.setSidRetrievalStrategy(mock(SidRetrievalStrategy.class)); // pe.setObjectIdentityRetrievalStrategy(oidStrategy);
// pe.setSidRetrievalStrategy(mock(SidRetrievalStrategy.class));
acl = mock(Acl.class); acl = mock(Acl.class);
when(service.readAclById(any(ObjectIdentity.class), anyList())).thenReturn(acl); when(service.readAclById(any(ObjectIdentity.class), anyList())).thenReturn(acl);