Search in sources :

Example 21 with UserOperationEventListener

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

the class IdentityUserNameResolverListener method doPostGetUserListWithID.

@Override
public boolean doPostGetUserListWithID(Condition condition, String domain, String profileName, int limit, int offset, String sortBy, String sortOrder, List<User> users, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    List<String> userNamesList = users.stream().map(User::getUsername).collect(Collectors.toList());
    String[] userNames = userNamesList.toArray(new String[0]);
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            return listener.doPostGetUserList(condition, domain, profileName, limit, offset, sortBy, sortOrder, userNames, userStoreManager);
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener)

Example 22 with UserOperationEventListener

use of org.wso2.carbon.user.core.listener.UserOperationEventListener 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

UserOperationEventListener (org.wso2.carbon.user.core.listener.UserOperationEventListener)22 AbstractIdentityUserOperationEventListener (org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener)19 AbstractUserStoreManager (org.wso2.carbon.user.core.common.AbstractUserStoreManager)9 UniqueIDUserOperationEventListener (org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener)7 UserStoreException (org.wso2.carbon.user.core.UserStoreException)4 Activate (org.osgi.service.component.annotations.Activate)3 TenantMgtListener (org.wso2.carbon.stratos.common.listeners.TenantMgtListener)3 ServiceRegistration (org.osgi.framework.ServiceRegistration)2 User (org.wso2.carbon.user.core.common.User)2 UniqueIDUserClaimSearchEntry (org.wso2.carbon.user.core.model.UniqueIDUserClaimSearchEntry)2 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1 AxisObserver (org.apache.axis2.engine.AxisObserver)1 BundleContext (org.osgi.framework.BundleContext)1 UserSessionException (org.wso2.carbon.identity.application.authentication.framework.exception.UserSessionException)1 ClaimMetadataMgtListener (org.wso2.carbon.identity.claim.metadata.mgt.listener.ClaimMetadataMgtListener)1 AbstractEventHandler (org.wso2.carbon.identity.event.handler.AbstractEventHandler)1 IdentityMgtEventListener (org.wso2.carbon.identity.mgt.IdentityMgtEventListener)1 IdentityUserIdResolverListener (org.wso2.carbon.identity.mgt.listener.IdentityUserIdResolverListener)1 IdentityUserNameResolverListener (org.wso2.carbon.identity.mgt.listener.IdentityUserNameResolverListener)1