use of org.olat.core.util.mail.ContactList in project OpenOLAT by OpenOLAT.
the class BusinessGroupServiceTest method allowToLeavingBusinessGroup_defaultSettings_groupOverride.
/**
* Test the default settings but the author set the business group to "leaving not allowed".
*/
@Test
public void allowToLeavingBusinessGroup_defaultSettings_groupOverride() {
Identity author = JunitTestHelper.createAndPersistIdentityAsAuthor("leave-auth-2-" + UUID.randomUUID().toString());
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("leave-bg-2-");
BusinessGroup group = businessGroupService.createBusinessGroup(author, "Leaving group", "But you cannot leave :-(", new Integer(0), new Integer(2), false, false, null);
businessGroupRelationDao.addRole(participant, group, GroupRoles.participant.name());
dbInstance.commitAndCloseSession();
// set to not allowed to leave
group = businessGroupService.updateAllowToLeaveBusinessGroup(group, false);
dbInstance.commitAndCloseSession();
LeaveOption optionToLeave = businessGroupService.isAllowToLeaveBusinessGroup(participant, group);
Assert.assertNotNull(optionToLeave);
Assert.assertFalse(optionToLeave.isAllowToLeave());
ContactList contacts = optionToLeave.getContacts();
Assert.assertNotNull(contacts);
Collection<Identity> contactList = contacts.getIdentiEmails().values();
Assert.assertNotNull(contactList);
Assert.assertEquals(1, contactList.size());
Assert.assertTrue(contactList.contains(author));
}
use of org.olat.core.util.mail.ContactList in project OpenOLAT by OpenOLAT.
the class CertificatesManagerImpl method sendCertificate.
private MailerResult sendCertificate(Identity to, RepositoryEntry entry, File certificateFile) {
MailBundle bundle = new MailBundle();
bundle.setToId(to);
bundle.setFrom(WebappHelper.getMailConfig("mailReplyTo"));
List<String> bccs = certificatesModule.getCertificatesBccEmails();
if (bccs.size() > 0) {
ContactList bcc = new ContactList();
bccs.forEach(email -> {
bcc.add(email);
});
bundle.setContactList(bcc);
}
String[] args = new String[] { entry.getDisplayname(), userManager.getUserDisplayName(to) };
String userLanguage = to.getUser().getPreferences().getLanguage();
Locale locale = i18nManager.getLocaleOrDefault(userLanguage);
Translator translator = Util.createPackageTranslator(CertificateController.class, locale);
String subject = translator.translate("certification.email.subject", args);
String body = translator.translate("certification.email.body", args);
bundle.setContent(subject, body, certificateFile);
return mailManager.sendMessage(bundle);
}
use of org.olat.core.util.mail.ContactList in project OpenOLAT by OpenOLAT.
the class CertificateAndEfficiencyStatementController method contact.
private void contact(UserRequest ureq) {
removeAsListenerAndDispose(cmc);
ContactMessage cmsg = new ContactMessage(getIdentity());
ContactList contactList = new ContactList("to");
contactList.add(statementOwner);
cmsg.addEmailTo(contactList);
contactCtrl = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
listenTo(contactCtrl);
cmc = new CloseableModalController(getWindowControl(), translate("close"), contactCtrl.getInitialComponent());
cmc.activate();
listenTo(cmc);
}
use of org.olat.core.util.mail.ContactList in project OpenOLAT by OpenOLAT.
the class CORunController method retrieveParticipantsFromGroups.
private ContactList retrieveParticipantsFromGroups(List<Long> groupKeys) {
List<Identity> participiants = cgm.getParticipantsFromBusinessGroups(groupKeys);
ContactList cl = new ContactList(translate("form.message.chckbx.partips"));
cl.addAllIdentites(participiants);
return cl;
}
use of org.olat.core.util.mail.ContactList in project OpenOLAT by OpenOLAT.
the class CORunController method retrieveCoachesFromCourse.
private ContactList retrieveCoachesFromCourse() {
List<Identity> coaches = cgm.getCoaches();
ContactList cl = new ContactList(translate("form.message.chckbx.partips"));
cl.addAllIdentites(coaches);
return cl;
}
Aggregations