use of org.olat.basesecurity.IdentityImpl in project OpenOLAT by OpenOLAT.
the class MailManagerImpl method appendRecipients.
private void appendRecipients(DBMailImpl mail, List<ContactList> ccLists, List<Address> toAddress, List<Address> ccAddress, boolean visible, boolean makeRealMail, MailerResult result) throws AddressException {
// append cc/bcc recipients
if (ccLists != null && !ccLists.isEmpty()) {
for (ContactList contactList : ccLists) {
if (makeRealMail && StringHelper.containsNonWhitespace(contactList.getName())) {
Address[] groupAddress = InternetAddress.parse(contactList.getRFC2822Name() + ";");
if (groupAddress != null && groupAddress.length > 0) {
for (Address groupAdd : groupAddress) {
toAddress.add(groupAdd);
}
}
}
for (String email : contactList.getStringEmails().values()) {
DBMailRecipient recipient = new DBMailRecipient();
recipient.setEmailAddress(email);
recipient.setGroup(contactList.getName());
recipient.setVisible(visible);
recipient.setDeleted(Boolean.FALSE);
recipient.setMarked(Boolean.FALSE);
recipient.setRead(Boolean.FALSE);
mail.getRecipients().add(recipient);
if (makeRealMail) {
createAddress(ccAddress, recipient, false, result, false);
}
}
for (Identity identityEmail : contactList.getIdentiEmails().values()) {
DBMailRecipient recipient = new DBMailRecipient();
if (identityEmail instanceof IdentityImpl) {
recipient.setRecipient(identityEmail);
} else {
recipient.setEmailAddress(identityEmail.getUser().getProperty(UserConstants.EMAIL, null));
}
recipient.setGroup(contactList.getName());
recipient.setVisible(visible);
recipient.setDeleted(Boolean.FALSE);
recipient.setMarked(Boolean.FALSE);
recipient.setRead(Boolean.FALSE);
mail.getRecipients().add(recipient);
if (makeRealMail) {
createAddress(ccAddress, recipient, false, result, false);
}
}
}
}
}
use of org.olat.basesecurity.IdentityImpl in project openolat by klemens.
the class EdubaseManagerImplTest method getUserIdShouldConcatIssuerAndIdentityName.
@Test
public void getUserIdShouldConcatIssuerAndIdentityName() {
String userName = "user";
IdentityImpl identity = new IdentityImpl();
identity.setName(userName);
String providerName = "OLAT";
String issuerIdentifier = "https://issuer.abc";
when(identityEnvironmentMock.getIdentity()).thenReturn(identity);
when(identityEnvironmentMock.getAttributes().get(AuthHelper.ATTRIBUTE_AUTHPROVIDER)).thenReturn(providerName);
when(authenticationProviderMock.getIssuerIdentifier(identityEnvironmentMock)).thenReturn(issuerIdentifier);
when(loginModulMock.getAuthenticationProvider(providerName)).thenReturn(authenticationProviderMock);
String userID = sut.getUserId(identityEnvironmentMock);
String expectedUserId = issuerIdentifier.concat("#").concat(userName);
assertThat(userID).isEqualTo(expectedUserId);
}
use of org.olat.basesecurity.IdentityImpl in project openolat by klemens.
the class InputValidatorTest method setUp.
@Before
public void setUp() {
inputMock = mock(AdvanceOrderInput.class);
when(inputMock.getIdentity()).thenReturn(new IdentityImpl());
Set<IdentifierKey> keys = new HashSet<>();
keys.add(IdentifierKey.externalId);
when(inputMock.getKeys()).thenReturn(keys);
when(inputMock.getRawValues()).thenReturn("rawValues");
doReturn(AutoAccessMethod.class).when(inputMock).getMethodClass();
}
use of org.olat.basesecurity.IdentityImpl in project OpenOLAT by OpenOLAT.
the class UserManagerImpl method updateUserFromIdentity.
@Override
public boolean updateUserFromIdentity(Identity identity) {
try {
String fullName = getUserDisplayName(identity);
updateUsernameCache(identity.getKey(), identity.getName(), fullName);
} catch (Exception e) {
logWarn("Error update usernames cache", e);
}
User user = updateUser(identity.getUser());
((IdentityImpl) identity).setUser(user);
return true;
}
use of org.olat.basesecurity.IdentityImpl in project OpenOLAT by OpenOLAT.
the class InputValidatorTest method setUp.
@Before
public void setUp() {
inputMock = mock(AdvanceOrderInput.class);
when(inputMock.getIdentity()).thenReturn(new IdentityImpl());
Set<IdentifierKey> keys = new HashSet<>();
keys.add(IdentifierKey.externalId);
when(inputMock.getKeys()).thenReturn(keys);
when(inputMock.getRawValues()).thenReturn("rawValues");
doReturn(AutoAccessMethod.class).when(inputMock).getMethodClass();
}
Aggregations