From 34df0070072a6767616c4053e3de5d8dad39abc5 Mon Sep 17 00:00:00 2001 From: sadilchamishka Date: Fri, 27 Oct 2023 15:08:26 +0530 Subject: [PATCH] Fix orgaization ID set as SUPER org issue --- .../user/organization/v1/core/UserOrganizationService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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..02df42da9 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 @@ -55,6 +55,7 @@ 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.organization.management.service.util.Utils.getTenantDomain; import static org.wso2.carbon.identity.rest.api.user.organization.v1.Constants.ASC_SORT_ORDER; import static org.wso2.carbon.identity.rest.api.user.organization.v1.Constants.DESC_SORT_ORDER; import static org.wso2.carbon.identity.rest.api.user.organization.v1.Constants.ORGANIZATIONS_ME_ENDPOINT; @@ -103,10 +104,10 @@ public List getUserOrganizationHierarchyUptoResidentOrg String userId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserId(); String accessedOrgId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getOrganizationId(); - if (StringUtils.isBlank(accessedOrgId)) { - accessedOrgId = SUPER_ORG_ID; - } try { + if (StringUtils.isBlank(accessedOrgId)) { + accessedOrgId = getOrganizationManagementService().resolveOrganizationId(getTenantDomain());; + } List rootDescendantsOrganizationResponseList = new ArrayList<>(); List basicOrganizationList = getOrganizationUserResidentResolverService() .getHierarchyUptoResidentOrganization(userId, accessedOrgId);