org.wso2.carbon.user.core.UserStoreException Java Examples

The following examples show how to use org.wso2.carbon.user.core.UserStoreException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: UserOperationEventListenerImpl.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreDeleteUser(String userName, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (StringUtils.isBlank(domainName)) {
        domainName = UserAccountAssociationConstants.PRIMARY_USER_DOMAIN;
    }

    try {
        if (log.isDebugEnabled()) {
            log.debug("User account associations for user " + userName + " with tenant id " +
                      userStoreManager.getTenantId() + " is getting deleted.");
        }

        UserAccountAssociationDAO.getInstance().deleteUserAssociation(domainName, userStoreManager.getTenantId()
                , userName);
        return true;

    } catch (UserAccountAssociationException e) {
        throw new UserStoreException(String.format(UserAccountAssociationConstants.ErrorMessages
                                             .ERROR_WHILE_DELETING_USER_ASSOC.getDescription(), userName), e);
    }
}
 
Example #3
Source File: CacheClearingUserOperationListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * This method is overridden to clear caches on doPostDeleteRole operation
 *
 * @param roleName         Deleted role name
 * @param userStoreManager UserStoreManagerClass
 * @return Always Returns true, since no major effect on further procedures
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostDeleteRole(String roleName, UserStoreManager userStoreManager) throws
                                                                                    UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post delete role operation for role " +
                  roleName);
    }
    clearCarbonAttributeCache();
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    return true;
}
 
Example #4
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostGetRoleListOfUser(String userName, String filter, String[] roleList,
                                       UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostGetRoleListOfUserWithID(userID, filter, roleList, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #5
Source File: UserSignUpWorkflowExecutorTest.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
@Test
public void testFailuresToUpdateRoleOfUserWhenRemoteServiceCallFailed() throws UserStoreException, RemoteException,
        UserAdminUserAdminException {
    Mockito.when(userAdminStub.getRolesOfUser(username, "*", -1)).thenReturn(flaggedNames);
    Mockito.when(userStoreManager.isExistingRole(role)).thenReturn(true);

    //Test failure to update the user role when
    Mockito.doThrow(new RemoteException("Exception occurred while updating the roles of user")).when(userAdminStub)
            .updateRolesOfUser(Mockito.anyString(), new
                    String[]{Mockito.anyString()});
    try {
        UserSignUpWorkflowExecutor.updateRolesOfUser(serverURL, adminUsername, adminPassword, username, role);
        Assert.fail("Expected exception has been not thrown while updating the roles of user failed");
    } catch (Exception e) {
        Assert.assertEquals(e.getMessage(), "Exception occurred while updating the roles of user");
    }
}
 
Example #6
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostGetUserListWithID(String claimUri, String claimValue, List<User> returnUsersList,
                                       UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    List<String> returnUserNamesList = returnUsersList.stream().map(User::getUsername).collect(Collectors.toList());

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostGetUserList(claimUri, claimValue, returnUserNamesList, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #7
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreGetUserListWithID(String claimUri, String claimValue, int limit, int offset,
                                      List<User> returnUsersList, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    List<String> returnUserNamesList = returnUsersList.stream().map(User::getUsername).collect(Collectors.toList());

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            return listener
                    .doPreGetUserList(claimUri, claimValue, limit, offset, returnUserNamesList, userStoreManager);
        }
    }

    return true;
}
 
Example #8
Source File: CaptchaUtil.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
public static void setAnonAuthorization(String path, UserRealm userRealm)
        throws RegistryException {

    if (userRealm == null) {
        return;
    }

    try {
        AuthorizationManager accessControlAdmin = userRealm.getAuthorizationManager();
        String everyoneRole = CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME;

        accessControlAdmin.authorizeRole(everyoneRole, path, ActionConstants.GET);
        accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.PUT);
        accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.DELETE);
        accessControlAdmin.denyRole(everyoneRole, path, AccessControlConstants.AUTHORIZE);

    } catch (UserStoreException e) {
        String msg = "Could not set authorizations for the " + path + ".";
        log.error(msg, e);
        throw new RegistryException(msg);
    }
}
 
Example #9
Source File: UserOperationsNotificationListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * Overridden to trigger Notification Sending module to send messages to registered modules
 * on doPostSetUserClaimValues
 *
 * @param username         username of user whose claim values are updated
 * @param claims           set of claims
 * @param profileName      profile name
 * @param userStoreManager instance of user store manager called
 * @return always returns true since no major effect on further operations
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostSetUserClaimValues(String username,
                                        Map<String, String> claims, String profileName,
                                        UserStoreManager userStoreManager)
        throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending user claim values update notification for user " + username);
    }
    sendNotification(EVENT_TYPE_PROFILE_UPDATE, username);
    // Returns true since no major effect on upcoming listeners
    return true;
}
 
