Skip to content

Commit

Permalink
Improve the organization resolving logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sadilchamishka committed Oct 27, 2023
1 parent d1d4280 commit 4aff388
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import static org.wso2.carbon.identity.api.user.common.Constants.USER_API_PATH_COMPONENT;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_ERROR_BUILDING_PAGINATED_RESPONSE_URL;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_USER_ROOT_ORGANIZATION_NOT_FOUND;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.SUPER_ORG_ID;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.buildURIForBody;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.getOrganizationId;
import static org.wso2.carbon.identity.rest.api.user.organization.v1.Constants.ASC_SORT_ORDER;
Expand All @@ -77,10 +76,7 @@ public class UserOrganizationService {
public RootOrganizationResponse getUserOrganizationRoot() {

String userId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserId();
String accessedOrgId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getOrganizationId();
if (StringUtils.isBlank(accessedOrgId)) {
accessedOrgId = SUPER_ORG_ID;
}
String accessedOrgId = getOrganizationId();
try {
String rootOrgId = getOrganizationUserResidentResolverService()
.resolveResidentOrganization(userId, accessedOrgId)
Expand All @@ -102,10 +98,7 @@ public RootOrganizationResponse getUserOrganizationRoot() {
public List<BasicOrganizationObject> getUserOrganizationHierarchyUptoResidentOrganization() {

String userId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserId();
String accessedOrgId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getOrganizationId();
if (StringUtils.isBlank(accessedOrgId)) {
accessedOrgId = SUPER_ORG_ID;
}
String accessedOrgId = getOrganizationId();
try {
List<BasicOrganizationObject> rootDescendantsOrganizationResponseList = new ArrayList<>();
List<BasicOrganization> basicOrganizationList = getOrganizationUserResidentResolverService()
Expand Down

0 comments on commit 4aff388

Please sign in to comment.