Search in sources :

Example 6 with UniqueIDUserOperationEventListener

use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.

the class IdentityUserIdResolverListener method doPreDeleteUser.

@Override
public boolean doPreDeleteUser(String userName, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }
    // Setting the thread-local to keep userID for doPostDeleteUserWithID listener.
    IdentityUtil.threadLocalProperties.get().put(DO_PRE_DELETE_USER_USER_ID, userID);
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener).doPreDeleteUserWithID(userID, userStoreManager)) {
                return false;
            }
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UniqueIDUserOperationEventListener(org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager)

Example 7 with UniqueIDUserOperationEventListener

use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.

the class IdentityUserIdResolverListener method doPreUpdateUserListOfInternalRole.

@Override
public boolean doPreUpdateUserListOfInternalRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    String[] deletedUserIDs;
    try {
        deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    String[] newUserIDs;
    try {
        newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener).doPreUpdateUserListOfInternalRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
                return false;
            }
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UniqueIDUserOperationEventListener(org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener) UserStoreException(org.wso2.carbon.user.core.UserStoreException) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager)

Aggregations

AbstractIdentityUserOperationEventListener (org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener)7 AbstractUserStoreManager (org.wso2.carbon.user.core.common.AbstractUserStoreManager)7 UniqueIDUserOperationEventListener (org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener)7 UserOperationEventListener (org.wso2.carbon.user.core.listener.UserOperationEventListener)7 UserStoreException (org.wso2.carbon.user.core.UserStoreException)4 AuthenticationResult (org.wso2.carbon.user.core.common.AuthenticationResult)1 User (org.wso2.carbon.user.core.common.User)1 UniqueIDUserClaimSearchEntry (org.wso2.carbon.user.core.model.UniqueIDUserClaimSearchEntry)1