|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright 2002-2016 the original author or authors.
|
|
|
+ * Copyright 2002-2018 the original author or authors.
|
|
|
*
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -26,8 +26,6 @@ import org.springframework.security.acls.model.Acl;
|
|
|
import org.springframework.security.acls.model.AclService;
|
|
|
import org.springframework.security.acls.model.ObjectIdentity;
|
|
|
import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;
|
|
|
-import org.springframework.security.acls.model.Permission;
|
|
|
-import org.springframework.security.acls.model.Sid;
|
|
|
import org.springframework.security.acls.model.SidRetrievalStrategy;
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
|
|
@@ -44,13 +42,13 @@ public class AclPermissionEvaluatorTests {
|
|
|
AclPermissionEvaluator pe = new AclPermissionEvaluator(service);
|
|
|
ObjectIdentity oid = mock(ObjectIdentity.class);
|
|
|
ObjectIdentityRetrievalStrategy oidStrategy = mock(ObjectIdentityRetrievalStrategy.class);
|
|
|
- when(oidStrategy.getObjectIdentity(anyObject())).thenReturn(oid);
|
|
|
+ when(oidStrategy.getObjectIdentity(any(Object.class))).thenReturn(oid);
|
|
|
pe.setObjectIdentityRetrievalStrategy(oidStrategy);
|
|
|
pe.setSidRetrievalStrategy(mock(SidRetrievalStrategy.class));
|
|
|
Acl acl = mock(Acl.class);
|
|
|
|
|
|
- when(service.readAclById(any(ObjectIdentity.class), anyListOf(Sid.class))).thenReturn(acl);
|
|
|
- when(acl.isGranted(anyListOf(Permission.class), anyListOf(Sid.class), eq(false))).thenReturn(true);
|
|
|
+ when(service.readAclById(any(ObjectIdentity.class), anyList())).thenReturn(acl);
|
|
|
+ when(acl.isGranted(anyList(), anyList(), eq(false))).thenReturn(true);
|
|
|
|
|
|
assertThat(pe.hasPermission(mock(Authentication.class), new Object(), "READ")).isTrue();
|
|
|
}
|
|
@@ -64,13 +62,13 @@ public class AclPermissionEvaluatorTests {
|
|
|
AclPermissionEvaluator pe = new AclPermissionEvaluator(service);
|
|
|
ObjectIdentity oid = mock(ObjectIdentity.class);
|
|
|
ObjectIdentityRetrievalStrategy oidStrategy = mock(ObjectIdentityRetrievalStrategy.class);
|
|
|
- when(oidStrategy.getObjectIdentity(anyObject())).thenReturn(oid);
|
|
|
+ when(oidStrategy.getObjectIdentity(any(Object.class))).thenReturn(oid);
|
|
|
pe.setObjectIdentityRetrievalStrategy(oidStrategy);
|
|
|
pe.setSidRetrievalStrategy(mock(SidRetrievalStrategy.class));
|
|
|
Acl acl = mock(Acl.class);
|
|
|
|
|
|
- when(service.readAclById(any(ObjectIdentity.class), anyListOf(Sid.class))).thenReturn(acl);
|
|
|
- when(acl.isGranted(anyListOf(Permission.class), anyListOf(Sid.class), eq(false))).thenReturn(true);
|
|
|
+ when(service.readAclById(any(ObjectIdentity.class), anyList())).thenReturn(acl);
|
|
|
+ when(acl.isGranted(anyList(), anyList(), eq(false))).thenReturn(true);
|
|
|
|
|
|
assertThat(pe.hasPermission(mock(Authentication.class), new Object(), "write")).isTrue();
|
|
|
|