use of edu.stanford.bmir.protege.web.shared.app.ApplicationSettings 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();
}
}
use of edu.stanford.bmir.protege.web.shared.app.ApplicationSettings in project webprotege by protegeproject.
the class ApplicationPreferencesManager_TestCase method shouldGetAccountCreationNotAllowed.
@Test
public void shouldGetAccountCreationNotAllowed() {
ApplicationSettings applicationSettings = manager.getApplicationSettings();
assertThat(applicationSettings.getAccountCreationSetting(), is(ACCOUNT_CREATION_NOT_ALLOWED));
}
use of edu.stanford.bmir.protege.web.shared.app.ApplicationSettings in project webprotege by protegeproject.
the class ApplicationPreferencesManager_TestCase method shouldGetProjectCreationNotAllowed.
@Test
public void shouldGetProjectCreationNotAllowed() {
ApplicationSettings applicationSettings = manager.getApplicationSettings();
assertThat(applicationSettings.getProjectCreationSetting(), is(EMPTY_PROJECT_CREATION_NOT_ALLOWED));
}
use of edu.stanford.bmir.protege.web.shared.app.ApplicationSettings in project webprotege by protegeproject.
the class ApplicationPreferencesManager_TestCase method shouldGetProjectUploadAllowed.
@Test
public void shouldGetProjectUploadAllowed() {
when(accessManager.hasPermission(forAnySignedInUser(), ApplicationResource.get(), BuiltInAction.UPLOAD_PROJECT)).thenReturn(true);
ApplicationSettings applicationSettings = manager.getApplicationSettings();
assertThat(applicationSettings.getProjectUploadSetting(), is(PROJECT_UPLOAD_ALLOWED));
}
Aggregations