Search in sources :

Example 1 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO in project carbon-identity-framework by wso2.

the class AbstractUserStoreDAO method getUserStoreProperty.

private UserStoreDTO getUserStoreProperty(UserStoreDTO userStoreDTO) throws IdentityUserStoreMgtException {
    boolean newState = userStoreDTO.getDisabled();
    UserStoreDTO userStoreDTOTemp = getUserStore(userStoreDTO.getDomainId());
    if (userStoreDTOTemp != null) {
        userStoreDTO = userStoreDTOTemp;
        userStoreDTO.setDisabled(newState);
        PropertyDTO[] propertyDTO = userStoreDTO.getProperties();
        for (PropertyDTO propertyDTOValue : propertyDTO) {
            if (propertyDTOValue.getName().equals(DISABLED)) {
                propertyDTOValue.setValue(String.valueOf(newState));
            }
        }
    }
    return userStoreDTO;
}
Also used : UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO) PropertyDTO(org.wso2.carbon.identity.user.store.configuration.dto.PropertyDTO)

Example 2 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO in project carbon-identity-framework by wso2.

the class AbstractUserStoreDAO method getUserStorePersistanceDTO.

private UserStorePersistanceDTO getUserStorePersistanceDTO(UserStoreDTO userStoreDTO, String userStoreProperties) {
    UserStorePersistanceDTO userStorePersistanceDTO = new UserStorePersistanceDTO();
    userStorePersistanceDTO.setUserStoreDTO(userStoreDTO);
    userStorePersistanceDTO.setUserStoreProperties(userStoreProperties);
    return userStorePersistanceDTO;
}
Also used : UserStorePersistanceDTO(org.wso2.carbon.identity.user.store.configuration.dto.UserStorePersistanceDTO)

Example 3 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO in project carbon-identity-framework by wso2.

the class AbstractUserStoreDAO method addUserStore.

@Override
public void addUserStore(UserStoreDTO userStoreDTO) throws IdentityUserStoreMgtException {
    UserStorePersistanceDTO userStorePersistanceDTO = getUserStorePersistanceDTO(userStoreDTO, getUserStoreProperties(userStoreDTO, userStoreDTO.getDomainId()));
    doAddUserStore(userStorePersistanceDTO);
}
Also used : UserStorePersistanceDTO(org.wso2.carbon.identity.user.store.configuration.dto.UserStorePersistanceDTO)

Example 4 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO in project carbon-identity-framework by wso2.

the class AbstractUserStoreDAO method getUserStores.

@Override
public UserStoreDTO[] getUserStores() throws IdentityUserStoreMgtException {
    UserStorePersistanceDTO[] userStorePersistanceDTOS = doGetAllUserStores();
    List<UserStoreDTO> userStoreDTOs = new ArrayList<>();
    for (UserStorePersistanceDTO userStorePersistanceDTO : userStorePersistanceDTOS) {
        userStoreDTOs.add(userStorePersistanceDTO.getUserStoreDTO());
    }
    return userStoreDTOs.toArray(new UserStoreDTO[userStoreDTOs.size()]);
}
Also used : UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO) ArrayList(java.util.ArrayList) UserStorePersistanceDTO(org.wso2.carbon.identity.user.store.configuration.dto.UserStorePersistanceDTO)

Example 5 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO in project carbon-identity-framework by wso2.

the class UserStoreConfigAdminService method changeUserStoreState.

/**
 * Update a domain to be disabled/enabled in file repository.
 *
 * @param domain Name of the domain to be updated
 * @param isDisable Whether to disable/enable domain(true/false)
 * @throws IdentityUserStoreMgtException If error occurs during domain validation
 * @throws TransformerConfigurationException If error occurs during configuration transformation
 */
public void changeUserStoreState(String domain, Boolean isDisable) throws IdentityUserStoreMgtException, TransformerConfigurationException {
    validateDomain(domain, isDisable);
    try {
        triggerListenersOnUserStorePreStateChange(domain, isDisable);
    } catch (UserStoreException e) {
        throw new IdentityUserStoreMgtException("Error occurred while triggering the user store pre state change" + " listeners.");
    }
    UserStoreDTO userStoreDTO = getUserStoreDTO(domain, isDisable, null);
    updateStateInFileRepository(userStoreDTO);
}
Also used : IdentityUserStoreMgtException(org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException) UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO) UserStoreException(org.wso2.carbon.user.api.UserStoreException)

Aggregations

UserStoreDTO (org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO)21 UserStoreDTO (org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO)14 IdentityUserStoreMgtException (org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException)13 UserStoreException (org.wso2.carbon.user.api.UserStoreException)11 ArrayList (java.util.ArrayList)9 AbstractUserStoreDAOFactory (org.wso2.carbon.identity.user.store.configuration.dao.AbstractUserStoreDAOFactory)8 Test (org.testng.annotations.Test)7 PropertyDTO (org.wso2.carbon.identity.user.store.configuration.stub.dto.PropertyDTO)7 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)7 UserStorePersistanceDTO (org.wso2.carbon.identity.user.store.configuration.dto.UserStorePersistanceDTO)6 IdentityUserStoreClientException (org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreClientException)6 PropertyDTO (org.wso2.carbon.identity.user.store.configuration.dto.PropertyDTO)5 File (java.io.File)4 UserStoreConfigService (org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService)4 UserStoreConfigListener (org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener)4 SecondaryUserStoreConfigurationUtil.buildIdentityUserStoreClientException (org.wso2.carbon.identity.user.store.configuration.utils.SecondaryUserStoreConfigurationUtil.buildIdentityUserStoreClientException)4 UserStoreClientException (org.wso2.carbon.user.api.UserStoreClientException)4 H2DataBaseManager (org.wso2.carbon.automation.test.utils.dbutils.H2DataBaseManager)3 MaskedProperty (org.wso2.carbon.identity.user.store.configuration.beans.MaskedProperty)3 Property (org.wso2.carbon.user.api.Property)3