diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java
index f82c5c3295..455a583520 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java
@@ -92,12 +92,14 @@ public class MetadataManagementServiceImpl implements MetadataManagementService
}
try {
MetadataManagementDAOFactory.openConnection();
+ int tenantId;
if (metaKey.equals("EVALUATE_TENANTS")){
- return metadataDAO.getMetadata(MultitenantConstants.SUPER_TENANT_ID, metaKey);
+ // for getting evaluate tenant list to provide the live chat feature
+ tenantId = MultitenantConstants.SUPER_TENANT_ID;
} else {
- return metadataDAO.getMetadata(
- PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true), metaKey);
+ tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
}
+ return metadataDAO.getMetadata(tenantId, metaKey);
} catch (MetadataManagementDAOException e) {
String msg = "Error occurred while retrieving the metadata entry for metaKey:" + metaKey;
log.error(msg, e);
diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java
index 42fd8d8f09..a9d97de3a5 100644
--- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java
+++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java
@@ -1,3 +1,21 @@
+/*
+ * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
+ *
+ * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package io.entgra.ui.request.interceptor;
import com.google.gson.JsonObject;
@@ -51,12 +69,10 @@ public class HubspotHandler extends HttpServlet {
} catch (IOException e) {
log.error("Error occurred when processing POST request.", e);
}
-
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
-
try {
if (validateRequest(req, resp)) {
HttpGet getRequest = new HttpGet(HandlerUtil.generateBackendRequestURL(req,hubspotEndpoint));
@@ -80,29 +96,25 @@ public class HubspotHandler extends HttpServlet {
*/
private boolean validateRequest(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
-
- httpSession = req.getSession(false);
- gatewayUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)
- + HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme());
- iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_CORE_HOST_ENV_VAR)
- + HandlerConstants.COLON + HandlerUtil.getCorePort(req.getScheme());
- String uiConfigUrl = iotsCoreUrl + HandlerConstants.UI_CONFIG_ENDPOINT;
- uiConfigJsonObject = HandlerUtil.getUIConfigAndPersistInSession(uiConfigUrl, gatewayUrl, httpSession, resp);
- chatConfig = uiConfigJsonObject.get("chatConfig").getAsString();
- hubspotEndpoint = HandlerConstants.HTTPS_PROTOCOL + HandlerConstants.SCHEME_SEPARATOR + HandlerConstants.HUBSPOT_CHAT_URL;
-
- if (httpSession == null) {
- log.error("Unauthorized, You are not logged in. Please log in to the portal");
- HandlerUtil.handleError(resp, HttpStatus.SC_UNAUTHORIZED);
- return false;
- }
-
- if (req.getMethod() == null) {
- log.error("Bad Request, Request method is empty");
- HandlerUtil.handleError(resp, HttpStatus.SC_BAD_REQUEST);
- return false;
- }
-
- return true;
+ if (httpSession == null) {
+ log.error("Unauthorized, You are not logged in. Please log in to the portal");
+ HandlerUtil.handleError(resp, HttpStatus.SC_UNAUTHORIZED);
+ return false;
+ }
+ if (req.getMethod() == null) {
+ log.error("Bad Request, Request method is empty");
+ HandlerUtil.handleError(resp, HttpStatus.SC_BAD_REQUEST);
+ return false;
+ }
+ httpSession = req.getSession(false);
+ gatewayUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)
+ + HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme());
+ iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_CORE_HOST_ENV_VAR)
+ + HandlerConstants.COLON + HandlerUtil.getCorePort(req.getScheme());
+ String uiConfigUrl = iotsCoreUrl + HandlerConstants.UI_CONFIG_ENDPOINT;
+ uiConfigJsonObject = HandlerUtil.getUIConfigAndPersistInSession(uiConfigUrl, gatewayUrl, httpSession, resp);
+ chatConfig = uiConfigJsonObject.get("chatConfig").getAsString();
+ hubspotEndpoint = HandlerConstants.HTTPS_PROTOCOL + HandlerConstants.SCHEME_SEPARATOR + HandlerConstants.HUBSPOT_CHAT_URL;
+ return true;
}
}
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
index ba100b1178..a87ef6e44e 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
@@ -24,6 +24,7 @@
3600
10000
+
pat-na1-33bc59e0-3526-45b0-b9cf-f353d0ae0ced
false