Search in sources :

Example 1 with UserConfig

use of de.symeda.sormas.api.externaljournal.UserConfig in project SORMAS-Project by hzi-braunschweig.

the class StartupShutdownService method createOrUpdatePatientDiaryUser.

private void createOrUpdatePatientDiaryUser() {
    PatientDiaryConfig patientDiaryConfig = configFacade.getPatientDiaryConfig();
    UserConfig userConfig = patientDiaryConfig.getDefaultUser();
    if (userConfig == null) {
        logger.debug("Patient diary default user not configured");
        return;
    }
    createOrUpdateDefaultUser(new HashSet<>(Arrays.asList(UserRole.REST_USER, UserRole.REST_EXTERNAL_VISITS_USER)), userConfig.getUsername(), userConfig.getPassword(), "Patient", "Diary");
}
Also used : PatientDiaryConfig(de.symeda.sormas.api.externaljournal.PatientDiaryConfig) UserConfig(de.symeda.sormas.api.externaljournal.UserConfig)

Example 2 with UserConfig

use of de.symeda.sormas.api.externaljournal.UserConfig in project SORMAS-Project by hzi-braunschweig.

the class ConfigFacadeEjb method getPatientDiaryConfig.

@Override
public PatientDiaryConfig getPatientDiaryConfig() {
    PatientDiaryConfig config = new PatientDiaryConfig();
    config.setUrl(getProperty(INTERFACE_PATIENT_DIARY_URL, null));
    config.setProbandsUrl(getProperty(INTERFACE_PATIENT_DIARY_PROBANDS_URL, null));
    config.setAuthUrl(getProperty(INTERFACE_PATIENT_DIARY_AUTH_URL, null));
    config.setFrontendAuthUrl(getProperty(INTERFACE_PATIENT_DIARY_FRONTEND_AUTH_URL, null));
    config.setTokenLifetime(Duration.ofSeconds(getLong(INTERFACE_PATIENT_DIARY_TOKEN_LIFETIME, 21600L)));
    config.setEmail(getProperty(INTERFACE_PATIENT_DIARY_EMAIL, null));
    config.setPassword(getProperty(INTERFACE_PATIENT_DIARY_PASSWORD, null));
    config.setAcceptPhoneContact(getBoolean(INTERFACE_PATIENT_DIARY_ACCEPT_PHONE_CONTACT, true));
    UserConfig userConfig = new UserConfig();
    userConfig.setUsername(getProperty(INTERFACE_PATIENT_DIARY_DEFAULT_USER_USERNAME, null));
    userConfig.setPassword(getProperty(INTERFACE_PATIENT_DIARY_DEFAULT_USER_PASSWORD, null));
    if (StringUtils.isNoneBlank(userConfig.getUsername(), userConfig.getPassword())) {
        config.setDefaultUser(userConfig);
    }
    return config;
}
Also used : PatientDiaryConfig(de.symeda.sormas.api.externaljournal.PatientDiaryConfig) UserConfig(de.symeda.sormas.api.externaljournal.UserConfig)

Example 3 with UserConfig

use of de.symeda.sormas.api.externaljournal.UserConfig in project SORMAS-Project by hzi-braunschweig.

the class ConfigFacadeEjb method getSymptomJournalConfig.

@Override
public SymptomJournalConfig getSymptomJournalConfig() {
    SymptomJournalConfig config = new SymptomJournalConfig();
    config.setUrl(getProperty(INTERFACE_SYMPTOM_JOURNAL_URL, null));
    config.setAuthUrl(getProperty(INTERFACE_SYMPTOM_JOURNAL_AUTH_URL, null));
    config.setClientId(getProperty(INTERFACE_SYMPTOM_JOURNAL_CLIENT_ID, null));
    config.setSecret(getProperty(INTERFACE_SYMPTOM_JOURNAL_SECRET, null));
    UserConfig userConfig = new UserConfig();
    userConfig.setUsername(getProperty(INTERFACE_SYMPTOM_JOURNAL_DEFAULT_USER_USERNAME, null));
    userConfig.setPassword(getProperty(INTERFACE_SYMPTOM_JOURNAL_DEFAULT_USER_PASSWORD, null));
    if (StringUtils.isNoneBlank(userConfig.getUsername(), userConfig.getPassword())) {
        config.setDefaultUser(userConfig);
    }
    return config;
}
Also used : SymptomJournalConfig(de.symeda.sormas.api.externaljournal.SymptomJournalConfig) UserConfig(de.symeda.sormas.api.externaljournal.UserConfig)

Example 4 with UserConfig

use of de.symeda.sormas.api.externaljournal.UserConfig in project SORMAS-Project by hzi-braunschweig.

the class StartupShutdownService method createOrUpdateSymptomJournalUser.

private void createOrUpdateSymptomJournalUser() {
    SymptomJournalConfig symptomJournalConfig = configFacade.getSymptomJournalConfig();
    UserConfig userConfig = symptomJournalConfig.getDefaultUser();
    if (userConfig == null) {
        logger.debug("Symptom journal default user not configured");
        return;
    }
    createOrUpdateDefaultUser(new HashSet<>(Arrays.asList(UserRole.REST_USER, UserRole.REST_EXTERNAL_VISITS_USER)), userConfig.getUsername(), userConfig.getPassword(), "Symptom", "Journal");
}
Also used : SymptomJournalConfig(de.symeda.sormas.api.externaljournal.SymptomJournalConfig) UserConfig(de.symeda.sormas.api.externaljournal.UserConfig)

Aggregations

UserConfig (de.symeda.sormas.api.externaljournal.UserConfig)4 PatientDiaryConfig (de.symeda.sormas.api.externaljournal.PatientDiaryConfig)2 SymptomJournalConfig (de.symeda.sormas.api.externaljournal.SymptomJournalConfig)2