mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -372,7 +372,6 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
|
||||
nodeService.removeAspect(person, ContentModel.ASPECT_ANULLABLE);
|
||||
}
|
||||
|
||||
|
||||
return invitation;
|
||||
}
|
||||
|
||||
|
@@ -289,7 +289,7 @@ public class InviteHelper implements InitializingBean
|
||||
// if invitee's user account is still disabled and there are no pending invites outstanding
|
||||
// for the invitee, then remove the account and delete the invitee's person node
|
||||
if (person != null
|
||||
&& (authenticationService.isAuthenticationMutable(inviteeUserName))
|
||||
&& (authenticationService.isAuthenticationMutable(inviteeUserName))
|
||||
&& (authenticationService.getAuthenticationEnabled(inviteeUserName) == false)
|
||||
&& (invitesPending == false)
|
||||
&& nodeService.hasAspect(person, ContentModel.ASPECT_ANULLABLE))
|
||||
|
@@ -185,52 +185,50 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
|
||||
assertNotNull("Invitation service is null", invitationService);
|
||||
}
|
||||
|
||||
/**
|
||||
* MNT-9101 An internal user account (disabled) should not be deleted if an
|
||||
* associated nominated invitation is cancelled.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testInternalUserNotDeletedAfterInviteCancelled() throws Exception
|
||||
{
|
||||
// Disable our existing User
|
||||
boolean enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
|
||||
assertTrue("User One authentication disabled", enabled);
|
||||
authenticationService.setAuthenticationEnabled(USER_ONE, false);
|
||||
enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
|
||||
assertTrue("User One authentication enabled", !enabled);
|
||||
|
||||
String inviteeUserName = USER_ONE;
|
||||
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||
String acceptUrl = "froob";
|
||||
String rejectUrl = "marshmallow";
|
||||
|
||||
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||
|
||||
// Invite our existing user
|
||||
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
|
||||
inviteeUserName, resourceType, resourceName, inviteeRole, acceptUrl, rejectUrl);
|
||||
|
||||
// Cancel the invite
|
||||
invitationService.cancel(nominatedInvitation.getInviteId());
|
||||
|
||||
// Our User and associated Authentication still exists
|
||||
assertNotNull("User Exists", personService.getPersonOrNull(USER_ONE));
|
||||
assertTrue("Authentication Exists", authenticationService.authenticationExists(USER_ONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* MNT-9101 An internal user account (disabled) should not be deleted if
|
||||
* an associated nominated invitation is cancelled.
|
||||
* Ensure that an External user account is deleted when an invite is
|
||||
* cancelled
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testInternalUserNotDeletedAfterInviteCancelled() throws Exception {
|
||||
|
||||
//Disable our existing User
|
||||
boolean enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
|
||||
assertTrue("User One authentication disabled", enabled);
|
||||
authenticationService.setAuthenticationEnabled(USER_ONE, false);
|
||||
enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
|
||||
assertTrue("User One authentication enabled", !enabled);
|
||||
|
||||
String inviteeUserName = USER_ONE;
|
||||
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||
String acceptUrl = "froob";
|
||||
String rejectUrl = "marshmallow";
|
||||
|
||||
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||
|
||||
//Invite our existing user
|
||||
NominatedInvitation nominatedInvitation = invitationService
|
||||
.inviteNominated(inviteeUserName, resourceType, resourceName,
|
||||
inviteeRole, acceptUrl, rejectUrl);
|
||||
|
||||
//Cancel the invite
|
||||
invitationService.cancel(nominatedInvitation.getInviteId());
|
||||
|
||||
//Our User and associated Authentication still exists
|
||||
assertNotNull("User Exists", personService.getPersonOrNull(USER_ONE));
|
||||
assertTrue("Authentication Exists", authenticationService.authenticationExists(USER_ONE));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that an External user account is deleted when an invite is cancelled
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testExternalUserDeletedAfterInviteCancelled() throws Exception {
|
||||
|
||||
public void testExternalUserDeletedAfterInviteCancelled() throws Exception
|
||||
{
|
||||
String inviteeFirstName = PERSON_FIRSTNAME;
|
||||
String inviteeLastName = PERSON_LASTNAME;
|
||||
String inviteeEmail = "123@alfrescotesting.com";
|
||||
@@ -243,18 +241,19 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
|
||||
|
||||
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||
|
||||
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(inviteeFirstName, inviteeLastName,
|
||||
inviteeEmail, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
|
||||
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
|
||||
inviteeFirstName, inviteeLastName, inviteeEmail, resourceType, resourceName,
|
||||
inviteeRole, serverPath, acceptUrl, rejectUrl);
|
||||
|
||||
String inviteeUsername = nominatedInvitation.getInviteeUserName();
|
||||
|
||||
invitationService.cancel(nominatedInvitation.getInviteId());
|
||||
|
||||
//Our User and Authentication has been removed
|
||||
// Our User and Authentication has been removed
|
||||
assertNull("Person deleted", personService.getPersonOrNull(inviteeUsername));
|
||||
assertFalse("Authentication deleted", authenticationService.authenticationExists(inviteeUsername));
|
||||
}
|
||||
|
||||
assertFalse("Authentication deleted",
|
||||
authenticationService.authenticationExists(inviteeUsername));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test nominated user - new user
|
||||
|
Reference in New Issue
Block a user