use of edu.stanford.bmir.protege.web.shared.user.EmailAddress in project webprotege by protegeproject.
the class ApplicationSettingsPresenter method applySettings.
private void applySettings() {
ApplicationSettings applicationSettings = new ApplicationSettings(view.getApplicationName(), new EmailAddress(view.getSystemNotificationEmailAddress()), new ApplicationLocation(view.getScheme().name().toLowerCase(), getHostNameFromView(), getPathFromView(), getPortFromView()), view.isAccountCreationAllowed() ? ACCOUNT_CREATION_ALLOWED : ACCOUNT_CREATION_NOT_ALLOWED, Collections.emptyList(), view.isProjectCreationAllowed() ? EMPTY_PROJECT_CREATION_ALLOWED : EMPTY_PROJECT_CREATION_NOT_ALLOWED, Collections.emptyList(), view.isProjectUploadAllowed() ? PROJECT_UPLOAD_ALLOWED : PROJECT_UPLOAD_NOT_ALLOWED, Collections.emptyList(), view.isNotificationEmailsEnabled() ? SEND_NOTIFICATION_EMAILS : DO_NOT_SEND_NOTIFICATION_EMAILS, parseMaxUploadSize());
dispatchServiceManager.execute(new SetApplicationSettingsAction(applicationSettings), result -> MessageBox.showMessage("Settings applied", "The application settings have successfully been applied"));
}
use of edu.stanford.bmir.protege.web.shared.user.EmailAddress in project webprotege by protegeproject.
the class UserDetailsManagerImpl_TestCase method shouldGetUserIdByEmail.
@Test
public void shouldGetUserIdByEmail() {
EmailAddress emailAddress = new EmailAddress(email);
assertThat(userDetailsManagerImpl.getUserIdByEmailAddress(emailAddress), is(java.util.Optional.of(userId)));
}
use of edu.stanford.bmir.protege.web.shared.user.EmailAddress in project webprotege by protegeproject.
the class EmailAddressWriteConverterTestCase method convertShoudldReturnStringEqualToSuppliedEmailAddress.
@Test
public void convertShoudldReturnStringEqualToSuppliedEmailAddress() {
EmailAddressWriteConverter converter = new EmailAddressWriteConverter();
String suppliedAddress = "jane.doe@stanford.edu";
EmailAddress emailAddress = new EmailAddress(suppliedAddress);
String convertedAddress = converter.convert(emailAddress);
assertEquals(suppliedAddress, convertedAddress);
}
use of edu.stanford.bmir.protege.web.shared.user.EmailAddress in project webprotege by protegeproject.
the class ChangeEmailAddressPresenter method showDialog.
private void showDialog(Optional<EmailAddress> emailAddress) {
final UserId userId = loggedInUserProvider.getCurrentUserId();
ChangeEmailAddressDialogController controller = new ChangeEmailAddressDialogController();
emailAddress.ifPresent(controller::setValue);
controller.setDialogButtonHandler(DialogButton.OK, (data, closer) -> {
if (data.isPresent()) {
dispatchServiceManager.execute(new SetEmailAddressAction(userId, data.get().getEmailAddress()), result -> {
if (result.getResult() == ADDRESS_ALREADY_EXISTS) {
MessageBox.showMessage("Address already taken", "The email address that you have specified is taken by another user. " + "Please specify a different email address.");
} else {
closer.hide();
}
});
} else {
MessageBox.showAlert("The specified email addresses do not match.");
}
});
WebProtegeDialog<Optional<EmailAddress>> dlg = new WebProtegeDialog<Optional<EmailAddress>>(controller);
dlg.setVisible(true);
}
use of edu.stanford.bmir.protege.web.shared.user.EmailAddress in project webprotege by protegeproject.
the class ApplicationSettingsManager method getApplicationSettings.
@Nonnull
public ApplicationSettings getApplicationSettings() {
try {
readLock.lock();
ApplicationPreferences applicationPreferences = settingsStore.getApplicationPreferences();
AccountCreationSetting accountCreationSetting;
boolean canCreateAccounts = accessManager.hasPermission(forGuestUser(), ApplicationResource.get(), BuiltInAction.CREATE_ACCOUNT);
if (canCreateAccounts) {
accountCreationSetting = ACCOUNT_CREATION_ALLOWED;
} else {
accountCreationSetting = ACCOUNT_CREATION_NOT_ALLOWED;
}
ProjectCreationSetting projectCreationSetting;
boolean canCreateEmptyProject = accessManager.hasPermission(forAnySignedInUser(), ApplicationResource.get(), CREATE_EMPTY_PROJECT);
if (canCreateEmptyProject) {
projectCreationSetting = EMPTY_PROJECT_CREATION_ALLOWED;
} else {
projectCreationSetting = EMPTY_PROJECT_CREATION_NOT_ALLOWED;
}
ProjectUploadSetting projectUploadSetting;
boolean canUploadProject = accessManager.hasPermission(forAnySignedInUser(), ApplicationResource.get(), UPLOAD_PROJECT);
if (canUploadProject) {
projectUploadSetting = PROJECT_UPLOAD_ALLOWED;
} else {
projectUploadSetting = PROJECT_UPLOAD_NOT_ALLOWED;
}
return new ApplicationSettings(applicationPreferences.getApplicationName(), new EmailAddress(applicationPreferences.getSystemNotificationEmailAddress()), applicationPreferences.getApplicationLocation(), accountCreationSetting, ImmutableList.of(), projectCreationSetting, ImmutableList.of(), projectUploadSetting, ImmutableList.of(), SEND_NOTIFICATION_EMAILS, applicationPreferences.getMaxUploadSize());
} finally {
readLock.unlock();
}
}
Aggregations