Skip to content

Commit

Permalink
Add realm configuration to get primary user store domain name.
Browse files Browse the repository at this point in the history
  • Loading branch information
DInuwan97 authored and rksk committed Dec 7, 2022
1 parent 2e6a5a0 commit 832dde6
Showing 1 changed file with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2044,17 +2044,31 @@ private Set<org.wso2.carbon.user.core.common.User> getMultiAttributeFilteredUser
private int getMaxLimit(String domainName) {

int givenMax = UserCoreConstants.MAX_USER_ROLE_LIST;
if (StringUtils.isEmpty(domainName)) {
domainName = UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME;
}

if (carbonUM.getSecondaryUserStoreManager(domainName).getRealmConfiguration()
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_MAX_USER_LIST) != null) {
givenMax = Integer.parseInt(carbonUM.getSecondaryUserStoreManager(domainName).getRealmConfiguration()
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_MAX_USER_LIST));
try {
if (StringUtils.isEmpty(domainName)) {
domainName = carbonUM.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.RealmConfig.
PROPERTY_DOMAIN_NAME);
if(StringUtils.isEmpty(domainName)){
domainName = UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME;
}
if (log.isDebugEnabled()) {
log.debug("Primary user store DomainName picked as " + domainName);
}
}
if (carbonUM.getSecondaryUserStoreManager(domainName).getRealmConfiguration()
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_MAX_USER_LIST) != null) {
givenMax = Integer.parseInt(carbonUM.getSecondaryUserStoreManager(domainName).getRealmConfiguration()
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_MAX_USER_LIST));
}

return givenMax;

} catch(NullPointerException e) {
String msg = "PRIMARY user store domain name cannot be a null value.";
throw new NullPointerException(msg);
}

return givenMax;
}

/**
Expand Down

0 comments on commit 832dde6

Please sign in to comment.