Search in sources :

Example 1 with WoRController

use of org.jbei.ice.lib.net.WoRController in project ice by JBEI.

the class ConfigurationController method updateSetting.

public Setting updateSetting(String userId, Setting setting, String url) {
    AccountController accountController = new AccountController();
    if (!accountController.isAdministrator(userId))
        throw new PermissionException("Cannot update system setting without admin privileges");
    ConfigurationKey key = ConfigurationKey.valueOf(setting.getKey());
    if (key == null)
        throw new IllegalArgumentException("Invalid system key " + setting.getKey());
    Configuration configuration = setPropertyValue(key, setting.getValue());
    // check if the setting being updated is related to the web of registries
    if (key == ConfigurationKey.JOIN_WEB_OF_REGISTRIES) {
        WoRController woRController = new WoRController();
        boolean enable = "yes".equalsIgnoreCase(setting.getValue()) || "true".equalsIgnoreCase(setting.getValue());
        woRController.setEnable(userId, enable, url);
    }
    return configuration.toDataTransferObject();
}
Also used : PermissionException(org.jbei.ice.lib.access.PermissionException) ConfigurationKey(org.jbei.ice.lib.dto.ConfigurationKey) Configuration(org.jbei.ice.storage.model.Configuration) WoRController(org.jbei.ice.lib.net.WoRController) AccountController(org.jbei.ice.lib.account.AccountController)

Aggregations

PermissionException (org.jbei.ice.lib.access.PermissionException)1 AccountController (org.jbei.ice.lib.account.AccountController)1 ConfigurationKey (org.jbei.ice.lib.dto.ConfigurationKey)1 WoRController (org.jbei.ice.lib.net.WoRController)1 Configuration (org.jbei.ice.storage.model.Configuration)1