use of edu.stanford.bmir.protege.web.shared.app.ProjectCreationSetting 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