mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ACE-2564: Merged DEV to HEAD (5.0/Cloud)
85938: ACE-2564: Cloud - No task assignment email notification when a task is created by an External User - Run as primary tenant for user to retrieve fromActualUser email property. Add unit test. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85988 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1104,8 +1104,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
String fromActualUser = fromPersonName;
|
||||
if (fromPersonName != null)
|
||||
{
|
||||
NodeRef fromPerson = getPerson(fromPersonName);
|
||||
fromActualUser = (String) nodeService.getProperty(fromPerson, ContentModel.PROP_EMAIL);
|
||||
fromActualUser = getPersonEmail(fromPersonName);
|
||||
}
|
||||
|
||||
if (fromActualUser != null && fromActualUser.length() != 0)
|
||||
|
@@ -79,6 +79,7 @@ public abstract class AbstractMailActionExecuterTest
|
||||
public static AlfrescoPerson BRITISH_USER = null;
|
||||
public static AlfrescoPerson FRENCH_USER = null;
|
||||
public static AlfrescoPerson AUSTRALIAN_USER = null;
|
||||
public static AlfrescoPerson EXTERNAL_USER = null;
|
||||
|
||||
private static String ALFRESCO_EE_USER = "plainUser";
|
||||
|
||||
@@ -527,4 +528,39 @@ public abstract class AbstractMailActionExecuterTest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ACE-2564
|
||||
*/
|
||||
@Test
|
||||
public void testSendEmailByExternalUser() throws IOException, MessagingException
|
||||
{
|
||||
final Serializable recipients = (Serializable) Arrays.asList(BRITISH_USER.getUsername());
|
||||
final String subject = "";
|
||||
final String template = "alfresco/templates/mail/test.txt.ftl";
|
||||
|
||||
AuthenticationUtil.pushAuthentication();
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(EXTERNAL_USER.getUsername());
|
||||
|
||||
MimeMessage message = null;
|
||||
try
|
||||
{
|
||||
final String tenantId = getUsersHomeTenant(BRITISH_USER.getUsername());
|
||||
message = TenantUtil.runAsTenant(new TenantRunAsWork<MimeMessage>()
|
||||
{
|
||||
@Override
|
||||
public MimeMessage doWork() throws Exception
|
||||
{
|
||||
return sendMessage(null, recipients, subject, template);
|
||||
}
|
||||
}, tenantId);
|
||||
|
||||
Assert.assertNotNull(message);
|
||||
Assert.assertEquals("Hello Jan 1, 1970", (String) message.getContent());
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -59,8 +59,9 @@ public class MailActionExecuterTest extends AbstractMailActionExecuterTest
|
||||
BRITISH_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "englishuser@test.com");
|
||||
FRENCH_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "frenchuser@test.com");
|
||||
AUSTRALIAN_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "australianuser@test.com");
|
||||
EXTERNAL_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "externaluser@externaldomain.com");
|
||||
|
||||
return RuleChain.outerRule(APP_CONTEXT_INIT).around(AUSTRALIAN_USER).around(BRITISH_USER).around(FRENCH_USER);
|
||||
return RuleChain.outerRule(APP_CONTEXT_INIT).around(AUSTRALIAN_USER).around(BRITISH_USER).around(FRENCH_USER).around(EXTERNAL_USER);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user