diff --git a/components/org.wso2.carbon.identity.api.user.organization/org.wso2.carbon.identity.rest.api.user.organization.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/organization/v1/core/UserOrganizationService.java b/components/org.wso2.carbon.identity.api.user.organization/org.wso2.carbon.identity.rest.api.user.organization.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/organization/v1/core/UserOrganizationService.java index b46873e21..0fee6c466 100644 --- a/components/org.wso2.carbon.identity.api.user.organization/org.wso2.carbon.identity.rest.api.user.organization.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/organization/v1/core/UserOrganizationService.java +++ b/components/org.wso2.carbon.identity.api.user.organization/org.wso2.carbon.identity.rest.api.user.organization.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/organization/v1/core/UserOrganizationService.java @@ -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; @@ -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) @@ -102,10 +98,7 @@ public RootOrganizationResponse getUserOrganizationRoot() { public List getUserOrganizationHierarchyUptoResidentOrganization() { String userId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserId(); - String accessedOrgId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getOrganizationId(); - if (StringUtils.isBlank(accessedOrgId)) { - accessedOrgId = SUPER_ORG_ID; - } + String accessedOrgId = getOrganizationId(); try { List rootDescendantsOrganizationResponseList = new ArrayList<>(); List basicOrganizationList = getOrganizationUserResidentResolverService()