diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index d8dbd286ab..bbcaf9cd80 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index 7417be0f9e..1afb134933 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index 9b724f25e2..d37d8749a5 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index 9438df431d..4dbabbfb58 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index 0f6827daf0..7f8c08fc9d 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/util/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/util/Utils.java index ed5a587986..3474d836bd 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/util/Utils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/util/Utils.java @@ -21,24 +21,43 @@ package org.wso2.carbon.apimgt.integration.client.util; import feign.Client; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; +import javax.net.ssl.*; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; +import java.io.InputStream; +import java.security.*; +import java.security.cert.CertificateException; import java.util.regex.Matcher; import java.util.regex.Pattern; import feign.Logger; import feign.Request; import feign.Response; import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.ServerConfiguration; public class Utils { + private static final Log log = LogFactory.getLog(Utils.class); + + private static final String KEY_STORE_TYPE = "JKS"; + /** + * Default truststore type of the client + */ + private static final String TRUST_STORE_TYPE = "JKS"; + /** + * Default keymanager type of the client + */ + private static final String KEY_MANAGER_TYPE = "SunX509"; //Default Key Manager Type + /** + * Default trustmanager type of the client + */ + private static final String TRUST_MANAGER_TYPE = "SunX509"; //Default Trust Manager Type + + private static final String SSLV3 = "SSLv3"; + + //This method is only used if the mb features are within DAS. public static String replaceProperties(String text) { String regex = "\\$\\{(.*?)\\}"; @@ -55,15 +74,20 @@ public class Utils { } public static Client getSSLClient() { - return new Client.Default(getTrustedSSLSocketFactory(), new HostnameVerifier() { - @Override - public boolean verify(String s, SSLSession sslSession) { - return true; - } - }); + boolean isIgnoreHostnameVerification = Boolean.parseBoolean(System.getProperty("org.wso2.ignoreHostnameVerification")); + if(isIgnoreHostnameVerification) { + return new Client.Default(getSimpleTrustedSSLSocketFactory(), new HostnameVerifier() { + @Override + public boolean verify(String s, SSLSession sslSession) { + return true; + } + }); + }else { + return new Client.Default(getTrustedSSLSocketFactory(), null); + } } - private static SSLSocketFactory getTrustedSSLSocketFactory() { + private static SSLSocketFactory getSimpleTrustedSSLSocketFactory() { try { TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @@ -86,4 +110,60 @@ public class Utils { } } -} + + private static SSLSocketFactory getTrustedSSLSocketFactory() { + try { + String keyStorePassword = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Password"); + String keyStoreLocation = ServerConfiguration.getInstance().getFirstProperty("Security.KeyStore.Location"); + String trustStorePassword = ServerConfiguration.getInstance().getFirstProperty( + "Security.TrustStore.Password"); + String trustStoreLocation = ServerConfiguration.getInstance().getFirstProperty( + "Security.TrustStore.Location"); + KeyStore keyStore = loadKeyStore(keyStoreLocation,keyStorePassword,KEY_STORE_TYPE); + KeyStore trustStore = loadTrustStore(trustStoreLocation,trustStorePassword); + + return initSSLConnection(keyStore,keyStorePassword,trustStore); + } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException + |CertificateException | IOException | UnrecoverableKeyException e) { + log.error("Error while creating the SSL socket factory due to "+e.getMessage(),e); + return null; + } + + } + + private static SSLSocketFactory initSSLConnection(KeyStore keyStore,String keyStorePassword,KeyStore trustStore) throws NoSuchAlgorithmException, UnrecoverableKeyException, + KeyStoreException, KeyManagementException { + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KEY_MANAGER_TYPE); + keyManagerFactory.init(keyStore, keyStorePassword.toCharArray()); + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TRUST_MANAGER_TYPE); + trustManagerFactory.init(trustStore); + + // Create and initialize SSLContext for HTTPS communication + SSLContext sslContext = SSLContext.getInstance(SSLV3); + sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null); + SSLContext.setDefault(sslContext); + return sslContext.getSocketFactory(); + } + + + private static KeyStore loadKeyStore(String keyStorePath, String ksPassword,String type) + throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException { + InputStream fileInputStream = null; + try { + char[] keypassChar = ksPassword.toCharArray(); + KeyStore keyStore = KeyStore.getInstance(type); + fileInputStream = new FileInputStream(keyStorePath); + keyStore.load(fileInputStream, keypassChar); + return keyStore; + } finally { + if (fileInputStream != null) { + fileInputStream.close(); + } + } + } + + private static KeyStore loadTrustStore(String trustStorePath, String tsPassword) + throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException { + return loadKeyStore(trustStorePath,tsPassword,TRUST_STORE_TYPE); + } +} \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 1490489888..1be406fc87 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index 9ceb9fa7e1..dd4083afbb 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index efa86cab76..40ae93ece0 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index 82afff3caa..4e29cd0ce2 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index ec177d2c21..2c7b15f630 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 91b931367d..a65f2ef272 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 710208fdb9..aa5d6d27d4 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 3ba682521d..e779a6be29 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index a43110291e..3b245614e8 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index e6280f67ed..985e6f766d 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index e8761404ca..f6f52691fc 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 4ecb71b287..26854657d5 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 6e32addce2..5d73fb4857 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index f5a502a894..0e792b986e 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml index 72f9908d22..62f363112b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index bed73ba0c0..de1d9eb646 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 8a7a98154b..8d249ab0b0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index 0203eeeaee..76f0b6b399 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index b537f765fb..008275850f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java index ee3f1556d8..e1aeb1a45c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java @@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; public class GeoLocationConfiguration { private boolean publishLocationOperationResponse; + private boolean isEnabled; public boolean getPublishLocationOperationResponse() { return publishLocationOperationResponse; @@ -37,4 +38,13 @@ public class GeoLocationConfiguration { public void setPublishLocationOperationResponse(boolean publishLocationOperationResponse) { this.publishLocationOperationResponse = publishLocationOperationResponse; } + + public boolean getIsEnabled() { + return isEnabled; + } + + @XmlElement(name = "isEnabled", required = true) + public void setEnabled(boolean enabled) { + isEnabled = enabled; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 202d514b67..3bab9aceed 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -155,7 +155,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " + "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_DETAIL dt " + "WHERE t.NAME = ? AND t.ID = d.DEVICE_TYPE_ID AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ? AND dt.DEVICE_ID = d.ID " + - "AND dt.UPDATE_TIMESTAMP > ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?" ; + "AND dt.UPDATE_TIMESTAMP > ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ? ORDER BY e.DATE_OF_LAST_UPDATE DESC" ; stmt = conn.prepareStatement(sql); int paramIdx = 1; stmt.setString(paramIdx++, deviceIdentifier.getType()); @@ -190,7 +190,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " + "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " + "t.NAME = ? AND t.ID = d.DEVICE_TYPE_ID AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID " + - "AND TENANT_ID = ? AND e.STATUS = ?"; + "AND TENANT_ID = ? AND e.STATUS = ? ORDER BY e.DATE_OF_LAST_UPDATE DESC"; stmt = conn.prepareStatement(sql); stmt.setString(1, deviceIdentifier.getType()); stmt.setString(2, deviceIdentifier.getId()); @@ -285,7 +285,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID AS DEVICE_ID, " + "d.DESCRIPTION, d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, " + "DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?) d1 " + - "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?"; + "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ? ORDER BY e.DATE_OF_LAST_UPDATE DESC"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); stmt.setInt(2, tenantId); @@ -317,7 +317,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, " + "d.NAME, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, " + "DM_DEVICE_TYPE t WHERE DEVICE_TYPE_ID = t.ID AND t.NAME = ? " + - "AND t.ID = d.DEVICE_TYPE_ID AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?"; + "AND t.ID = d.DEVICE_TYPE_ID AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?" + + " ORDER BY e.DATE_OF_LAST_UPDATE DESC"; stmt = conn.prepareStatement(sql); stmt.setString(1, type); stmt.setInt(2, tenantId); @@ -350,7 +351,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { " e1.DATE_OF_ENROLMENT, d.DESCRIPTION, d.NAME AS DEVICE_NAME, d.DEVICE_IDENTIFICATION, t.NAME " + "AS DEVICE_TYPE FROM DM_DEVICE d, (SELECT e.OWNER, e.OWNERSHIP, e.ID AS ENROLMENT_ID, " + "e.DEVICE_ID, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e WHERE " + - "e.TENANT_ID = ? AND LOWER(e.OWNER) = LOWER(?)) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " + + "e.TENANT_ID = ? AND LOWER(e.OWNER) = LOWER(?) ORDER BY e.DATE_OF_LAST_UPDATE DESC) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " + "AND t.ID = d.DEVICE_TYPE_ID"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -383,7 +384,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { " e1.DATE_OF_ENROLMENT, d.DESCRIPTION, d.NAME AS DEVICE_NAME, d.DEVICE_IDENTIFICATION, t.NAME " + "AS DEVICE_TYPE FROM DM_DEVICE d, (SELECT e.OWNER, e.OWNERSHIP, e.ID AS ENROLMENT_ID, " + "e.DEVICE_ID, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e WHERE " + - "e.TENANT_ID = ? AND LOWER(e.OWNER) = LOWER(?)) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " + + "e.TENANT_ID = ? AND LOWER(e.OWNER) = LOWER(?) ORDER BY e.DATE_OF_LAST_UPDATE DESC) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " + "AND t.ID = d.DEVICE_TYPE_ID AND t.NAME= ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, tenantId); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index ea998fdec7..251b489d0d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -200,33 +200,7 @@ public final class DeviceManagementDAOUtil { if (deviceInfoIncluded) { device.setDeviceInfo(loadDeviceInfo(rs)); } - - if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) { - return device; - } - deviceMap.put(device.getEnrolmentInfo().getStatus(), device); - while (rs.next()) { - device = loadDevice(rs); - if (deviceInfoIncluded) { - device.setDeviceInfo(loadDeviceInfo(rs)); - } - if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) { - return device; - } - if (device.getEnrolmentInfo() != null) { - deviceMap.put(device.getEnrolmentInfo().getStatus(), device); - } - } - if (deviceMap.containsKey(EnrolmentInfo.Status.UNREACHABLE)) { - return deviceMap.get(EnrolmentInfo.Status.UNREACHABLE); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.INACTIVE)) { - return deviceMap.get(EnrolmentInfo.Status.INACTIVE); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.CREATED)) { - return deviceMap.get(EnrolmentInfo.Status.CREATED); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.UNCLAIMED)) { - return deviceMap.get(EnrolmentInfo.Status.UNCLAIMED); - } - return null; + return device; } //This method will retrieve most appropriate device information when there are multiple device enrollments for @@ -237,39 +211,6 @@ public final class DeviceManagementDAOUtil { if (deviceInfoIncluded) { device.setDeviceInfo(loadDeviceInfo(rs)); } - - if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) { - return device; - } - while (rs.next()) { - device = loadDevice(rs); - if (deviceInfoIncluded) { - device.setDeviceInfo(loadDeviceInfo(rs)); - } - if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) { - return device; - } - if (device.getEnrolmentInfo() != null) { - deviceMap.put(device.getEnrolmentInfo().getStatus(), device); - } - } - if (deviceMap.containsKey(EnrolmentInfo.Status.UNREACHABLE)) { - return deviceMap.get(EnrolmentInfo.Status.UNREACHABLE); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.INACTIVE)) { - return deviceMap.get(EnrolmentInfo.Status.INACTIVE); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED)) { - return deviceMap.get(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.CREATED)) { - return deviceMap.get(EnrolmentInfo.Status.CREATED); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.REMOVED)) { - return deviceMap.get(EnrolmentInfo.Status.REMOVED); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.UNCLAIMED)) { - return deviceMap.get(EnrolmentInfo.Status.UNCLAIMED); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.SUSPENDED)) { - return deviceMap.get(EnrolmentInfo.Status.SUSPENDED); - } else if (deviceMap.containsKey(EnrolmentInfo.Status.BLOCKED)) { - return deviceMap.get(EnrolmentInfo.Status.BLOCKED); - } return device; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/DeviceType.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/DeviceType.java index c56257a363..5f04d3d6d1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/DeviceType.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/DeviceType.java @@ -18,8 +18,6 @@ package org.wso2.carbon.device.mgt.core.dto; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; @@ -36,7 +34,6 @@ public class DeviceType implements Serializable { @ApiModelProperty(name = "name", value = "Device type name", required = true) private String name; - @JsonProperty("metaDefinition") @ApiModelProperty(name = "metaDefinition", value = "Device type definition", required = true) private DeviceTypeMetaDefinition deviceTypeMetaDefinition; @@ -47,7 +44,6 @@ public class DeviceType implements Serializable { this.name = name; } - @JsonIgnore public int getId() { return id; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 66e326d7d7..1e09960283 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -213,6 +213,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv enrolmentId = enrollmentDAO. addEnrollment(existingDevice.getId(), newEnrolmentInfo, tenantId); DeviceManagementDAOFactory.commitTransaction(); + this.removeDeviceFromCache(deviceIdentifier); if (log.isDebugEnabled()) { log.debug("An enrolment is successfully added with the id '" + enrolmentId + "' associated with " + "the device identified by key '" + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 4e40d82830..354c19e724 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java index 37331ec080..a8f9141904 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java @@ -36,7 +36,7 @@ import java.util.List; * Implements CRUD for Devices. This holds the generic implementation. An instance of this will be created for * each device type. */ -public class DeviceTypePluginDAOImpl implements PluginDAO{ +public class DeviceTypePluginDAOImpl implements PluginDAO { private static final Log log = LogFactory.getLog(DeviceTypePluginDAOImpl.class); private DeviceTypeDAOHandler deviceTypeDAOHandler; @@ -241,9 +241,11 @@ public class DeviceTypePluginDAOImpl implements PluginDAO{ } private String getPropertString(List properties, String propertyName) { - for (Device.Property property : properties) { - if (property.getName() != null && property.getName().equals(propertyName)) { - return property.getValue(); + if (properties != null) { + for (Device.Property property : properties) { + if (property.getName() != null && property.getName().equals(propertyName)) { + return property.getValue(); + } } } return null; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 57d4d52552..21e4ea4efd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.20-SNAPSHOT + 3.0.32-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 56ee92e863..2e85a4798b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -1,6 +1,7 @@ { "appContext": "/devicemgt/", "isCloud": false, + "isDeviceOwnerEnabled": false, "httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%", "httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port%", "wssURL": "https://%iot.analytics.host%:%iot.analytics.https.port%", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json index 4e303190d5..26a6198550 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json @@ -1,112 +1,137 @@ { - "Logo": { - "name": "Cloud", - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt", - "target": "_parent" - }, - "Main": { - "Domain": { - "url": "#", - "icon": "fw fw-organization", - "isAdminOnly": false, - "target": "_parent", - "dropDown": { - "Organization": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag", - "icon": "fw fw-organization", - "dropDown": "false", - "target": "_self" + "Logo": { + "name": "Cloud", + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt", + "target": "_parent" + }, + "Main": { + "Domain": { + "url": "#", + "icon": "fw fw-organization", + "isAdminOnly": false, + "target": "_parent", + "dropDown": { + "Organization": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag", + "icon": "fw fw-organization", + "dropDown": "false", + "target": "_self" + }, + "Members": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag", + "icon": "fa fa-users", + "dropDown": "false", + "target": "_self" + } + } + }, + "Account": { + "url": "#", + "icon": "fw fw-resource", + "isAdminOnly": false, + "billingEnabled": true, + "billingApi": { + "username": "admin", + "password": "admin" + }, + "cloudMgtIndexPage": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/index.jag", + "dropDown": { + "Upgrade Now": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/payment-plans.jag?cloud-type=device_cloud", + "icon": "fw fw-export", + "dropDown": "true", + "target": "_self" + }, + "Request Extension": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud&request-extension=true", + "icon": "fa fa-mail", + "dropDown": "true", + "target": "_self" + } + } + }, + "Support": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud", + "icon": "fw fw-mail", + "isAdminOnly": false, + "target": "_self", + "dropDown": "false" }, - "Members": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag", - "icon": "fa fa-users", - "dropDown": "false", - "target": "_self" + "Documentation": { + "url": "#", + "icon": "fw fw-document", + "isAdminOnly": false, + "dropDown": { + "Device Cloud": { + "id": "device_cloud", + "url": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation", + "icon": "fw fw-mobile", + "target": "_blank" + } + } } - } }, - "Support": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag", - "icon": "fw fw-mail", - "isAdminOnly": false, - "target": "_self", - "dropDown": "false" - }, - "Documentation": { - "url": "#", - "icon": "fw fw-document", - "isAdminOnly": false, - "dropDown": { - "Device Cloud": { - "id": "device_cloud", - "url": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation", - "icon": "fw fw-mobile", - "target": "_blank" - } - } - } - }, - "User": { - "url": "#", - "icon": "fw fw-user", - "dropDown": { - "Profile": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user-profile.jag", + "User": { + "url": "#", "icon": "fw fw-user", - "dropDown": "true", - "target": "_self" - }, - "Change Password": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/change-password.jag", - "icon": "fw fw-lock", - "dropDown": "true", - "target": "_self" - }, - "Logout": { - "url": "https://api.cloud.wso2.com/publisher/site/pages/logout.jag", - "icon": "fw fw-sign-out", - "dropDown": "true", - "target": "_self" - } - } - }, - "Expand": { - "Clouds": { - "API Cloud": { - "id": "api_cloud", - "url": "https://api.cloud.wso2.com/publisher", - "icon": "fw fw-api fw-3x", - "dropDown": "true", - "target": "_self" - }, - "Integration Cloud": { - "id": "integration_cloud", - "url": "https://integration.cloud.wso2.com/appmgt", - "icon": "fw fw-service fw-3x", - "dropDown": "true", - "target": "_self" - }, - "Identity Cloud": { - "id": "integration_cloud", - "url": "https://identity.cloud.wso2.com/admin", - "icon": "fw fw-security fw-3x", - "dropDown": "true", - "target": "_self" - } + "dropDown": { + "Profile": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user-profile.jag", + "icon": "fw fw-user", + "dropDown": "true", + "target": "_self" + }, + "Change Password": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/change-password.jag", + "icon": "fw fw-lock", + "dropDown": "true", + "target": "_self" + }, + "Logout": { + "url": "https://device.cloud.wso2.com/devicemgt/logout", + "icon": "fw fw-sign-out", + "dropDown": "true", + "target": "_self" + } + } }, - "Actions": { - "Organization": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag", - "icon": "fw fw-organization fw-3x", - "dropDown": "true", - "target": "_self" - }, - "Members": { - "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag", - "icon": "fa fa-users fa-3x", - "dropDown": "true", - "target": "_self" - } + "Expand": { + "Clouds": { + "API Cloud": { + "id": "api_cloud", + "url": "https://api.cloud.wso2.com/publisher", + "icon": "fw fw-api fw-3x", + "dropDown": "true", + "target": "_self" + }, + "Integration Cloud": { + "id": "integration_cloud", + "url": "https://integration.cloud.wso2.com/appmgt", + "icon": "fw fw-service fw-3x", + "dropDown": "true", + "target": "_self" + }, + "Identity Cloud": { + "id": "integration_cloud", + "url": "https://identity.cloud.wso2.com/admin", + "icon": "fw fw-security fw-3x", + "dropDown": "true", + "target": "_self" + } + }, + "Actions": { + "Organization": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag", + "icon": "fw fw-organization fw-3x", + "dropDown": "true", + "target": "_self" + }, + "Members": { + "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag", + "icon": "fa fa-users fa-3x", + "dropDown": "true", + "target": "_self" + } + } } - } -} +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js index 3451c66cb3..1d18e05fe9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/operation.js @@ -79,18 +79,19 @@ var operationModule = function () { return featuresList; }; - publicMethods.getControlOperations = function (deviceType) { + publicMethods.getControlOperations = function (device) { + var deviceType = device.type; var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation"); var features = utility.getDeviceTypeConfig(deviceType).deviceType.features; for (var op in operations) { var iconIdentifier = operations[op].operation; if (features && features[iconIdentifier]) { var icon = features[iconIdentifier].icon; - var isCloud = devicemgtProps["isCloud"]; - //TODO: remove isCloud check once able to verify features from the device agent - var isDisabled = features[iconIdentifier].isDisabled; - if (isDisabled && isCloud) { - operations[op]["isDisabled"] = isDisabled; + //TODO: need improve this check to get feature availability from agent side + var filter = features[iconIdentifier].filter; + if (device && filter && filter.property && device[filter.property] !== filter.value) { + operations[op]["isDisabled"] = true; + operations[op]["disabledText"] = filter.text; } else { operations[op]["isDisabled"] = false; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js index ce57a85980..ba61809f7d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js @@ -56,6 +56,8 @@ var conf = function () { } } ); + var DeviceConfigurationManager = Packages.org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; + conf["serverConfig"] = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); application.put("CONF", conf); } return conf; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs index 1819831912..fcce815fc0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs @@ -209,7 +209,7 @@ data-search="{{platform}}" data-display="{{platform}}"> - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/operation-bar.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/operation-bar.hbs index 0dd0c6a174..a5a2b988e3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/operation-bar.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/operation-bar.hbs @@ -36,7 +36,7 @@ } {{#each control_operations}} - + {{name}} @@ -93,7 +93,7 @@

- + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/public/js/operation-bar.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/public/js/operation-bar.js index 5707f092d1..4b12f40b4b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/public/js/operation-bar.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.operation-bar/public/js/operation-bar.js @@ -51,6 +51,7 @@ function submitForm(formId) { var defaultStatusClasses = "fw fw-stack-1x"; var content = $("#operation-response-template").find(".content"); var title = content.find("#title"); + title.attr("class","center-block text-center"); var statusIcon = content.find("#status-icon"); var description = content.find("#description"); var successCallBack = function (response) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs index 343098c3d7..632b7bdaa8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-bar/operation-bar.hbs @@ -35,7 +35,7 @@ } {{#each control_operations}} - + {{#if iconFont}} {{else}} @@ -79,6 +79,11 @@
{{/each}} + {{#each uiParams}} + + +
+ {{/each}}