Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

57912: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      57879: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1)
         57877: MNT-9926: reformat code changes from
            53236: MNT-9101 Share: Cancelling an invitation for a disabled user, the user gets deleted in the process.
            	-add tests for both internal and external user invite cancellation
                -add new aspect to identify external invites and exclude from post invite cancellation cleanup


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61905 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 22:25:56 +00:00
parent f6104e80a9
commit d817f0522d
3 changed files with 45 additions and 47 deletions

View File

@@ -372,7 +372,6 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
nodeService.removeAspect(person, ContentModel.ASPECT_ANULLABLE); nodeService.removeAspect(person, ContentModel.ASPECT_ANULLABLE);
} }
return invitation; return invitation;
} }

View File

@@ -185,16 +185,15 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
assertNotNull("Invitation service is null", invitationService); assertNotNull("Invitation service is null", invitationService);
} }
/** /**
* MNT-9101 An internal user account (disabled) should not be deleted if * MNT-9101 An internal user account (disabled) should not be deleted if an
* an associated nominated invitation is cancelled. * associated nominated invitation is cancelled.
* *
* @throws Exception * @throws Exception
*/ */
public void testInternalUserNotDeletedAfterInviteCancelled() throws Exception { public void testInternalUserNotDeletedAfterInviteCancelled() throws Exception
{
//Disable our existing User // Disable our existing User
boolean enabled = authenticationService.getAuthenticationEnabled(USER_ONE); boolean enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
assertTrue("User One authentication disabled", enabled); assertTrue("User One authentication disabled", enabled);
authenticationService.setAuthenticationEnabled(USER_ONE, false); authenticationService.setAuthenticationEnabled(USER_ONE, false);
@@ -210,27 +209,26 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
this.authenticationComponent.setCurrentUser(USER_MANAGER); this.authenticationComponent.setCurrentUser(USER_MANAGER);
//Invite our existing user // Invite our existing user
NominatedInvitation nominatedInvitation = invitationService NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
.inviteNominated(inviteeUserName, resourceType, resourceName, inviteeUserName, resourceType, resourceName, inviteeRole, acceptUrl, rejectUrl);
inviteeRole, acceptUrl, rejectUrl);
//Cancel the invite // Cancel the invite
invitationService.cancel(nominatedInvitation.getInviteId()); invitationService.cancel(nominatedInvitation.getInviteId());
//Our User and associated Authentication still exists // Our User and associated Authentication still exists
assertNotNull("User Exists", personService.getPersonOrNull(USER_ONE)); assertNotNull("User Exists", personService.getPersonOrNull(USER_ONE));
assertTrue("Authentication Exists", authenticationService.authenticationExists(USER_ONE)); assertTrue("Authentication Exists", authenticationService.authenticationExists(USER_ONE));
} }
/** /**
* Ensure that an External user account is deleted when an invite is cancelled * Ensure that an External user account is deleted when an invite is
* cancelled
* *
* @throws Exception * @throws Exception
*/ */
public void testExternalUserDeletedAfterInviteCancelled() throws Exception { public void testExternalUserDeletedAfterInviteCancelled() throws Exception
{
String inviteeFirstName = PERSON_FIRSTNAME; String inviteeFirstName = PERSON_FIRSTNAME;
String inviteeLastName = PERSON_LASTNAME; String inviteeLastName = PERSON_LASTNAME;
String inviteeEmail = "123@alfrescotesting.com"; String inviteeEmail = "123@alfrescotesting.com";
@@ -243,19 +241,20 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
this.authenticationComponent.setCurrentUser(USER_MANAGER); this.authenticationComponent.setCurrentUser(USER_MANAGER);
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(inviteeFirstName, inviteeLastName, NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
inviteeEmail, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl); inviteeFirstName, inviteeLastName, inviteeEmail, resourceType, resourceName,
inviteeRole, serverPath, acceptUrl, rejectUrl);
String inviteeUsername = nominatedInvitation.getInviteeUserName(); String inviteeUsername = nominatedInvitation.getInviteeUserName();
invitationService.cancel(nominatedInvitation.getInviteId()); invitationService.cancel(nominatedInvitation.getInviteId());
//Our User and Authentication has been removed // Our User and Authentication has been removed
assertNull("Person deleted", personService.getPersonOrNull(inviteeUsername)); assertNull("Person deleted", personService.getPersonOrNull(inviteeUsername));
assertFalse("Authentication deleted", authenticationService.authenticationExists(inviteeUsername)); assertFalse("Authentication deleted",
authenticationService.authenticationExists(inviteeUsername));
} }
/** /**
* Test nominated user - new user * Test nominated user - new user
* *