Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor based pagination for SCIM resources phase 1. #3281

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.wso2.carbon.user.core.model.Condition;
import org.wso2.carbon.user.core.model.UniqueIDUserClaimSearchEntry;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -401,6 +402,25 @@ List<User> getUserListWithID(String claim, String claimValue, String profileName
List<User> getUserListWithID(Condition condition, String domain, String profileName, int limit, int offset,
String sortBy, String sortOrder) throws UserStoreException;

/**
* Retrieves a list of paginated usernames conditionally (using cursor pagination).
*
* @param condition Conditional filter.
* @param domain User Store Domain.
* @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 cursor Starting cursor value of the user search.
* @param direction Pagination direction.
* @return An array of usernames.
* @throws UserStoreException User Store Exception.
*/
default List<User> getUserListWithID(Condition condition, String domain, String profileName, int limit,
String cursor, String direction, String sortBy, String sortOrder) throws UserStoreException {

return Collections.emptyList();
}

/**
* Get claim values of users.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ public class UserCoreConstants {
public static final String USER_LOCKED = "true";
public static final String USER_UNLOCKED = "false";

// Properties used for cursor pagination direction
public enum PaginationDirection {
PREVIOUS, NEXT
}

public static final class RealmConfig {
public static final String LOCAL_NAME_USER_MANAGER = "UserManager";
public static final String LOCAL_NAME_REALM = "Realm";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.wso2.carbon.user.core.common;

import org.wso2.carbon.user.api.Permission;
import org.wso2.carbon.user.core.UserCoreConstants;
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;
import org.wso2.carbon.user.core.listener.UniqueIDUserManagementErrorEventListener;
Expand Down Expand Up @@ -298,6 +299,15 @@ public boolean onGetUserListFailureWithID(String errorCode, String errorMassage,
return true;
}

@Override
public boolean onGetUserListFailureWithID(String errorCode, String errorMassage, Condition condition, String domain,
String profileName, int limit, String cursor, UserCoreConstants.PaginationDirection direction,
String sortBy, String sortOrder, UserStoreManager userStoreManager)
throws UserStoreException {

return true;
}

@Override
public boolean onGetUserFailureWithID(String errorCode, String errorMessage, String userID,
String[] requestedClaims, String profileName, UserStoreManager userStoreManager) throws UserStoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.wso2.carbon.user.core.common;

import org.wso2.carbon.user.api.Permission;
import org.wso2.carbon.user.core.UserCoreConstants;
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;
import org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener;
Expand Down Expand Up @@ -400,6 +401,15 @@ 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 {

return true;
}

@Override
public boolean doPreGetUserListWithID(String claimUri, String claimValue, int limit, int offset,
final List<User> returnUsersList, UserStoreManager userStoreManager) throws UserStoreException {
Expand Down Expand Up @@ -444,6 +454,15 @@ 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<User> users, UserStoreManager userStoreManager)
throws UserStoreException {

return true;
}

@Override
public boolean doPreGetUserWithID(String userID, String[] requestedClaims, String profileName,
UserStoreManager userStoreManager) throws UserStoreException {
Expand Down
Loading