Skip to content

Commit

Permalink
Merge pull request #1771 from IsuraD/4.4.x
Browse files Browse the repository at this point in the history
Adding multi Attribute search capability with pagination support
  • Loading branch information
darshanasbg authored May 18, 2018
2 parents 97064a0 + 2ba2c7d commit ad15327
Show file tree
Hide file tree
Showing 17 changed files with 2,189 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.wso2.carbon.user.core;

import org.wso2.carbon.user.core.model.Condition;
import org.wso2.carbon.user.core.model.UserClaimSearchEntry;

import java.util.List;
Expand All @@ -25,6 +26,49 @@
*/
public interface PaginatedUserStoreManager {

/**
* Retrieves a list of paginated user names.
*
* @param filter The string to filter out user.
* @param limit No of search results. If the given value is greater than the system configured max limit
* it will be reset to the system configured max limit.
* @param offset Start index of the user search.
* @return An array of user names.
* @throws UserStoreException User Store Exception.
*/
String[] listUsers(String filter, int limit, int offset) throws UserStoreException;

/**
* Retrieves a list of paginated user names from user claims.
*
* @param claim Claim URI. If the claim uri is domain qualified, search the users respective user store. Else
* search recursively.
* @param claimValue Claim value.
* @param profileName User profile name.
* @param limit No of search results. If the given value is greater than the system configured max limit
* it will be reset to the system configured max limit.
* @param offset Start index of the user search.
* @return An array of user names.
* @throws UserStoreException User Store Exception.
*/
String[] getUserList(String claim, String claimValue, String profileName, int limit, int offset) throws
UserStoreException;

/**
* Retrieves a list of paginated user names conditionally.
*
* @param condition Conditional filter.
* @param profileName User profile name.
* @param domain User Store Domain.
* @param limit No of search results. If the given value is greater than the system configured max limit
* it will be reset to the system configured max limit.
* @param offset Start index of the user search.
* @return An array of user names.
* @throws UserStoreException User Store Exception.
*/
String[] getUserList(Condition condition, String domain, String profileName, int limit, int offset, String sortBy,
String sortOrder) throws UserStoreException;

/**
* Get claim values of users.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;
import org.wso2.carbon.user.core.listener.UserManagementErrorEventListener;
import org.wso2.carbon.user.core.model.Condition;

import java.util.Map;

Expand Down Expand Up @@ -145,9 +146,86 @@ public boolean onGetUserListFailure(String errorCode, String errorMessage, Strin
return true;
}

/**
* Defines any additional actions that need to be done if there is a failure retrieving user list.
*
* @param errorCode Error code.
* @param errorMessage Error message.
* @param claim Claim URI
* @param claimValue Claim Value
* @param limit No of search results.
* @param offset Start index of the search.
* @param profileName Name of the profile.
* @param userStoreManager User Store Manager.
* @return true if the handing succeeded.
* @throws UserStoreException Exception that will be thrown during the execution of the method.
*/
public boolean onGetUserListFailure(String errorCode, String errorMessage, String claim, String claimValue, int
limit, int offset, String profileName, UserStoreManager userStoreManager) throws UserStoreException {

return true;
}

/**
* Defines any additional actions that need to be done if there is a failure on retrieving conditional user list.
*
* @param errorCode Error code.
* @param errorMassage Error Message.
* @param domain user store domain.
* @param profileName profile name.
* @param limit number of search results.
* @param offset start index of the search.
* @param sortBy sort by attribute.
* @param sortOrder sort order.
* @param userStoreManager user store domain.
* @throws UserStoreException UserStoreException
*/
public boolean onGetUserListFailure(String errorCode, String errorMassage, Condition condition, String domain,
String profileName, int limit, int offset, String sortBy, String sortOrder,
UserStoreManager userStoreManager) throws UserStoreException {

return true;
}

@Override
public boolean onUpdatePermissionsOfRoleFailure(String errorCode, String errorMessage, String roleName,
Permission[] permissions, UserStoreManager userStoreManager) throws UserStoreException {
return true;
}

/**
* Defines any additional actions that need to be done if there is a failure retrieving paginated user list.
*
* @param errorCode Error code.
* @param errorMessage Error message.
* @param claim Claim URI
* @param claimValue Claim Value
* @param profileName Name of the profile.
* @param userStoreManager User Store Manager.
* @return true if the handing succeeded.
* @throws UserStoreException Exception that will be thrown during the execution of the method.
*/
boolean onGetPaginatedUserListFailure(String errorCode, String errorMessage, String claim, String claimValue,
String profileName, UserStoreManager userStoreManager) throws UserStoreException {

return true;
}

/**
* Defines any additional actions that need to be done if there is a failure retrieving paginated user list.
*
* @param errorCode Error code.
* @param errorMessage Error message.
* @param filter Username filter.
* @param limit No of search results.
* @param offset Start index of the search.
* @param userStoreManager User Store Manager.
* @return true if the handing succeeded.
* @throws UserStoreException Exception that will be thrown during the execution of the method.
*/
boolean onListUsersFailure(String errorCode, String errorMessage, String filter, int limit, int offset,
UserStoreManager userStoreManager) throws UserStoreException {

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;
import org.wso2.carbon.user.core.listener.UserOperationEventListener;
import org.wso2.carbon.user.core.model.Condition;
import org.wso2.carbon.user.core.model.UserClaimSearchEntry;

import java.util.List;
Expand Down Expand Up @@ -331,6 +332,44 @@ public boolean doPreGetUserList(String claimUri, String claimValue, final List<S
return true;
}

/**
* Pre listener for the get paginated conditional user list method.
*
* @param condition condition.
* @param domain user store domain.
* @param profileName profile name.
* @param limit number of search results.
* @param offset start index of the search.
* @param sortBy sort By attribute
* @param sortOrder sort order.
* @param userStoreManager userStoreManager.
* @throws UserStoreException UserStoreException
*/
public boolean doPreGetUserList(Condition condition, String domain, String profileName, int limit, int offset, String sortBy, String
sortOrder, UserStoreManager userStoreManager) throws UserStoreException {

return true;
}


/**
* Pre listener for the get paginated user list method.
*
* @param claimUri Claim URI.
* @param claimValue Value of the given claim URI.
* @param limit No of search results.
* @param offset Start index of the search.
* @param returnUserNameList List of user names that this listener will return.
* @param userStoreManager User store manager.
* @return False if error.
* @throws UserStoreException User Store Exception.
*/
public boolean doPreGetUserList(String claimUri, String claimValue, int limit, int offset, final List<String>
returnUserNameList, UserStoreManager userStoreManager) throws UserStoreException {

return true;
}

/**
* Post listener for the get user list method.
* @param claimUri Claim URI.
Expand All @@ -345,6 +384,76 @@ public boolean doPostGetUserList(String claimUri, String claimValue, final List<
return true;
}

/**
* Post listener for the get user list method.
*
* @param claimUri Claim URI.
* @param claimValue Value of the given claim URI.
* @param returnValues Values to be returned.
* @param limit No of search results.
* @param offset Start index of the search.
* @param userStoreManager User store manager.
* @return False if error.
* @throws UserStoreException User Store Exception.
*/
public boolean doPostGetUserList(String claimUri, String claimValue, final List<String> returnValues, int limit,
int offset, UserStoreManager userStoreManager) throws UserStoreException {

return true;
}

/**
* Post listener for the get user conditional list method.
*
* @param condition condition.
* @param domain user store domain.
* @param profileName profile name.
* @param limit number of search results.
* @param offset start index of the search.
* @param sortBy sort by attribute.
* @param sortOrder sort order.
* @param userStoreManager user store manager.
* @param users Filtered user list
* @throws UserStoreException UserStoreException
*/
public boolean doPostGetUserList(Condition condition, String domain, String profileName, int limit, int offset,
String sortBy, String sortOrder, String[] users, UserStoreManager
userStoreManager) throws UserStoreException {

return true;
}

/**
* Post listener for the get paginated user list method.
* @param claimUri Claim URI.
* @param claimValue Value of the given claim URI.
* @param returnValues Values to be returned.
* @param userStoreManager User store manager.
* @return False if error.
* @throws UserStoreException User Store Exception.
*/
public boolean doPostGetPaginatedUserList(String claimUri, String claimValue, final List<String> returnValues,
UserStoreManager userStoreManager) throws UserStoreException {
return true;
}

/**
* Post listener for the list paginated users method.
*
* @param filter username filter.
* @param limit No of search results.
* @param offset start index of the search.
* @param returnValues Values to be returned.
* @param userStoreManager User store manager.
* @return False if error.
* @throws UserStoreException User Store Exception.
*/
public boolean doPostListUsers(String filter, int limit, int offset, final List<String> returnValues,
UserStoreManager userStoreManager) throws UserStoreException {

return true;
}

/**
* Any additional tasks that need to be done after getting the role list of a user.
*
Expand Down
Loading

0 comments on commit ad15327

Please sign in to comment.