From 1fa232f1ed772e8e637a47b91c5dee10922feed2 Mon Sep 17 00:00:00 2001 From: Chamila Adhikarinayake Date: Thu, 12 Sep 2024 12:50:01 +0530 Subject: [PATCH] Fix shared application view issue --- .../rest/api/store/v1/impl/ApplicationsApiServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApplicationsApiServiceImpl.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApplicationsApiServiceImpl.java index e2968fd67bda..f5ea01076981 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApplicationsApiServiceImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApplicationsApiServiceImpl.java @@ -407,6 +407,7 @@ public Response applicationsApplicationIdGet(String applicationId, String ifNone String username = RestApiCommonUtil.getLoggedInUsername(); try { String organization = RestApiUtil.getValidatedOrganization(messageContext); + OrganizationInfo orgInfo = RestApiUtil.getOrganizationInfo(messageContext); APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username); Application application = apiConsumer.getApplicationByUUID(applicationId, organization); if (application != null) { @@ -431,7 +432,8 @@ public Response applicationsApplicationIdGet(String applicationId, String ifNone } } application.setApplicationAttributes(applicationAttributes); - if (RestAPIStoreUtils.isUserAccessAllowedForApplication(application)) { + if (RestAPIStoreUtils.isUserAccessAllowedForApplication(application) || (orgInfo.getName() != null + && orgInfo.getName().equals(application.getSharedOrganization()))) { ApplicationDTO applicationDTO = ApplicationMappingUtil.fromApplicationtoDTO(application); applicationDTO.setHashEnabled(OAuthServerConfiguration.getInstance().isClientSecretHashEnabled()); Set scopes = apiConsumer