Skip to content

Commit

Permalink
Rename identity.xml scim2 config to EnableGroupBasedUserFilteringImpr…
Browse files Browse the repository at this point in the history
…ovements.
  • Loading branch information
dhaura committed Apr 2, 2024
1 parent 2fb85ef commit 6971d70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ private UsersGetResponse filterUsersBySingleAttribute(ExpressionNode node, Map<S
maxLimit = Math.max(maxLimit, limit);
}
// Get total users based on the filter query without depending on pagination params.
if (SCIMCommonUtils.isRetrieveTotalResultsByUserCountEnabled()) {
if (SCIMCommonUtils.isGroupBasedUserFilteringImprovementsEnabled()) {
// Get the total user count by the filter query.
totalResults += getUserCountByAttribute(node, 1, maxLimit, sortBy, sortOrder, domainName);
} else {
Expand All @@ -1472,8 +1472,8 @@ private UsersGetResponse filterUsersBySingleAttribute(ExpressionNode node, Map<S
* @param sortOrder Sorting order
* @param domainName Domain to run the filter
* @return User count
* @throws BadRequestException
* @throws CharonException
* @throws BadRequestException Exception occurred due to a bad request.
* @throws CharonException Error while filtering the users.
*/
private int getUserCountByAttribute(Node node, int offset, int limit, String sortBy,
String sortOrder, String domainName) throws BadRequestException, CharonException {
Expand Down Expand Up @@ -1680,7 +1680,7 @@ private Set<org.wso2.carbon.user.core.common.User> filterUsersByGroup(Node node,
try {
List<String> roleNames = getRoleNames(attributeName, filterOperation, attributeValue);
Set<org.wso2.carbon.user.core.common.User> users;
if (SCIMCommonUtils.isRetrieveTotalResultsByUserCountEnabled()) {
if (SCIMCommonUtils.isGroupBasedUserFilteringImprovementsEnabled()) {
users = getUserListOfGroups(roleNames);
} else {
users = getUserListOfRoles(roleNames);
Expand Down Expand Up @@ -1733,8 +1733,8 @@ private Set<org.wso2.carbon.user.core.common.User> filterUsers(Node node, int of
* @param node Expression or Operation node.
* @param domainName Domain name.
* @return User count for the filtered group.
* @throws CharonException
* @throws BadRequestException
* @throws CharonException Error while filtering the users.
* @throws BadRequestException Exception occurred due to a bad request.
*/
private int getUserCountByGroup(Node node, String domainName)
throws CharonException, BadRequestException {
Expand Down Expand Up @@ -2057,7 +2057,7 @@ private Set<org.wso2.carbon.user.core.common.User> filterUsersUsingLegacyAPIs(Ex
try {
if (SCIMConstants.UserSchemaConstants.GROUP_URI.equals(attributeName)) {
List<String> roleNames = getRoleNames(attributeName, filterOperation, attributeValue);
if (SCIMCommonUtils.isRetrieveTotalResultsByUserCountEnabled()) {
if (SCIMCommonUtils.isGroupBasedUserFilteringImprovementsEnabled()) {
users = getUserListOfGroups(roleNames);
} else {
users = getUserListOfRoles(roleNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public class SCIMCommonConstants {
"SCIM2.ConsiderMaxLimitForTotalResult";
public static final String SCIM_ENABLE_CONSIDER_TOTAL_RECORDS_FOR_TOTAL_RESULT_OF_LDAP =
"SCIM2.ConsiderTotalRecordsForTotalResultOfLDAP";
public static final String SCIM_ENABLE_RETRIEVE_TOTAL_RESULTS_BY_USER_COUNT =
"SCIM2.EnableRetrieveTotalResultsByUserCount";
public static final String SCIM_ENABLE_GROUP_BASED_USER_FILTERING_IMPROVEMENTS =
"SCIM2.EnableGroupBasedUserFilteringImprovements";
public static final String SCIM_ENABLE_MANDATE_DOMAIN_FOR_GROUPNAMES_IN_GROUPS_RESPONSE =
"SCIM2.MandateDomainForGroupNamesInGroupsResponse";
public static final String SCIM_ENABLE_MANDATE_DOMAIN_FOR_USERNAMES_AND_GROUPNAMES_IN_RESPONSE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,14 @@ public static boolean isEnterpriseUserExtensionEnabled() {
}

/**
* Checks whether the identity.xml config is available to retrieve totalResults by user count.
* Checks whether the identity.xml config is available to enable group based user filtering improvements.
*
* @return whether 'RetrieveTotalResultsByUserCount' property is enabled in identity.xml.
* @return Whether 'SCIM_ENABLE_GROUP_BASED_USER_FILTERING_IMPROVEMENTS' property is enabled in identity.xml.
*/
public static boolean isRetrieveTotalResultsByUserCountEnabled() {
public static boolean isGroupBasedUserFilteringImprovementsEnabled() {

return Boolean.parseBoolean(IdentityUtil.getProperty(
SCIMCommonConstants.SCIM_ENABLE_RETRIEVE_TOTAL_RESULTS_BY_USER_COUNT));
SCIMCommonConstants.SCIM_ENABLE_GROUP_BASED_USER_FILTERING_IMPROVEMENTS));
}

/**
Expand Down

0 comments on commit 6971d70

Please sign in to comment.