Example #10
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostGetRoleListOfUsers(String[] userNames, Map<String, List<String>> rolesOfUsersMap,
                                        UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    List<String> userIDsList = ((AbstractUserStoreManager) userStoreManager)
            .getUserIDsFromUserNames(Arrays.asList(userNames));

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostGetRoleListOfUsersWithID(userIDsList, rolesOfUsersMap, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #11
Source File: UserRealmProxy.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
private void buildUIPermissionNodeAllSelected(Collection parent, UIPermissionNode parentNode,
                                              Registry registry, Registry tenantRegistry) throws RegistryException,
        UserStoreException {

    String[] children = parent.getChildren();
    UIPermissionNode[] childNodes = new UIPermissionNode[children.length];
    for (int i = 0; i < children.length; i++) {
        String child = children[i];
        Resource resource = null;

        if (registry.resourceExists(child)) {
            resource = registry.get(child);
        } else if (tenantRegistry != null) {
            resource = tenantRegistry.get(child);
        } else {
            throw new RegistryException("Permission resource not found in the registry.");
        }

        childNodes[i] = getUIPermissionNode(resource, true);
        if (resource instanceof Collection) {
            buildUIPermissionNodeAllSelected((Collection) resource, childNodes[i], registry,
                    tenantRegistry);
        }
    }
    parentNode.setNodeList(childNodes);
}
 
Example #12
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostDeleteUserClaimValuesWithID(String userID, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userName = getUserNameFromUserID(userID, (AbstractUserStoreManager) userStoreManager);
    if (userName == null) {
        return handleUserNameResolveFailure(userID, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostDeleteUserClaimValues(userName, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #13
Source File: DefaultProvisioningHandler.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
private void updateUserWithNewRoleSet(String username, UserStoreManager userStoreManager, String[] newRoles,
                                      Collection<String> addingRoles, Collection<String> deletingRoles)
        throws UserStoreException {
    if (log.isDebugEnabled()) {
        log.debug("Deleting roles : "
                  + Arrays.toString(deletingRoles.toArray(new String[deletingRoles.size()]))
                  + " and Adding roles : "
                  + Arrays.toString(addingRoles.toArray(new String[addingRoles.size()])));
    }
    userStoreManager.updateRoleListOfUser(username, deletingRoles.toArray(new String[deletingRoles
                                                  .size()]),
                                          addingRoles.toArray(new String[addingRoles.size()]));
    if (log.isDebugEnabled()) {
        log.debug("Federated user: " + username
                  + " is updated by authentication framework with roles : "
                  + Arrays.toString(newRoles));
    }
}
 
Example #14
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostSetUserClaimValuesWithID(String userID, Map<String, String> claims, String profileName,
                                              UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userName = getUserNameFromUserID(userID, (AbstractUserStoreManager) userStoreManager);
    if (userName == null) {
        return handleUserNameResolveFailure(userID, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostSetUserClaimValues(userName, claims, profileName, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #15
Source File: UserProfileAdmin.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
private String[] getAvailableProfileConfiguration(
        ProfileConfigurationManager profileAdmin) throws UserStoreException {
    ProfileConfiguration[] configurations;
    String[] profileNames = new String[0];
    try {
        configurations = (ProfileConfiguration[]) profileAdmin.getAllProfiles();
    } catch (org.wso2.carbon.user.api.UserStoreException e) {
        throw new UserStoreException(e);
    }

    if (configurations != null) {
        profileNames = new String[configurations.length];
        for (int i = 0; i < configurations.length; i++) {
            profileNames[i] = configurations[i].getProfileName();
        }
    }

    return profileNames;
}
 
Example #16
Source File: UserStoreManagerService.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
public int getTenantIdofUser(String username) throws UserStoreException {

        if (Util.isSuperTenant()) {
            return getUserStoreManager().getTenantId(username);
        } else {
            StringBuilder stringBuilder
                    = new StringBuilder(AUTH_FAIL);
            stringBuilder.append(CarbonContext.getThreadLocalCarbonContext().getTenantDomain()).append(" tenant id - ")
                    .append(CarbonContext.getThreadLocalCarbonContext().getTenantId()).append(" user - ")
                    .append(CarbonContext.getThreadLocalCarbonContext().getUsername());
            log.warn(stringBuilder.toString());

            throw new UserStoreException("Access Denied");
        }

    }
 
Example #17
Source File: DirectoryServerManager.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the regular expression which defines the format of the service principle, password.
 *
 * @return Regular expression.
 * @throws DirectoryServerManagerException If unable to get RealmConfiguration.
 */
public String getPasswordConformanceRegularExpression() throws DirectoryServerManagerException {

    try {
        RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration();
        if (userStoreConfigurations != null) {
            String passwordRegEx = userStoreConfigurations.getUserStoreProperty(
                    LDAPServerManagerConstants.SERVICE_PASSWORD_REGEX_PROPERTY);
            if (passwordRegEx == null) {
                return LDAPServerManagerConstants.DEFAULT_PASSWORD_REGULAR_EXPRESSION;
            } else {
                log.info("Service password format is " + passwordRegEx);
                return passwordRegEx;
            }
        }
    } catch (UserStoreException e) {
        log.error("Unable to retrieve service password format.", e);
        throw new DirectoryServerManagerException("Unable to retrieve service password format.", e);
    }

    return LDAPServerManagerConstants.DEFAULT_PASSWORD_REGULAR_EXPRESSION;
}
 
Example #18
Source File: UserStoreActionListener.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreUpdateRoleName(String roleName, String newRoleName, UserStoreManager userStoreManager) throws
        UserStoreException {
    if (!isEnable() || isCalledViaIdentityMgtListners()) {
        return true;
    }
    try {
        UpdateRoleNameWFRequestHandler updateRoleNameWFRequestHandler = new UpdateRoleNameWFRequestHandler();
        String domain = userStoreManager.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.RealmConfig
                                                                                              .PROPERTY_DOMAIN_NAME);

        int tenantId = userStoreManager.getTenantId() ;
        String currentUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
        PrivilegedCarbonContext.startTenantFlow();
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId, true);
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(currentUser);

        return updateRoleNameWFRequestHandler.startUpdateRoleNameFlow(domain, roleName, newRoleName);
    } catch (WorkflowException e) {
        // Sending e.getMessage() since it is required to give error message to end user.
        throw new UserStoreException(e.getMessage(), e);
    } finally {
        PrivilegedCarbonContext.endTenantFlow();
    }
}
 
Example #19
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostAddRoleWithID(String roleName, String[] userIDList, Permission[] permissions,
                                   UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String[] userNames = getUserNamesFromUserIDs(userIDList, (AbstractUserStoreManager) userStoreManager);

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostAddRole(roleName, userNames, permissions, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #20
Source File: CarbonRemoteUserStoreManger.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, String> getUserClaimValues(String userName, String[] claims,
                                              String profileName) throws UserStoreException {
    Map<String, String> claimValue = new HashMap<String, String>();

    try {
        claimValue = remoteUserStore.getUserClaimValues(userName, claims, profileName);
    } catch (UserStoreException e) {
        if (!CONNECTION_REFUSED.equalsIgnoreCase(e.getMessage())) {
            throw e;
        }
        synchronized (this) {
            for (Iterator<Entry<String, WSUserStoreManager>> iterator = remoteServers
                    .entrySet().iterator(); iterator.hasNext(); ) {
                Entry<String, WSUserStoreManager> remoteStore = iterator.next();
                try {
                    claimValue = remoteStore.getValue().getUserClaimValues(userName, claims,
                            profileName);
                    remoteUserStore = remoteStore.getValue();
                    break;
                } catch (UserStoreException ex) {
                    if (!CONNECTION_REFUSED.equalsIgnoreCase(e.getMessage())) {

                        if(log.isDebugEnabled()){

                            log.debug(REMOTE_ERROR_MSG,ex);

                        }

                        throw e;
                    }
                    log.error("Failed to connect to the remote server : "
                            + remoteStore.getKey());
                }
            }
        }
    }
    return claimValue;
}
 
Example #21
Source File: ClaimManagerService.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public Claim getClaim(String claimURI) throws UserStoreException {
    try {
        return  getClaimManager().getClaim(claimURI);
    } catch (org.wso2.carbon.user.api.UserStoreException e) {
        throw new UserStoreException(e);
    }
}
 
Example #22
Source File: UserProfileAdmin.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public boolean isAddProfileEnabled() throws UserProfileException {
    UserRealm realm = getUserRealm();
    UserStoreManager userStoreManager = null;
    try {
        userStoreManager = realm.getUserStoreManager();
    } catch (UserStoreException e) {
        String errorMessage = "Error in obtaining UserStoreManager.";
        log.error(errorMessage, e);
        throw new UserProfileException(errorMessage, e);
    }
    return userStoreManager.isMultipleProfilesAllowed();
}
 
Example #23
Source File: WSAuthorizationManager.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
public void clearResourceAuthorizations(String resourceId) throws UserStoreException {
    try {
        stub.clearResourceAuthorizations(resourceId);
    } catch (Exception e) {
        this.handleException(e.getMessage(), e);
    }

}
 
Example #24
Source File: SelfSignupUtilTestCase.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
@Test(expected = APIManagementException.class)
public void testIsUserNameWithAllowedDomainNameException() throws Exception {
    UserRealm userRealm = Mockito.mock(UserRealm.class);
    RealmConfiguration realmConfiguration = new RealmConfiguration();
    realmConfiguration.addRestrictedDomainForSelfSignUp("bar.com");
    Mockito.when(userRealm.getRealmConfiguration()).thenThrow(new UserStoreException());
    SelfSignUpUtil.isUserNameWithAllowedDomainName("bar.com/john", userRealm);
}
 
Example #25
Source File: UserProfileUtil.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public static boolean isUserAuthorizedToConfigureProfile(UserRealm realm, String currentUserName, String targetUser)
        throws UserStoreException {
    boolean isAuthrized = false;
    if (currentUserName == null) {
        //do nothing
    } else if (currentUserName.equals(targetUser)) {
        isAuthrized = true;
    } else {
        AuthorizationManager authorizer = realm.getAuthorizationManager();
        isAuthrized = authorizer.isUserAuthorized(currentUserName,
                CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION + "/configure/security/usermgt/profiles",
                "ui.execute");
    }
    return isAuthrized;
}
 
Example #26
Source File: CarbonRemoteUserStoreManger.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getProfileNames(String userName) throws UserStoreException {

    String[] profileNames = new String[0];

    try {
        profileNames = remoteUserStore.getProfileNames(userName);
    } catch (UserStoreException e) {
        if (!CONNECTION_REFUSED.equalsIgnoreCase(e.getMessage())) {
            throw e;
        }
        synchronized (this) {
            for (Iterator<Entry<String, WSUserStoreManager>> iterator = remoteServers
                    .entrySet().iterator(); iterator.hasNext(); ) {
                Entry<String, WSUserStoreManager> remoteStore = iterator.next();
                try {
                    profileNames = remoteStore.getValue().getRoleListOfUser(userName);
                    remoteUserStore = remoteStore.getValue();
                    break;
                } catch (UserStoreException ex) {
                    if (!CONNECTION_REFUSED.equalsIgnoreCase(e.getMessage())) {

                        if(log.isDebugEnabled()){

                            log.debug(REMOTE_ERROR_MSG,ex);

                        }

                        throw e;
                    }
                    log.error("Failed to connect to the remote server : "
                            + remoteStore.getKey());
                }
            }
        }
    }
    return profileNames;
}
 
Example #27
Source File: ClaimManagerService.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public String[] getAllClaimUris() throws UserStoreException {
    try {
        return getClaimManager().getAllClaimUris();
    } catch (org.wso2.carbon.user.api.UserStoreException e) {
        throw new UserStoreException(e);
    }
}
 
Example #28
Source File: ProfileConfigurationManagerService.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public ProfileConfiguration[] getAllProfiles() throws UserStoreException {
    try {
        return (ProfileConfiguration[]) getProfileConfigurationManager().getAllProfiles();
    } catch (org.wso2.carbon.user.api.UserStoreException e) {
        throw new UserStoreException(e);
    }
}
 
Example #29
Source File: UserStoreManagerService.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
private UserStoreManager getUserStoreManager() throws UserStoreException {
    try {
        UserRealm realm = super.getUserRealm();
        if (realm == null) {
            throw new UserStoreException(NULL_REALM_MESSAGE);
        }
        return realm.getUserStoreManager();
    } catch (Exception e) {
        throw new UserStoreException(e);
    }
}
 
Example #30
Source File: CacheClearingUserOperationListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * @param userName         User name to be updated.
 * @param deletedRoles     Roles removed from the particular user.
 * @param newRoles         New roles added to the particular user.
 * @param userStoreManager UserStoreManager instance got called
 * @return Always returns true since no major effect on further procedure.
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
public boolean doPostUpdateRoleListOfUser(String userName, String[] deletedRoles, String[] newRoles,
                                          UserStoreManager userStoreManager) throws UserStoreException {
    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post update role operation for user " +
                userName);
    }
    clearCarbonAttributeCache();
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    return true;
}