diff --git a/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/IdentityEventConstants.java b/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/IdentityEventConstants.java index d6ab1063737c..47919749e2c8 100644 --- a/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/IdentityEventConstants.java +++ b/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/IdentityEventConstants.java @@ -385,6 +385,8 @@ private EventProperty(){} public static final String LIMIT = "LIMIT"; public static final String AUTHENTICATION_RESULT = "AUTHENTICATION_RESULT"; public static final String OFFSET = "OFFSET"; + public static final String CURSOR = "CURSOR"; + public static final String DIRECTION = "DIRECTION"; public static final String SORT_BY = "SORT_BY"; public static final String SORT_ORDER = "SORT_ORDER"; public static final String USER = "USER"; diff --git a/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserIdResolverListener.java b/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserIdResolverListener.java index f4a5f0e34d75..ad44e9dc2022 100644 --- a/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserIdResolverListener.java +++ b/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserIdResolverListener.java @@ -1047,6 +1047,27 @@ public boolean doPreGetUserList(Condition condition, String domain, String profi return true; } + @Override + public boolean doPreGetUserList(Condition condition, String domain, String profileName, int limit, String cursor, + UserCoreConstants.PaginationDirection direction, String sortBy, String sortOrder, + UserStoreManager userStoreManager) + throws UserStoreException { + + if (!isEnable()) { + return true; + } + for (UserOperationEventListener listener : getUserStoreManagerListeners()) { + if (isNotAResolverListener(listener)) { + if (!((UniqueIDUserOperationEventListener) listener) + .doPreGetUserListWithID(condition, domain, profileName, limit, cursor, direction, sortBy, + sortOrder, userStoreManager)) { + return false; + } + } + } + return true; + } + @Override public boolean doPreGetUserList(String claimUri, String claimValue, int limit, int offset, List returnUserNameList, UserStoreManager userStoreManager) @@ -1142,6 +1163,29 @@ public boolean doPostGetUserList(Condition condition, String domain, String prof return true; } + @Override + public boolean doPostGetUserList(Condition condition, String domain, String profileName, int limit, String cursor, + UserCoreConstants.PaginationDirection direction, String sortBy, String sortOrder, + String[] returnUserNameList, UserStoreManager userStoreManager) + throws UserStoreException { + + if (!isEnable()) { + return true; + } + List returnUsersList = getUsersFromNames((AbstractUserStoreManager) userStoreManager, + Arrays.asList(returnUserNameList)); + for (UserOperationEventListener listener : getUserStoreManagerListeners()) { + if (isNotAResolverListener(listener)) { + if (!((UniqueIDUserOperationEventListener) listener) + .doPostGetUserListWithID(condition, domain, profileName, limit, cursor, direction, sortBy, + sortOrder, returnUsersList, userStoreManager)) { + return false; + } + } + } + return true; + } + private List getUsersFromNames(AbstractUserStoreManager userStoreManager, List userList) throws UserStoreException { diff --git a/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserNameResolverListener.java b/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserNameResolverListener.java index 618e30b79580..dbac32efaed9 100644 --- a/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserNameResolverListener.java +++ b/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/listener/IdentityUserNameResolverListener.java @@ -1060,6 +1060,26 @@ public boolean doPreGetUserListWithID(Condition condition, String domain, String return true; } + @Override + public boolean doPreGetUserListWithID(Condition condition, String domain, String profileName, int limit, + String cursor, UserCoreConstants.PaginationDirection direction, String sortBy, + String sortOrder, UserStoreManager userStoreManager) + throws UserStoreException { + + if (!isEnable()) { + return true; + } + for (UserOperationEventListener listener : getUserStoreManagerListeners()) { + if (isNotAResolverListener(listener)) { + if (!listener.doPreGetUserList(condition, domain, profileName, limit, cursor, direction, sortBy, + sortOrder, userStoreManager)) { + return false; + } + } + } + return true; + } + @Override public boolean doPostGetUserListWithID(Condition condition, String domain, String profileName, int limit, int offset, String sortBy, String sortOrder, List users, @@ -1084,6 +1104,27 @@ public boolean doPostGetUserListWithID(Condition condition, String domain, Strin return true; } + @Override + public boolean doPostGetUserListWithID(Condition condition, String domain, String profileName, int limit, + String cursor, UserCoreConstants.PaginationDirection direction, String sortBy, String sortOrder, + List users, UserStoreManager userStoreManager) + throws UserStoreException { + + if (!isEnable()) { + return true; + } + List 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, cursor, direction, sortBy, sortOrder, + userNames, userStoreManager); + } + } + return true; + } + @Override public boolean doPostGetUserListOfRoleWithID(String roleName, List userList, UserStoreManager userStoreManager) throws UserStoreException { diff --git a/pom.xml b/pom.xml index d0a39596ee43..df510bceb137 100644 --- a/pom.xml +++ b/pom.xml @@ -1831,7 +1831,7 @@ UTF-8 - 4.10.10 + 4.10.17-SNAPSHOT 4.7.0 [4.5.0, 5.0.0) [1.0.1, 2.0.0)