Search in sources :

Example 1 with ProjectCreationSetting

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();
    }
}
Also used : ProjectUploadSetting(edu.stanford.bmir.protege.web.shared.app.ProjectUploadSetting) ApplicationSettings(edu.stanford.bmir.protege.web.shared.app.ApplicationSettings) ProjectCreationSetting(edu.stanford.bmir.protege.web.shared.app.ProjectCreationSetting) EmailAddress(edu.stanford.bmir.protege.web.shared.user.EmailAddress) AccountCreationSetting(edu.stanford.bmir.protege.web.shared.app.AccountCreationSetting) Nonnull(javax.annotation.Nonnull)

Aggregations

AccountCreationSetting (edu.stanford.bmir.protege.web.shared.app.AccountCreationSetting)1 ApplicationSettings (edu.stanford.bmir.protege.web.shared.app.ApplicationSettings)1 ProjectCreationSetting (edu.stanford.bmir.protege.web.shared.app.ProjectCreationSetting)1 ProjectUploadSetting (edu.stanford.bmir.protege.web.shared.app.ProjectUploadSetting)1 EmailAddress (edu.stanford.bmir.protege.web.shared.user.EmailAddress)1 Nonnull (javax.annotation.Nonnull)1