diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImpl.java index 601b24fe71..e801822beb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImpl.java @@ -21,19 +21,15 @@ package org.alfresco.module.org_alfresco_module_rm.classification; import static org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel.ASPECT_SECURITY_CLEARANCE; import static org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel.PROP_CLEARANCE_LEVEL; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import com.google.common.collect.ImmutableMap; import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.security.PersonService.PersonInfo; -import org.alfresco.service.namespace.QName; import org.alfresco.util.Pair; import org.alfresco.util.ParameterCheck; @@ -120,14 +116,6 @@ public class SecurityClearanceServiceImpl extends ServiceBaseImpl implements Sec // LevelIdNotFound exception if not. classificationService.getClassificationLevelById(clearanceId); - if (nodeService.hasAspect(personNode, ASPECT_SECURITY_CLEARANCE)) - { - nodeService.setProperty(personNode, PROP_CLEARANCE_LEVEL, clearanceId); - } - else - { - Map properties = ImmutableMap.of(PROP_CLEARANCE_LEVEL, (Serializable) clearanceId); - nodeService.addAspect(personNode, ASPECT_SECURITY_CLEARANCE, properties); - } + nodeService.setProperty(personNode, PROP_CLEARANCE_LEVEL, clearanceId); } } diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImplUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImplUnitTest.java index ab1e9b76b2..0cdf616d3c 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImplUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/SecurityClearanceServiceImplUnitTest.java @@ -26,7 +26,6 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.google.common.collect.ImmutableMap; import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound; import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; @@ -36,7 +35,6 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.security.PersonService.PersonInfo; -import org.alfresco.service.namespace.QName; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -100,36 +98,13 @@ public class SecurityClearanceServiceImplUnitTest assertEquals("default", clearance.getClearanceLevel().getId()); } - /** Check that a user can have their clearance set for the first time. */ - @Test public void setUserSecurityClearance_initialClearance() - { - // Create the user. - String userName = "User 1"; - NodeRef personNode = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, userName); - when(mockPersonService.getPerson(userName, false)).thenReturn(personNode); - // The user has no previous clearance. - when(mockNodeService.hasAspect(personNode, ASPECT_SECURITY_CLEARANCE)).thenReturn(false); - // Create the clearance. - String clearanceId = "ClearanceId"; - ClassificationLevel level = new ClassificationLevel(clearanceId, "TopSecretKey"); - when(mockClassificationService.getClassificationLevelById(clearanceId)).thenReturn(level); - - // Call the method under test. - securityClearanceServiceImpl.setUserSecurityClearance(userName, clearanceId); - - Map expectedProperties = ImmutableMap.of(PROP_CLEARANCE_LEVEL, clearanceId); - verify(mockNodeService).addAspect(personNode, ASPECT_SECURITY_CLEARANCE, expectedProperties); - } - - /** Check that a user can have their clearance edited. */ + /** Check that a user can have their clearance set. */ @Test public void setUserSecurityClearance_updateClearance() { // Create the user. String userName = "User 1"; NodeRef personNode = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, userName); when(mockPersonService.getPerson(userName, false)).thenReturn(personNode); - // The user has a previous clearance. - when(mockNodeService.hasAspect(personNode, ASPECT_SECURITY_CLEARANCE)).thenReturn(true); // Create the clearance. String clearanceId = "ClearanceId"; ClassificationLevel level = new ClassificationLevel(clearanceId, "TopSecretKey");