From dfe957b0193cf2fd8b4f42205f0bcc164405b014 Mon Sep 17 00:00:00 2001
From: inoshperera
Date: Sun, 9 Apr 2023 11:50:14 +0530
Subject: [PATCH 01/50] Add SCEP support
fixes https://roadmap.entgra.net/issues/10042
---
.../mgt/core/impl/CertificateGenerator.java | 117 +++++++++++++++++-
.../service/CertificateManagementService.java | 2 +
.../CertificateManagementServiceImpl.java | 5 +
.../util/CertificateManagementConstants.java | 1 +
4 files changed, 119 insertions(+), 6 deletions(-)
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
index 2cb6d4098f..20b4833d56 100755
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
@@ -44,12 +44,17 @@ import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.util.Store;
-import org.jscep.message.*;
+import org.jscep.message.CertRep;
+import org.jscep.message.MessageDecodingException;
+import org.jscep.message.MessageEncodingException;
+import org.jscep.message.PkcsPkiEnvelopeDecoder;
+import org.jscep.message.PkcsPkiEnvelopeEncoder;
+import org.jscep.message.PkiMessage;
+import org.jscep.message.PkiMessageDecoder;
+import org.jscep.message.PkiMessageEncoder;
import org.jscep.transaction.FailInfo;
import org.jscep.transaction.Nonce;
import org.jscep.transaction.TransactionId;
-import org.wso2.carbon.certificate.mgt.core.cache.CertificateCacheManager;
-import org.wso2.carbon.certificate.mgt.core.cache.impl.CertificateCacheManagerImpl;
import org.wso2.carbon.certificate.mgt.core.dao.CertificateDAO;
import org.wso2.carbon.certificate.mgt.core.dao.CertificateManagementDAOException;
import org.wso2.carbon.certificate.mgt.core.dao.CertificateManagementDAOFactory;
@@ -72,13 +77,31 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
-import java.security.*;
+import java.security.InvalidKeyException;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.SignatureException;
import java.security.cert.Certificate;
-import java.security.cert.*;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.X509Certificate;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
+import java.util.concurrent.TimeUnit;
public class CertificateGenerator {
@@ -757,4 +780,86 @@ public class CertificateGenerator {
return generateCertificateFromCSR(privateKeyCA, certificationRequest,
certCA.getIssuerX500Principal().getName());
}
-}
+
+ public X509Certificate generateAlteredCertificateFromCSR(String csr)
+ throws KeystoreException {
+ byte[] byteArrayBst = DatatypeConverter.parseBase64Binary(csr);
+ PKCS10CertificationRequest certificationRequest;
+ KeyStoreReader keyStoreReader = new KeyStoreReader();
+ PrivateKey privateKeyCA = keyStoreReader.getCAPrivateKey();
+ X509Certificate certCA = (X509Certificate) keyStoreReader.getCACertificate();
+
+ X509Certificate issuedCert;
+ try {
+ certificationRequest = new PKCS10CertificationRequest(byteArrayBst);
+ JcaContentSignerBuilder csBuilder =
+ new JcaContentSignerBuilder(CertificateManagementConstants.SIGNING_ALGORITHM);
+ ContentSigner signer = csBuilder.build(privateKeyCA);
+
+ BigInteger serialNumber = BigInteger.valueOf(System.currentTimeMillis());
+
+ X500Name issuerName = new X500Name(certCA.getSubjectDN().getName());
+
+ String commonName = certificationRequest.getSubject().getRDNs(BCStyle.CN)[0].getFirst()
+ .getValue().toString();
+ X500Name subjectName = new X500Name("O=" + commonName + "O=AndroidDevice,CN=" +
+ serialNumber);
+ Date startDate = new Date(System.currentTimeMillis());
+ Date endDate = new Date(System.currentTimeMillis()
+ + TimeUnit.DAYS.toMillis(365 * 100));
+ PublicKey publicKey = getPublicKeyFromRequest(certificationRequest);
+
+ X509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(
+ issuerName, serialNumber, startDate, endDate,
+ subjectName, publicKey);
+
+ X509CertificateHolder certHolder = certBuilder.build(signer);
+
+ CertificateFactory certificateFactory = CertificateFactory.getInstance
+ (CertificateManagementConstants.X_509);
+ byte[] encodedCertificate = certHolder.getEncoded();
+ issuedCert = (X509Certificate) certificateFactory
+ .generateCertificate(new ByteArrayInputStream(encodedCertificate));
+
+ org.wso2.carbon.certificate.mgt.core.bean.Certificate certificate =
+ new org.wso2.carbon.certificate.mgt.core.bean.Certificate();
+ List certificates = new ArrayList<>();
+ certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ certificate.setCertificate(issuedCert);
+ certificates.add(certificate);
+ saveCertInKeyStore(certificates);
+
+ } catch (OperatorCreationException e) {
+ String errorMsg = "Error creating the content signer";
+ log.error(errorMsg);
+ throw new KeystoreException(errorMsg, e);
+ } catch (CertificateException e) {
+ String errorMsg = "Error when opening the newly created certificate";
+ log.error(errorMsg);
+ throw new KeystoreException(errorMsg, e);
+ } catch (InvalidKeySpecException e) {
+ String errorMsg = "Public key is having invalid specification";
+ log.error(errorMsg);
+ throw new KeystoreException(errorMsg, e);
+ } catch (NoSuchAlgorithmException e) {
+ String errorMsg = "Could not find RSA algorithm";
+ log.error(errorMsg);
+ throw new KeystoreException(errorMsg, e);
+ } catch (IOException e) {
+ String errorMsg = "Error while reading the csr";
+ log.error(errorMsg);
+ throw new KeystoreException(errorMsg, e);
+ }
+ return issuedCert;
+ }
+
+ private static PublicKey getPublicKeyFromRequest(PKCS10CertificationRequest request)
+ throws InvalidKeySpecException, NoSuchAlgorithmException, IOException {
+ byte[] publicKeyBytes = request.getSubjectPublicKeyInfo().getEncoded();
+ X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(publicKeyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
+ return publicKey;
+ }
+
+}
\ No newline at end of file
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementService.java
index becd68720b..393dbdd0ed 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementService.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementService.java
@@ -79,4 +79,6 @@ public interface CertificateManagementService {
List searchCertificates(String serialNumber) throws CertificateManagementException;
+ X509Certificate generateAlteredCertificateFromCSR(String csr) throws KeystoreException;
+
}
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementServiceImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementServiceImpl.java
index c47472f35c..67cca297c4 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementServiceImpl.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/service/CertificateManagementServiceImpl.java
@@ -234,4 +234,9 @@ public class CertificateManagementServiceImpl implements CertificateManagementSe
}
}
+ @Override
+ public X509Certificate generateAlteredCertificateFromCSR(String csr) throws KeystoreException{
+ return certificateGenerator.generateAlteredCertificateFromCSR(csr);
+ }
+
}
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java
index 5e5f02c7f0..96c6cc2148 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java
@@ -39,6 +39,7 @@ public final class CertificateManagementConstants {
public static final String RSA_PRIVATE_KEY_END_TEXT = "-----END RSA PRIVATE KEY-----";
public static final String EMPTY_TEXT = "";
public static final int RSA_KEY_LENGTH = 2048;
+ public static final String SIGNING_ALGORITHM = "SHA256withRSA";
public static final class DataBaseTypes {
private DataBaseTypes() {
From d34adaae961a2c10eb9a23bb931b802eb2686e2c Mon Sep 17 00:00:00 2001
From: Pahansith Gunathilake
Date: Wed, 19 Apr 2023 06:46:09 +0000
Subject: [PATCH 02/50] Fix issue with Nginx not recognizing the SCEP client
certificate (#105)
Co-authored-by: Pahansith
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/105
Co-authored-by: Pahansith Gunathilake
Co-committed-by: Pahansith Gunathilake
---
.../mgt/core/impl/CertificateGenerator.java | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
index 20b4833d56..d686ff5115 100755
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
@@ -97,10 +97,7 @@ import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
import java.util.concurrent.TimeUnit;
public class CertificateGenerator {
@@ -798,8 +795,16 @@ public class CertificateGenerator {
BigInteger serialNumber = BigInteger.valueOf(System.currentTimeMillis());
- X500Name issuerName = new X500Name(certCA.getSubjectDN().getName());
-
+ //Reversing the order of components of the subject DN due to Nginx not verifying the client certificate
+ //generated by Java using this subject DN.
+ //Ref: https://stackoverflow.com/questions/33769978 & engineering mail SCEP implementation for Android
+ String[] dnParts = certCA.getSubjectDN().getName().split(",");
+ StringJoiner joiner = new StringJoiner(",");
+ for (int i = (dnParts.length - 1); i >= 0; i--) {
+ joiner.add(dnParts[i]);
+ }
+ String subjectDn = joiner.toString();
+ X500Name issuerName = new X500Name(subjectDn);
String commonName = certificationRequest.getSubject().getRDNs(BCStyle.CN)[0].getFirst()
.getValue().toString();
X500Name subjectName = new X500Name("O=" + commonName + "O=AndroidDevice,CN=" +
From 19ce7d6facd56640e010602f494c9982cda00248 Mon Sep 17 00:00:00 2001
From: Lasantha Dharmakeerthi
Date: Mon, 10 Apr 2023 20:25:07 +0530
Subject: [PATCH 03/50] Add try it now feature (#99)
Co-authored-by: Dharmakeerthi Lasantha
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/99
Co-authored-by: Lasantha Dharmakeerthi
Co-committed-by: Lasantha Dharmakeerthi
---
.../exception/StorageManagementException.java | 32 -------------------
1 file changed, 32 deletions(-)
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java
index 38985716de..e69de29bb2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java
@@ -1,32 +0,0 @@
-/* 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 org.wso2.carbon.device.mgt.core.common.exception;
-
-/**
- * Represents the exception thrown during storing and retrieving the artifacts.
- */
-public class StorageManagementException extends Exception {
- public StorageManagementException(String message, Throwable ex) {
- super(message, ex);
- }
-
- public StorageManagementException(String message) {
- super(message);
- }
-}
-
From 1aafd53d3e7f2a64ebb04369bad048bc796c30b7 Mon Sep 17 00:00:00 2001
From: inoshperera
Date: Wed, 24 May 2023 13:54:10 +0530
Subject: [PATCH 04/50] OTP for enrollment with Mutual TLS
Fixes https://roadmap.entgra.net/issues/10093
---
.../mgt/common/DeviceManagementConstants.java | 2 +
.../common/general/QREnrollmentDetails.java | 9 ++++
.../mgt/common/otp/mgt/OTPEmailTypes.java | 2 +-
.../mgt/common/spi/OTPManagementService.java | 6 +--
.../dao/impl/GenericOTPManagementDAOImpl.java | 6 ++-
.../mgt/service/OTPManagementServiceImpl.java | 51 +++++++++----------
.../authenticator/BasicAuthAuthenticator.java | 31 +++++++++--
.../CertificateAuthenticator.java | 9 ++++
.../OneTimeTokenAuthenticator.java | 14 ++++-
9 files changed, 93 insertions(+), 37 deletions(-)
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java
index 154594678c..f95a78ed84 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java
@@ -134,6 +134,8 @@ public final class DeviceManagementConstants {
public static final String LAST_NAME = "last-name";
public static final String TENANT_ADMIN_USERNAME = "tenant-admin-username";
public static final String TENANT_ADMIN_PASSWORD = "tenant-admin-password";
+
+ public static final int OTP_DEFAULT_EXPIRY_SECONDS = 3600;
}
public static final class EventServices {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/general/QREnrollmentDetails.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/general/QREnrollmentDetails.java
index 150fddef09..37e696c206 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/general/QREnrollmentDetails.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/general/QREnrollmentDetails.java
@@ -22,6 +22,7 @@ public class QREnrollmentDetails {
String ownershipType;
String username;
String enrollmentMode;
+ int tokenExpiry;
public String getOwnershipType() { return ownershipType; }
@@ -34,4 +35,12 @@ public class QREnrollmentDetails {
public String getEnrollmentMode() { return enrollmentMode; }
public void setEnrollmentMode(String enrollmentMode) { this.enrollmentMode = enrollmentMode; }
+
+ public int getTokenExpiry() {
+ return tokenExpiry;
+ }
+
+ public void setTokenExpiry(int tokenExpiry) {
+ this.tokenExpiry = tokenExpiry;
+ }
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java
index 72bbea982e..9a182a0b14 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java
@@ -18,5 +18,5 @@
package org.wso2.carbon.device.mgt.common.otp.mgt;
public enum OTPEmailTypes {
- USER_VERIFY, DEVICE_ENROLLMENT
+ USER_VERIFY, DEVICE_ENROLLMENT, USER_INVITE
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/OTPManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/OTPManagementService.java
index bf1d112875..ed548499bf 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/OTPManagementService.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/OTPManagementService.java
@@ -34,7 +34,8 @@ public interface OTPManagementService {
* @throws OTPManagementException if error occurred whle verifying validity of the OPT
* @throws BadRequestException if found an null value for OTP
*/
- OneTimePinDTO isValidOTP(String oneTimeToken) throws OTPManagementException, BadRequestException;
+ OneTimePinDTO isValidOTP(String oneTimeToken, boolean requireRenewal) throws
+ OTPManagementException, BadRequestException;
/**
* Invalidate the OTP and send welcome mail
@@ -58,8 +59,7 @@ public interface OTPManagementService {
boolean hasEmailRegistered(String email, String emailDomain) throws OTPManagementException,
DeviceManagementException;
- OneTimePinDTO generateOneTimePin(String email, String emailType, String userName, Object metaDataObj,
- int tenantId, boolean persistPin) throws OTPManagementException;
+ OneTimePinDTO generateOneTimePin(OneTimePinDTO oneTimePinData, boolean persistPin) throws OTPManagementException;
OneTimePinDTO getRenewedOtpByEmailAndMailType(String email, String emailType) throws OTPManagementException;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java
index 574d6e7904..becea82ede 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java
@@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.core.otp.mgt.dao.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.exceptions.DBConnectionException;
import org.wso2.carbon.device.mgt.common.otp.mgt.dto.OneTimePinDTO;
import org.wso2.carbon.device.mgt.core.otp.mgt.dao.AbstractDAOImpl;
@@ -55,7 +56,8 @@ public class GenericOTPManagementDAOImpl extends AbstractDAOImpl implements OTPM
+ "META_INFO, "
+ "CREATED_AT,"
+ "TENANT_ID,"
- + "USERNAME) VALUES (?, ?, ?, ?, ?, ?, ?)";
+ + "USERNAME, "
+ + "EXPIRY_TIME) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
try {
Connection conn = this.getDBConnection();
Calendar calendar = Calendar.getInstance();
@@ -69,6 +71,8 @@ public class GenericOTPManagementDAOImpl extends AbstractDAOImpl implements OTPM
stmt.setTimestamp(5, timestamp);
stmt.setInt(6, oneTimePinDTO.getTenantId());
stmt.setString(7, oneTimePinDTO.getUsername());
+ stmt.setInt(8, oneTimePinDTO.getExpiryTime() == 0
+ ? DeviceManagementConstants.OTPProperties.OTP_DEFAULT_EXPIRY_SECONDS : oneTimePinDTO.getExpiryTime());
stmt.addBatch();
}
stmt.executeBatch();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
index 4c8161e100..2d90dc5727 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
@@ -126,7 +126,8 @@ public class OTPManagementServiceImpl implements OTPManagementService {
}
@Override
- public OneTimePinDTO isValidOTP(String oneTimeToken) throws OTPManagementException, BadRequestException {
+ public OneTimePinDTO isValidOTP(String oneTimeToken, boolean requireRenewal) throws OTPManagementException,
+ BadRequestException {
if (StringUtils.isBlank(oneTimeToken)){
String msg = "Received blank OTP to verify. OTP: " + oneTimeToken;
log.error(msg);
@@ -150,17 +151,19 @@ public class OTPManagementServiceImpl implements OTPManagementService {
oneTimePinDTO.getCreatedAt().getTime() + oneTimePinDTO.getExpiryTime() * 1000L);
if (currentTimestamp.after(expiredTimestamp)) {
- String renewedOTP = UUID.randomUUID().toString();
- renewOTP(oneTimePinDTO, renewedOTP);
- Gson gson = new Gson();
- Tenant tenant = gson.fromJson(oneTimePinDTO.getMetaInfo(), Tenant.class);
+ if (requireRenewal) {
+ String renewedOTP = UUID.randomUUID().toString();
+ renewOTP(oneTimePinDTO, renewedOTP);
+ Gson gson = new Gson();
+ Tenant tenant = gson.fromJson(oneTimePinDTO.getMetaInfo(), Tenant.class);
- Properties props = new Properties();
- props.setProperty("first-name", tenant.getAdminFirstName());
- props.setProperty("otp-token", renewedOTP);
- props.setProperty("email", oneTimePinDTO.getEmail());
- props.setProperty("type", oneTimePinDTO.getEmailType());
- sendMail(props, oneTimePinDTO.getEmail(), DeviceManagementConstants.EmailAttributes.USER_VERIFY_TEMPLATE);
+ Properties props = new Properties();
+ props.setProperty("first-name", tenant.getAdminFirstName());
+ props.setProperty("otp-token", renewedOTP);
+ props.setProperty("email", oneTimePinDTO.getEmail());
+ props.setProperty("type", oneTimePinDTO.getEmailType());
+ sendMail(props, oneTimePinDTO.getEmail(), DeviceManagementConstants.EmailAttributes.USER_VERIFY_TEMPLATE);
+ }
return null;
}
return oneTimePinDTO;
@@ -243,8 +246,14 @@ public class OTPManagementServiceImpl implements OTPManagementService {
for (String username : deviceEnrollmentInvitation.getUsernames()) {
String emailAddress = DeviceManagerUtil.getUserClaimValue(
username, DeviceManagementConstants.User.CLAIM_EMAIL_ADDRESS);
- oneTimePinDTO = generateOneTimePin(emailAddress, OTPEmailTypes.DEVICE_ENROLLMENT.toString(), username,
- null, tenantId, false);
+
+ OneTimePinDTO oneTimePinData = new OneTimePinDTO();
+ oneTimePinData.setEmail(emailAddress);
+ oneTimePinData.setTenantId(tenantId);
+ oneTimePinData.setUsername(username);
+ oneTimePinData.setEmailType(OTPEmailTypes.USER_INVITE.toString());
+
+ oneTimePinDTO = generateOneTimePin(oneTimePinData, false);
oneTimePinDTOList.add(oneTimePinDTO);
props.setProperty("first-name", DeviceManagerUtil.
getUserClaimValue(username, DeviceManagementConstants.User.CLAIM_FIRST_NAME));
@@ -278,27 +287,17 @@ public class OTPManagementServiceImpl implements OTPManagementService {
/**
* Create One Time Token
- * @param email email
- * @param emailType email type
- * @param userName username
- * @param metaDataObj meta data object
- * @param tenantId tenant Id
+ * @param oneTimePinDTO Data related to the one time pin
* @return {@link OneTimePinDTO}
*/
@Override
- public OneTimePinDTO generateOneTimePin(String email, String emailType, String userName, Object metaDataObj,
- int tenantId, boolean persistPin) throws OTPManagementException {
+ public OneTimePinDTO generateOneTimePin(OneTimePinDTO oneTimePinDTO, boolean persistPin) throws OTPManagementException {
String otpValue = UUID.randomUUID().toString();
Gson gson = new Gson();
- String metaInfo = gson.toJson(metaDataObj);
+ String metaInfo = gson.toJson(oneTimePinDTO.getMetaInfo());
- OneTimePinDTO oneTimePinDTO = new OneTimePinDTO();
- oneTimePinDTO.setEmail(email);
- oneTimePinDTO.setTenantId(tenantId);
- oneTimePinDTO.setUsername(userName);
- oneTimePinDTO.setEmailType(emailType);
oneTimePinDTO.setMetaInfo(metaInfo);
oneTimePinDTO.setOtpToken(otpValue);
diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java
index 4bd7779dda..f1b0339994 100644
--- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java
+++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java
@@ -36,6 +36,7 @@ import org.wso2.carbon.webapp.authenticator.framework.Utils.Utils;
import java.nio.charset.Charset;
import java.util.Base64;
import java.util.Properties;
+import java.util.StringTokenizer;
public class BasicAuthAuthenticator implements WebappAuthenticator {
@@ -51,15 +52,23 @@ public class BasicAuthAuthenticator implements WebappAuthenticator {
@Override
public boolean canHandle(Request request) {
/*
- This is done to avoid every endpoint being able to use basic auth. Add the following to
- the required web.xml of the web app.
+ This is done to avoid every web app being able to use basic auth. Add the following to
+ the required web.xml of the web app. This is a global config for a web app to allow all
+ contexts of the web app to use basic auth
basicAuth
true
+
+ Adding the basicAuthAllowList parameter allows to selectively allow some context paths in a
+ web app to use basic auth while all the other context remain unavailable with basic auth.
+ If this parameter is present, any context that requires basic auth must be specially
+ added as comma separated list to the param-value of basicAuthAllowList.
*/
- if (!isAuthenticationSupported(request)) {
- return false;
+ if (!isAllowListedForBasicAuth(request)) {
+ if (!isAuthenticationSupported(request)) {
+ return false;
+ }
}
if (request.getCoyoteRequest() == null || request.getCoyoteRequest().getMimeHeaders() == null) {
return false;
@@ -76,6 +85,20 @@ public class BasicAuthAuthenticator implements WebappAuthenticator {
return false;
}
+ private boolean isAllowListedForBasicAuth(Request request) {
+ String param = request.getContext().findParameter("basicAuthAllowList");
+ if (param != null && !param.isEmpty()) {
+ //Add the nonSecured end-points to cache
+ String[] basicAuthAllowList = param.split(",");
+ for (String contexPath : basicAuthAllowList) {
+ if (request.getRequestURI().toString().endsWith(contexPath.trim())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
@Override
public AuthenticationInfo authenticate(Request request, Response response) {
AuthenticationInfo authenticationInfo = new AuthenticationInfo();
diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java
index 4bead3ad4f..6bccefe7ec 100644
--- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java
+++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java
@@ -75,21 +75,30 @@ public class CertificateAuthenticator implements WebappAuthenticator {
// When there is a load balancer terminating mutual SSL, it should pass this header along and
// as the value of this header, the client certificate subject dn should be passed.
if (request.getHeader(PROXY_MUTUAL_AUTH_HEADER) != null) {
+ log.info("PROXY_MUTUAL_AUTH_HEADER " + request.getHeader(PROXY_MUTUAL_AUTH_HEADER));
CertificateResponse certificateResponse = AuthenticatorFrameworkDataHolder.getInstance().
getCertificateManagementService().verifySubjectDN(request.getHeader(PROXY_MUTUAL_AUTH_HEADER));
+ log.info("clientCertificate" + certificateResponse.getSerialNumber());
+ log.info("clientCertificate" + certificateResponse.getCommonName());
authenticationInfo = checkCertificateResponse(certificateResponse);
+ log.info("username" + authenticationInfo.getUsername());
}
else if (request.getHeader(MUTUAL_AUTH_HEADER) != null) {
+ log.info("MUTUAL_AUTH_HEADER");
Object object = request.getAttribute(CLIENT_CERTIFICATE_ATTRIBUTE);
X509Certificate[] clientCertificate = null;
if (object instanceof X509Certificate[]) {
+ log.info("clientCertificate");
clientCertificate = (X509Certificate[]) request.
getAttribute(CLIENT_CERTIFICATE_ATTRIBUTE);
}
if (clientCertificate != null && clientCertificate[0] != null) {
CertificateResponse certificateResponse = AuthenticatorFrameworkDataHolder.getInstance().
getCertificateManagementService().verifyPEMSignature(clientCertificate[0]);
+ log.info("clientCertificate" + certificateResponse.getSerialNumber());
+ log.info("clientCertificate" + certificateResponse.getCommonName());
authenticationInfo = checkCertificateResponse(certificateResponse);
+ log.info("username" + authenticationInfo.getUsername());
} else {
authenticationInfo.setStatus(Status.FAILURE);
diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java
index 9d290c51da..539e8be13d 100644
--- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java
+++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java
@@ -49,8 +49,18 @@ public class OneTimeTokenAuthenticator implements WebappAuthenticator {
try {
OTPManagementService otpManagementService = AuthenticatorFrameworkDataHolder.getInstance()
.getOtpManagementService();
- OneTimePinDTO validOTP = otpManagementService.isValidOTP(request.getHeader(Constants.HTTPHeaders
- .ONE_TIME_TOKEN_HEADER));
+ OneTimePinDTO validOTP;
+ if (request.getRequestURI().toString().endsWith("cloud/download-url")
+ || request.getRequestURI().toString().endsWith("cloud/tenant")) {
+ validOTP = otpManagementService.isValidOTP(request.getHeader(Constants.HTTPHeaders
+ .ONE_TIME_TOKEN_HEADER), true);
+ } else {
+ log.info("Validating OTP for enrollments PIN: " + request.getHeader(Constants
+ .HTTPHeaders.ONE_TIME_TOKEN_HEADER));
+ validOTP = otpManagementService.isValidOTP(request.getHeader(Constants.HTTPHeaders
+ .ONE_TIME_TOKEN_HEADER), false);
+ }
+
if (validOTP != null) {
authenticationInfo.setStatus(Status.CONTINUE);
authenticationInfo.setTenantId(validOTP.getTenantId());
From 209f2b66c94cc64c361d19a35feb4b341c4b97b5 Mon Sep 17 00:00:00 2001
From: Pahansith
Date: Sat, 13 May 2023 12:56:56 +0530
Subject: [PATCH 05/50] Add tenant based storing and loading SCEP certificates
---
.../mgt/core/dao/CertificateDAO.java | 10 +++++
.../dao/impl/AbstractCertificateDAOImpl.java | 36 +++++++++++++++++
.../mgt/core/impl/CertificateGenerator.java | 39 ++++++++++++++-----
.../mgt/core/impl/KeyStoreReader.java | 37 ++++++++++++++++++
.../exception/StorageManagementException.java | 32 +++++++++++++++
5 files changed, 145 insertions(+), 9 deletions(-)
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java
index cb97cf8892..fe1d829a82 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java
@@ -51,6 +51,16 @@ public interface CertificateDAO {
*/
CertificateResponse retrieveCertificate(String serialNumber) throws CertificateManagementDAOException;
+ /**
+ * Obtain a certificated stored in the database by providing the common name and the tenant ID
+ *
+ * @param serialNumber Serial number (Common name) of the certificate
+ * @param tenantId ID of the certificate owning tenant
+ * @return representation of the certificate.
+ * @throws CertificateManagementDAOException if fails to read the certificate from the database
+ */
+ CertificateResponse retrieveCertificate(String serialNumber, int tenantId) throws CertificateManagementDAOException;
+
/**
* Get all the certificates in a paginated manner.
*
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java
index 4af136c987..e536eaf646 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java
@@ -119,6 +119,42 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{
return certificateResponse;
}
+ @Override
+ public CertificateResponse retrieveCertificate(String serialNumber, int tenantId) throws CertificateManagementDAOException {
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet resultSet = null;
+ CertificateResponse certificateResponse = null;
+ try {
+ conn = this.getConnection();
+ String query =
+ "SELECT CERTIFICATE, SERIAL_NUMBER, TENANT_ID, USERNAME FROM"
+ + " DM_DEVICE_CERTIFICATE WHERE SERIAL_NUMBER = ? AND TENANT_ID = ? ";
+ stmt = conn.prepareStatement(query);
+ stmt.setString(1, serialNumber);
+ stmt.setInt(2, tenantId);
+ resultSet = stmt.executeQuery();
+
+ if (resultSet.next()) {
+ certificateResponse = new CertificateResponse();
+ byte[] certificateBytes = resultSet.getBytes("CERTIFICATE");
+ certificateResponse.setCertificate(certificateBytes);
+ certificateResponse.setSerialNumber(resultSet.getString("SERIAL_NUMBER"));
+ certificateResponse.setTenantId(resultSet.getInt("TENANT_ID"));
+ certificateResponse.setUsername(resultSet.getString("USERNAME"));
+ CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse);
+ }
+ } catch (SQLException e) {
+ String errorMsg =
+ "Unable to get the read the certificate with serial" + serialNumber;
+ log.error(errorMsg, e);
+ throw new CertificateManagementDAOException(errorMsg, e);
+ } finally {
+ CertificateManagementDAOUtil.cleanupResources(stmt, resultSet);
+ }
+ return certificateResponse;
+ }
+
@Override
public List searchCertificate(String serialNumber)
throws CertificateManagementDAOException {
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
index d686ff5115..5c9bbfad45 100755
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
@@ -358,15 +358,31 @@ public class CertificateGenerator {
CertificateResponse lookUpCertificate = null;
KeyStoreReader keyStoreReader = new KeyStoreReader();
if (distinguishedName != null && !distinguishedName.isEmpty()) {
- if (distinguishedName.contains("/CN=")) {
- String[] dnSplits = distinguishedName.split("/");
- for (String dnPart : dnSplits) {
- if (dnPart.contains("CN=")) {
- String commonNameExtracted = dnPart.replace("CN=", "");
- lookUpCertificate = keyStoreReader.getCertificateBySerial(commonNameExtracted);
- break;
+ if (distinguishedName.contains("CN=")) {
+ String[] dnSplits = null;
+ if (distinguishedName.contains("/")) {
+ dnSplits = distinguishedName.split("/");
+ } else if (distinguishedName.contains(",")) {
+ //some older versions of nginx will forward the client certificate subject dn separated with commas
+ dnSplits = distinguishedName.split(",");
+ }
+ String commonNameExtracted = null;
+ int tenantId = 0;
+ if (dnSplits != null && dnSplits.length >= 1) {
+ for (String dnPart : dnSplits) {
+ if (dnPart.contains("CN=")) {
+ commonNameExtracted = dnPart.replace("CN=", "");
+ } else if (dnPart.contains("OU=")) {
+ //the OU of the certificate will be like OU=tenant_ ex: OU=tenant_-1234
+ //splitting by underscore to extract the tenant domain
+ String[] orgUnitSplits = dnPart.split("_");
+ tenantId = Integer.parseInt(orgUnitSplits[1]);
+ }
}
}
+
+ lookUpCertificate = keyStoreReader.getCertificateBySerial(commonNameExtracted, tenantId);
+
} else {
LdapName ldapName;
try {
@@ -807,8 +823,9 @@ public class CertificateGenerator {
X500Name issuerName = new X500Name(subjectDn);
String commonName = certificationRequest.getSubject().getRDNs(BCStyle.CN)[0].getFirst()
.getValue().toString();
- X500Name subjectName = new X500Name("O=" + commonName + "O=AndroidDevice,CN=" +
- serialNumber);
+ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ X500Name subjectName = new X500Name("O=" + commonName + ",CN=" +
+ serialNumber + ", OU=tenant_"+tenantId);
Date startDate = new Date(System.currentTimeMillis());
Date endDate = new Date(System.currentTimeMillis()
+ TimeUnit.DAYS.toMillis(365 * 100));
@@ -826,6 +843,10 @@ public class CertificateGenerator {
issuedCert = (X509Certificate) certificateFactory
.generateCertificate(new ByteArrayInputStream(encodedCertificate));
+ io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate certificate =
+ new io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate();
+ List certificates = new ArrayList<>();
+ certificate.setTenantId(tenantId);
org.wso2.carbon.certificate.mgt.core.bean.Certificate certificate =
new org.wso2.carbon.certificate.mgt.core.bean.Certificate();
List certificates = new ArrayList<>();
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/KeyStoreReader.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/KeyStoreReader.java
index 60a7800863..921f11e794 100755
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/KeyStoreReader.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/KeyStoreReader.java
@@ -275,6 +275,43 @@ public class KeyStoreReader {
return raPrivateKey;
}
+ public CertificateResponse getCertificateBySerial(String serialNumber, int tenantId) throws KeystoreException {
+ CertificateResponse certificateResponse = null;
+ try {
+ CertificateCacheManager cacheManager = CertificateCacheManagerImpl.getInstance();
+ certificateResponse = cacheManager.getCertificateBySerial(serialNumber);
+ if (certificateResponse == null) {
+ try {
+ CertificateManagementDAOFactory.openConnection();
+ certificateResponse = certDao.retrieveCertificate(serialNumber, tenantId);
+ } catch (SQLException e) {
+ String errorMsg = "Error when making a connection to the database.";
+ throw new KeystoreException(errorMsg, e);
+ } finally {
+ CertificateManagementDAOFactory.closeConnection();
+ }
+ if (certificateResponse != null && certificateResponse.getCertificate() != null) {
+ Certificate certificate = (Certificate) Serializer.deserialize(certificateResponse.getCertificate());
+ if (certificate instanceof X509Certificate) {
+ X509Certificate x509cert = (X509Certificate) certificate;
+ String commonName = CertificateGenerator.getCommonName(x509cert);
+ certificateResponse.setCommonName(commonName);
+ cacheManager.addCertificateBySerial(serialNumber, certificateResponse);
+ }
+ }
+ }
+ } catch (CertificateManagementDAOException e) {
+ String errorMsg = "Error when retrieving certificate from the the database for the serial number: " +
+ serialNumber;
+ throw new KeystoreException(errorMsg, e);
+
+ } catch (ClassNotFoundException | IOException e) {
+ String errorMsg = "Error when de-serializing saved certificate.";
+ throw new KeystoreException(errorMsg, e);
+ }
+ return certificateResponse;
+ }
+
public CertificateResponse getCertificateBySerial(String serialNumber) throws KeystoreException {
CertificateResponse certificateResponse = null;
try {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java
index e69de29bb2..38985716de 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/common/exception/StorageManagementException.java
@@ -0,0 +1,32 @@
+/* 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 org.wso2.carbon.device.mgt.core.common.exception;
+
+/**
+ * Represents the exception thrown during storing and retrieving the artifacts.
+ */
+public class StorageManagementException extends Exception {
+ public StorageManagementException(String message, Throwable ex) {
+ super(message, ex);
+ }
+
+ public StorageManagementException(String message) {
+ super(message);
+ }
+}
+
From dee327017437cf1ffd2b3093e85b881a4a5f3813 Mon Sep 17 00:00:00 2001
From: navodzoysa
Date: Thu, 25 May 2023 21:19:05 +0530
Subject: [PATCH 06/50] Update admin credentials in webapp-auth-config template
---
.../src/main/resources/conf/webapp-authenticator-config.xml | 4 ++--
.../repository/conf/etc/webapp-authenticator-config.xml.j2 | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf/webapp-authenticator-config.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf/webapp-authenticator-config.xml
index 5701d5d697..dfdf0713f1 100644
--- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf/webapp-authenticator-config.xml
+++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf/webapp-authenticator-config.xml
@@ -6,8 +6,8 @@
false
https://${iot.keymanager.host}:${iot.keymanager.https.port}
- ${admin.username}
- ${admin.password}
+ {{super_admin.username}}
+ {{super_admin.password}}
100
100
diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf_templates/templates/repository/conf/etc/webapp-authenticator-config.xml.j2 b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf_templates/templates/repository/conf/etc/webapp-authenticator-config.xml.j2
index 7c3ce35486..6c51e0f2b6 100644
--- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf_templates/templates/repository/conf/etc/webapp-authenticator-config.xml.j2
+++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/src/main/resources/conf_templates/templates/repository/conf/etc/webapp-authenticator-config.xml.j2
@@ -14,8 +14,8 @@
false
https://${iot.keymanager.host}:${iot.keymanager.https.port}
- ${admin.username}
- ${admin.password}
+ {{super_admin.username}}
+ {{super_admin.password}}
100
100
From 7100b36e35e0d0ce9f61e4a5dcd25452060a3cc2 Mon Sep 17 00:00:00 2001
From: Pahansith
Date: Mon, 29 May 2023 12:27:50 +0530
Subject: [PATCH 07/50] Fix package name issue
---
.../certificate/mgt/core/impl/CertificateGenerator.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
index 5c9bbfad45..e3973ed152 100755
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
@@ -843,10 +843,6 @@ public class CertificateGenerator {
issuedCert = (X509Certificate) certificateFactory
.generateCertificate(new ByteArrayInputStream(encodedCertificate));
- io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate certificate =
- new io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate();
- List certificates = new ArrayList<>();
- certificate.setTenantId(tenantId);
org.wso2.carbon.certificate.mgt.core.bean.Certificate certificate =
new org.wso2.carbon.certificate.mgt.core.bean.Certificate();
List certificates = new ArrayList<>();
From acd3039c65c3827e9e8bbc4b26676e42cfc79651 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Tue, 4 Apr 2023 03:01:09 +0530
Subject: [PATCH 08/50] pom.xml updated by pull
---
.../org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 3ac62b9500..d3196bf7e2 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
@@ -47,7 +47,7 @@
testng
- org.wso2.tomcat
+ org. wso2.tomcat
tomcat
From 331ba08f4daf6d25821dcd3b99a81c17eef96606 Mon Sep 17 00:00:00 2001
From: navodzoysa
Date: Tue, 13 Jun 2023 09:19:43 +0530
Subject: [PATCH 09/50] Fix class def not found in grafana component
---
.../pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
index 3214000279..abf13026a3 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
@@ -88,7 +88,7 @@
io.entgra.device.mgt.core.application.mgt.core.*
- !io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.internal,
+ !io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal,
io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.*
From 145740fec6e08c3c71d90061e7fb1958aa396bff Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Tue, 4 Apr 2023 13:52:03 +0530
Subject: [PATCH 10/50] Add hierarchical grouping feature
---
.../service/api/GroupManagementService.java | 81 +++++++++
.../admin/GroupManagementAdminService.java | 86 +++++++++-
.../impl/GroupManagementServiceImpl.java | 54 +++++-
.../GroupManagementAdminServiceImpl.java | 38 ++++-
.../group/mgt/DeviceGroupRoleWrapper.java | 155 ++++++++++++++++++
.../core/device/mgt/core/dao/GroupDAO.java | 30 ++++
.../core/dao/impl/AbstractGroupDAOImpl.java | 101 ++++++++++--
.../impl/group/PostgreSQLGroupDAOImpl.java | 42 ++++-
.../core/dao/util/GroupManagementDAOUtil.java | 1 +
.../GroupManagementProviderService.java | 18 +-
.../GroupManagementProviderServiceImpl.java | 85 +++++++++-
.../src/test/resources/sql/h2.sql | 1 +
.../pom.xml | 2 +-
.../src/test/resources/sql/CreateH2TestDB.sql | 1 +
.../src/main/resources/dbscripts/cdm/h2.sql | 1 +
.../main/resources/dbscripts/cdm/mssql.sql | 1 +
.../main/resources/dbscripts/cdm/mysql.sql | 1 +
.../main/resources/dbscripts/cdm/oracle.sql | 1 +
.../resources/dbscripts/cdm/postgresql.sql | 1 +
19 files changed, 655 insertions(+), 45 deletions(-)
create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
index fb348388d5..33614a7328 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
@@ -40,6 +40,7 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceToGroupsAssign
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
@@ -182,6 +183,13 @@ import java.util.List;
key = "perm:groups:devices-types",
roles = {"Internal/devicemgt-user"},
permissions = {"/device-mgt/groups/devices/types"}
+ ),
+ @Scope(
+ name = "View whether the groups has relevant device types",
+ description = "View whether the groups has relevant device types",
+ key = "perm:groups:add",
+ roles = {"Internal/devicemgt-user"},
+ permissions = {"/device-mgt/groups/device-types"}
)
}
)
@@ -1229,4 +1237,77 @@ public interface GroupManagementService {
required = true)
List identifiers);
+
+ @POST
+ @Path("/roles/share")
+ @ApiOperation(
+ produces = MediaType.APPLICATION_JSON,
+ httpMethod = HTTPConstants.HEADER_POST,
+ value = "Consolidated API for Creating a Device Group, Adding Devices, and Sharing",
+ notes = "This API can be used to create a new device group, add devices to the group, and share the group with user roles.",
+ tags = "Device Group Management",
+ extensions = {
+ @Extension(properties = {
+ @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add")
+ })
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(
+ code = 201,
+ message = "Created. \n Device group has successfully been created.",
+ responseHeaders = {
+ @ResponseHeader(
+ name = "Content-Location",
+ description = "The URL of the created group."),
+ @ResponseHeader(
+ name = "Content-Type",
+ description = "The content type of the body."),
+ @ResponseHeader(
+ name = "ETag",
+ description = "Entity Tag of the response resource.\n" +
+ "Used by caches, or in conditional requests."),
+ @ResponseHeader(
+ name = "Last-Modified",
+ description = "Date and time the resource has been modified the last time.\n" +
+ "Used by caches, or in conditional requests.")
+ }
+ ),
+ @ApiResponse(
+ code = 303,
+ message = "See Other. \n Source can be retrieved from the URL specified at the Location " +
+ "header.",
+ responseHeaders = {
+ @ResponseHeader(
+ name = "Content-Location",
+ description = "The Source URL of the document.")}),
+ @ApiResponse(
+ code = 400,
+ message = "Bad Request. \n Invalid request or validation error.",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 401,
+ message = "Unauthorized. \n Current logged in user is not authorized to perform the operation.",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 404,
+ message = "Group not found.",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 406,
+ message = "Not Acceptable.\n The requested media type is not supported."),
+ @ApiResponse(
+ code = 500,
+ message = "Internal Server Error. \n " +
+ "Server error occurred while creating the group or adding devices or sharing the group.",
+ response = ErrorResponse.class)
+ })
+ Response createGroupWithRoles(@ApiParam(
+ name = "group",
+ value = "Define the group object with data.",
+ required = true)
+ @Valid DeviceGroupRoleWrapper group
+ );
+
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java
index 2c8571efbe..373afe9272 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java
@@ -36,9 +36,16 @@ import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants;
-
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
import javax.validation.Valid;
-import javax.ws.rs.*;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -368,4 +375,79 @@ public interface GroupManagementAdminService {
required = true)
@Valid DeviceGroup group);
+
+
+ @POST
+ @Path("/roles/share")
+ @ApiOperation(
+ produces = MediaType.APPLICATION_JSON,
+ httpMethod = HTTPConstants.HEADER_POST,
+ value = "Consolidated API for Creating a Device Group, Adding Devices, and Sharing",
+ notes = "This API can be used to create a new device group, add devices to the group, and share the group with user roles.",
+ tags = "Device Group Management",
+ extensions = {
+ @Extension(properties = {
+ @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add")
+ })
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(
+ code = 201,
+ message = "Created. \n Device group has successfully been created.",
+ responseHeaders = {
+ @ResponseHeader(
+ name = "Content-Location",
+ description = "The URL of the created group."),
+ @ResponseHeader(
+ name = "Content-Type",
+ description = "The content type of the body."),
+ @ResponseHeader(
+ name = "ETag",
+ description = "Entity Tag of the response resource.\n" +
+ "Used by caches, or in conditional requests."),
+ @ResponseHeader(
+ name = "Last-Modified",
+ description = "Date and time the resource has been modified the last time.\n" +
+ "Used by caches, or in conditional requests.")
+ }
+ ),
+ @ApiResponse(
+ code = 303,
+ message = "See Other. \n Source can be retrieved from the URL specified at the Location " +
+ "header.",
+ responseHeaders = {
+ @ResponseHeader(
+ name = "Content-Location",
+ description = "The Source URL of the document.")}),
+ @ApiResponse(
+ code = 400,
+ message = "Bad Request. \n Invalid request or validation error.",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 401,
+ message = "Unauthorized. \n Current logged in user is not authorized to perform the operation.",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 404,
+ message = "Group not found.",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 406,
+ message = "Not Acceptable.\n The requested media type is not supported."),
+ @ApiResponse(
+ code = 500,
+ message = "Internal Server Error. \n " +
+ "Server error occurred while creating the group or adding devices or sharing the group.",
+ response = ErrorResponse.class)
+ })
+ Response createGroupWithRoles(@ApiParam(
+ name = "group",
+ value = "Define the group object with data.",
+ required = true)
+ @Valid DeviceGroupRoleWrapper group
+
+ );
+
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
index 1e6f525cb3..b68bbd0f3a 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
@@ -18,6 +18,14 @@
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.CarbonConstants;
@@ -29,13 +37,6 @@ import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
import io.entgra.device.mgt.core.device.mgt.common.PaginationResult;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService;
import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList;
@@ -48,6 +49,9 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils;
import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint;
import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.transaction.UserTransaction;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -430,4 +434,38 @@ public class GroupManagementServiceImpl implements GroupManagementService {
}
}
-}
+ @POST
+ @Path("/roles/share")
+ @Override
+ public Response createGroupWithRoles(DeviceGroupRoleWrapper groups) {
+ String owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
+ if (groups == null) {
+ return Response.status(Response.Status.BAD_REQUEST).build();
+ }
+ groups.setOwner(owner);
+ groups.setStatus(DeviceGroupConstants.GroupStatus.ACTIVE);
+ try {
+ DeviceMgtAPIUtils.getGroupManagementProviderService().createGroupWithRoles(groups, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
+ DeviceGroup group = DeviceMgtAPIUtils.getGroupManagementProviderService().getGroup(groups.getName(), owner.isEmpty());
+ if (group != null) {
+ DeviceMgtAPIUtils.getGroupManagementProviderService().manageGroupSharing(group.getGroupId(), groups.getUserRoles());
+ return Response.status(Response.Status.CREATED).entity(group.getGroupId()).build();
+ } else {
+ String msg = "Error occurred while retrieving newly created group.";
+ log.error(msg);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
+ }
+ } catch (GroupManagementException e) {
+ String msg = "Error occurred while adding new group.";
+ log.error(msg, e);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
+ } catch (GroupAlreadyExistException e) {
+ String msg = "Group already exists with name : " + groups.getName() + ".";
+ log.warn(msg);
+ return Response.status(Response.Status.CONFLICT).entity(msg).build();
+ } catch (RoleDoesNotExistException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
index 20fa85d855..30546f214a 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
@@ -17,21 +17,25 @@
*/
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
-import io.entgra.device.mgt.core.device.mgt.common.PaginationResult;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
+import io.entgra.device.mgt.core.device.mgt.common.PaginationResult;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.GroupManagementAdminService;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
+import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
@@ -144,4 +148,30 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
return Response.status(Response.Status.CONFLICT).entity(msg).build();
}
}
+ @POST
+ @Path("/roles/share")
+ @Override
+ public Response createGroupWithRoles(DeviceGroupRoleWrapper group) {
+ String owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
+ if (group == null) {
+ return Response.status(Response.Status.BAD_REQUEST).build();
+ }
+ group.setOwner(owner);
+ group.setStatus(DeviceGroupConstants.GroupStatus.ACTIVE);
+ try {
+ DeviceMgtAPIUtils.getGroupManagementProviderService().createGroupWithRoles(group, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
+ DeviceMgtAPIUtils.getGroupManagementProviderService().manageGroupSharing(group.getGroupId(), group.getUserRoles());
+ return Response.status(Response.Status.CREATED).build();
+ } catch (GroupManagementException e) {
+ String msg = "Error occurred while adding new group.";
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
+ } catch (GroupAlreadyExistException e) {
+ String msg = "Group already exists with name : " + group.getName() + ".";
+ return Response.status(Response.Status.CONFLICT).entity(msg).build();
+ } catch (RoleDoesNotExistException e) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
+ }
+ }
+
}
+
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java
new file mode 100644
index 0000000000..132730e915
--- /dev/null
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.device.mgt.common.group.mgt;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiParam;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Holds Device Group details and expose to external access
+ */
+@ApiModel(value = "DeviceGroupRoleWrapper", description = "This class carries all information related to a managed device group.")
+public class DeviceGroupRoleWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1998121711L;
+
+ @ApiModelProperty(name = "id", value = "ID of the device group in the device group information database.")
+ private int id;
+
+ @ApiModelProperty(name = "description", value = "The device group description that can be set on the device group by the user.",
+ required = true)
+ private String description;
+
+ @ApiModelProperty(name = "name", value = "The device group name that can be set on the device group by the user.",
+ required = true)
+ private String name;
+
+ private String owner;
+
+ @ApiModelProperty(name = "status", value = "The status of group that needs updating/retrieval.")
+ private String status;
+
+ @ApiModelProperty(name = "parentGroupId", value = "Group ID of parent group")
+ private int parentGroupId;
+
+ @ApiModelProperty(name = "parentPath", value = "Path of parent group")
+ private String parentPath;
+
+ @ApiModelProperty(name = "childrenGroups", value = "Children groups")
+ private List childrenGroups;
+
+ @ApiModelProperty(name = "userRoles", value = "User roles")
+ private List userRoles;
+
+// @ApiModelProperty(name = "DeviceGroupRoleWrapper", value = "Device group role wrapper")
+// private List DeviceGroupRoleWrapper;
+
+ public DeviceGroupRoleWrapper() {}
+
+ public DeviceGroupRoleWrapper(String name) {
+ this.name = name;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ private Map groupProperties;
+
+ public int getGroupId() {
+ return id;
+ }
+
+ public void setGroupId(int id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ public Map getGroupProperties() {
+ return groupProperties;
+ }
+
+ public void setGroupProperties(Map groupProperties) {
+ this.groupProperties = groupProperties;
+ }
+
+ public int getParentGroupId() {
+ return parentGroupId;
+ }
+
+ public void setParentGroupId(int parentGroupId) {
+ this.parentGroupId = parentGroupId;
+ }
+
+ public String getParentPath() {
+ return parentPath;
+ }
+
+ public void setParentPath(String parentPath) {
+ this.parentPath = parentPath;
+ }
+
+ public List getChildrenGroups() {
+ return childrenGroups;
+ }
+
+ public void setChildrenGroups(List childrenGroups) {
+ this.childrenGroups = childrenGroups;
+ }
+
+ public List getUserRoles() {
+ return userRoles;
+ }
+
+ public void setUserRoles(List userRoles) {
+ this.userRoles = userRoles;
+ }
+}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
index 8176e59f72..55f1da1f0d 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
@@ -23,6 +23,7 @@ import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
import java.util.List;
import java.util.Map;
@@ -41,6 +42,21 @@ public interface GroupDAO {
*/
int addGroup(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException;
+
+ /**
+ * Add properties for device group.
+ * Note that groupId parameter is considered seperately due to the groupId parameter passed with
+ * device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
+ *
+ * @param groups to be added.
+ * @param tenantId of the group.
+ * @return sql execution result.
+ * @throws GroupManagementDAOException
+ */
+ int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException;
+
+
+
/**
* Add properties for device group.
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
@@ -51,8 +67,22 @@ public interface GroupDAO {
* @return sql execution result.
* @throws GroupManagementDAOException
*/
+
boolean addGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) throws GroupManagementDAOException;
+ /**
+ * Update properties for device group.
+ * Note that groupId parameter is considered seperately due to the groupId parameter passed with
+ * device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
+ *
+ * @param groups to be updated.
+ * @param tenantId of the group.
+ * @return sql execution result.
+ * @throws GroupManagementDAOException
+ */
+
+ boolean addGroupPropertiesWithRoles(DeviceGroupRoleWrapper groups, int groupId, int tenantId) throws GroupManagementDAOException;
+
/**
* Update properties for device group.
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
index b8196c6e03..7331ab6ad5 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
@@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.device.mgt.core.dao.impl;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -53,7 +54,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
throws GroupManagementDAOException {
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP "
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP "
+ "WHERE TENANT_ID = ?";
if (StringUtils.isNotBlank(request.getGroupName())) {
sql += " AND GROUP_NAME LIKE ?";
@@ -115,7 +116,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP WHERE TENANT_ID = ?";
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP WHERE TENANT_ID = ?";
if (StringUtils.isNotBlank(request.getGroupName())) {
sql += " AND GROUP_NAME LIKE ?";
}
@@ -179,11 +180,11 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
Connection conn = GroupManagementDAOFactory.getConnection();
String sql;
if (deviceGroup.getStatus() == null || deviceGroup.getStatus().isEmpty()) {
- sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH) "
- + "VALUES (?, ?, ?, ?, ?)";
- } else {
- sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, STATUS) "
+ sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, PARENT_GROUP_ID) "
+ "VALUES (?, ?, ?, ?, ?, ?)";
+ } else {
+ sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, PARENT_GROUP_ID, STATUS) "
+ + "VALUES (?, ?, ?, ?, ?, ?, ?)";
hasStatus = true;
}
stmt = conn.prepareStatement(sql, new String[]{"ID"});
@@ -192,10 +193,12 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
stmt.setString(3, deviceGroup.getOwner());
stmt.setInt(4, tenantId);
stmt.setString(5, deviceGroup.getParentPath());
+ stmt.setInt(6, deviceGroup.getParentGroupId());
if (hasStatus) {
- stmt.setString(6, deviceGroup.getStatus());
+ stmt.setString(7, deviceGroup.getStatus());
}
+
stmt.executeUpdate();
rs = stmt.getGeneratedKeys();
if (rs.next()) {
@@ -210,6 +213,48 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
}
}
+ public int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException {
+ PreparedStatement stmt = null;
+ ResultSet rs;
+ int groupId = -1;
+ boolean hasStatus = false;
+ try {
+ Connection conn = GroupManagementDAOFactory.getConnection();
+ String sql;
+ if (groups.getStatus() == null || groups.getStatus().isEmpty()) {
+ sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, PARENT_GROUP_ID) "
+ + "VALUES (?, ?, ?, ?, ?, ?)";
+ } else {
+ sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, PARENT_GROUP_ID, STATUS) "
+ + "VALUES (?, ?, ?, ?, ?, ?, ?)";
+ hasStatus = true;
+ }
+ stmt = conn.prepareStatement(sql, new String[]{"ID"});
+ stmt.setString(1, groups.getDescription());
+ stmt.setString(2, groups.getName());
+ stmt.setString(3, groups.getOwner());
+ stmt.setInt(4, tenantId);
+ stmt.setString(5, groups.getParentPath());
+ stmt.setInt(6, groups.getParentGroupId());
+ if (hasStatus) {
+ stmt.setString(7, groups.getStatus());
+ }
+
+
+ stmt.executeUpdate();
+ rs = stmt.getGeneratedKeys();
+ if (rs.next()) {
+ groupId = rs.getInt(1);
+ }
+ return groupId;
+ } catch (SQLException e) {
+ throw new GroupManagementDAOException("Error occurred while adding deviceGroup '" +
+ groups.getName() + "'", e);
+ } finally {
+ GroupManagementDAOUtil.cleanupResources(stmt, null);
+ }
+ }
+
public boolean addGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId)
throws GroupManagementDAOException {
boolean status;
@@ -238,6 +283,34 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
return status;
}
+ public boolean addGroupPropertiesWithRoles(DeviceGroupRoleWrapper groups, int groupId, int tenantId)
+ throws GroupManagementDAOException {
+ boolean status;
+ PreparedStatement stmt = null;
+ try {
+ Connection conn = GroupManagementDAOFactory.getConnection();
+ stmt = conn.prepareStatement(
+ "INSERT INTO GROUP_PROPERTIES(GROUP_ID, PROPERTY_NAME, " +
+ "PROPERTY_VALUE, TENANT_ID) VALUES (?, ?, ?, ?)");
+ for (Map.Entry entry : groups.getGroupProperties().entrySet()) {
+ stmt.setInt(1, groupId);
+ stmt.setString(2, entry.getKey());
+ stmt.setString(3, entry.getValue());
+ stmt.setInt(4, tenantId);
+ stmt.addBatch();
+ }
+ stmt.executeBatch();
+ status = true;
+ } catch (SQLException e) {
+ String msg = "Error occurred while adding properties for group '" +
+ groups.getName() + "' values : " + groups.getGroupProperties();
+ throw new GroupManagementDAOException(msg, e);
+ } finally {
+ GroupManagementDAOUtil.cleanupResources(stmt, null);
+ }
+ return status;
+ }
+
public boolean updateGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId)
throws GroupManagementDAOException {
boolean status;
@@ -495,7 +568,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
ResultSet resultSet = null;
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP WHERE ID = ? "
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP WHERE ID = ? "
+ "AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, groupId);
@@ -518,7 +591,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
public List getChildrenGroups(String parentPath, int tenantId) throws GroupManagementDAOException {
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP "
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP "
+ "WHERE PARENT_PATH LIKE ? AND TENANT_ID = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, parentPath + "%");
@@ -543,7 +616,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
public List getRootGroups(int tenantId) throws GroupManagementDAOException {
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP "
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP "
+ "WHERE PARENT_PATH LIKE ? AND TENANT_ID = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, "/");
@@ -571,7 +644,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
List deviceGroupBuilders = new ArrayList<>();
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT G.ID, G.GROUP_NAME, G.DESCRIPTION, G.OWNER, G.STATUS, G.PARENT_PATH FROM DM_GROUP G " +
+ String sql = "SELECT G.ID, G.GROUP_NAME, G.DESCRIPTION, G.OWNER, G.STATUS, G.PARENT_PATH, G.PARENT_GROUP_ID FROM DM_GROUP G " +
"INNER JOIN DM_DEVICE_GROUP_MAP GM ON G.ID = GM.GROUP_ID " +
"WHERE GM.DEVICE_ID = ? AND GM.TENANT_ID = ?";
stmt = conn.prepareStatement(sql);
@@ -709,7 +782,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
try {
Connection conn = GroupManagementDAOFactory.getConnection();
String sql =
- "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP "
+ "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP "
+ "WHERE LOWER(GROUP_NAME) = LOWER(?) AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, groupName);
@@ -880,7 +953,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
List deviceGroupList = null;
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP g, " +
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID P FROM DM_GROUP g, " +
"(SELECT GROUP_ID FROM DM_ROLE_GROUP_MAP WHERE ROLE IN (";
int index = 0;
@@ -994,7 +1067,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
List deviceGroupList = null;
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP "
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP "
+ "WHERE OWNER = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, username);
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java
index 9dd23da5c0..00b581c1a4 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java
@@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.device.mgt.core.dao.impl.group;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
import org.apache.solr.common.StringUtils;
import io.entgra.device.mgt.core.device.mgt.common.Device;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
@@ -49,7 +50,7 @@ public class PostgreSQLGroupDAOImpl extends AbstractGroupDAOImpl {
Connection conn = GroupManagementDAOFactory.getConnection();
String sql;
if(StringUtils.isEmpty(deviceGroup.getStatus())) {
- sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH) " +
+ sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, PARENT_GROUP_ID) " +
"VALUES (?, ?, ?, ?) RETURNING ID";
} else {
sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, STATUS) " +
@@ -79,6 +80,45 @@ public class PostgreSQLGroupDAOImpl extends AbstractGroupDAOImpl {
}
}
+ public int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException {
+ PreparedStatement stmt = null;
+ ResultSet rs;
+ int groupId = -1;
+ boolean hasStatus = false;
+ try {
+ Connection conn = GroupManagementDAOFactory.getConnection();
+ String sql;
+ if(StringUtils.isEmpty(groups.getStatus())) {
+ sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH) " +
+ "VALUES (?, ?, ?, ?) RETURNING ID";
+ } else {
+ sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH, STATUS) " +
+ "VALUES (?, ?, ?, ?, ?) RETURNING ID";
+ hasStatus = true;
+ }
+ stmt = conn.prepareStatement(sql);
+ stmt.setString(1, groups.getDescription());
+ stmt.setString(2, groups.getName());
+ stmt.setString(3, groups.getOwner());
+ stmt.setInt(4, tenantId);
+ stmt.setString(5, groups.getParentPath());
+ if(hasStatus) {
+ stmt.setString(6, groups.getStatus());
+ }
+ stmt.execute();
+ rs = stmt.getGeneratedKeys();
+ if (rs.next()) {
+ groupId = rs.getInt(1);
+ }
+ return groupId;
+ } catch (SQLException e) {
+ throw new GroupManagementDAOException("Error occurred while adding deviceGroup '" +
+ groups.getName() + "'", e);
+ } finally {
+ GroupManagementDAOUtil.cleanupResources(stmt, null);
+ }
+ }
+
@Override
public List getDevices(int groupId, int startIndex, int rowCount, int tenantId)
throws GroupManagementDAOException {
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java
index f5b8f4ce4a..82f3c05cc6 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java
@@ -87,6 +87,7 @@ public final class GroupManagementDAOUtil {
group.setOwner(resultSet.getString("OWNER"));
group.setStatus(resultSet.getString("STATUS"));
group.setParentPath(resultSet.getString("PARENT_PATH"));
+ group.setParentGroupId(resultSet.getInt("PARENT_GROUP_ID"));
return group;
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
index 5f7840c5e7..f65244842c 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
@@ -23,12 +23,7 @@ import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException;
import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
import io.entgra.device.mgt.core.device.mgt.common.PaginationResult;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.*;
import java.util.List;
@@ -48,6 +43,17 @@ public interface GroupManagementProviderService {
void createGroup(DeviceGroup deviceGroup, String defaultRole,
String[] defaultPermissions) throws GroupManagementException, GroupAlreadyExistException;
+ /**
+ * Add new device group and create default role with default permissions.
+ *
+ * @param groups to add
+ * @param defaultRole of the deviceGroup
+ * @param defaultPermissions of the default role
+ * @throws GroupManagementException
+ */
+ void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole,
+ String[] defaultPermissions )throws GroupManagementException, GroupAlreadyExistException, RoleDoesNotExistException;
+
/**
* Update existing device group.
*
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index 23fb15646a..40d45b0963 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -18,6 +18,20 @@
package io.entgra.device.mgt.core.device.mgt.core.service;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
+import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceDAO;
+import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException;
+import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory;
+import io.entgra.device.mgt.core.device.mgt.core.dao.GroupDAO;
+import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOException;
+import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -33,14 +47,6 @@ import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
import io.entgra.device.mgt.core.device.mgt.common.PaginationResult;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.TrackerAlreadyExistException;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
-import io.entgra.device.mgt.core.device.mgt.core.dao.*;
import io.entgra.device.mgt.core.device.mgt.core.event.config.GroupAssignmentEventOperationExecutor;
import io.entgra.device.mgt.core.device.mgt.core.geo.task.GeoFenceEventOperationManager;
import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder;
@@ -57,7 +63,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
@@ -142,6 +147,68 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
}
+
+ public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions)
+ throws GroupManagementException, GroupAlreadyExistException {
+ if (groups == null) {
+ String msg = "Received incomplete data for createGroup";
+ log.error(msg);
+ throw new GroupManagementException(msg);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Creating group '" + groups.getName() + "'");
+ }
+ int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
+ try {
+ GroupManagementDAOFactory.beginTransaction();
+ DeviceGroup existingGroup = this.groupDAO.getGroup(groups.getName(), tenantId);
+ if (existingGroup == null) {
+ if (groups.getParentGroupId() == 0) {
+ groups.setParentPath(DeviceGroupConstants.HierarchicalGroup.SEPERATOR);
+ } else {
+ DeviceGroup immediateParentGroup = groupDAO.getGroup(groups.getParentGroupId(), tenantId);
+ if (immediateParentGroup == null) {
+ String msg = "Parent group with group ID '" + groups.getParentGroupId()
+ + "' does not exist. Hence creating of group '" + groups.getName()
+ + "' was not success";
+ log.error(msg);
+ throw new GroupManagementException(msg);
+ }
+ String parentPath = DeviceManagerUtil.createParentPath(immediateParentGroup);
+ groups.setParentPath(parentPath);
+ }
+ int updatedGroupID = this.groupDAO.addGroupWithRoles(groups, tenantId);
+ if (groups.getGroupProperties() != null && groups.getGroupProperties().size() > 0) {
+ this.groupDAO.addGroupPropertiesWithRoles(groups, updatedGroupID, tenantId);
+ }
+ GroupManagementDAOFactory.commitTransaction();
+ } else {
+ throw new GroupAlreadyExistException("Group exist with name " + groups.getName());
+ }
+ } catch (GroupManagementDAOException e) {
+ GroupManagementDAOFactory.rollbackTransaction();
+ String msg = "Error occurred while adding deviceGroup '" + groups.getName() + "' to database.";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } catch (TransactionManagementException e) {
+ String msg = "Error occurred while initiating transaction.";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } catch (GroupAlreadyExistException ex) {
+ throw ex;
+ } catch (Exception e) {
+ String msg = "Error occurred in creating group '" + groups.getName() + "'";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } finally {
+ GroupManagementDAOFactory.closeConnection();
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("DeviceGroup added: " + groups.getName());
+ }
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql
index d22d8f312f..4f83fa5b5e 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql
@@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS DM_GROUP (
OWNER VARCHAR(45) DEFAULT NULL,
PARENT_PATH VARCHAR(255) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
+ PARENT_GROUP_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID)
);
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 d3196bf7e2..3ac62b9500 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
@@ -47,7 +47,7 @@
testng
- org. wso2.tomcat
+ org.wso2.tomcat
tomcat
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql
index defd753f33..f5a25e36a2 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql
@@ -20,6 +20,7 @@ CREATE TABLE IF NOT EXISTS DM_GROUP (
OWNER VARCHAR(45) DEFAULT NULL,
PARENT_PATH VARCHAR(255) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
+ PARENT_GROUP_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID)
);
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql
index ad8d4e639e..20786cfe2d 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql
@@ -25,6 +25,7 @@ CREATE TABLE IF NOT EXISTS DM_GROUP (
OWNER VARCHAR(255) DEFAULT NULL,
PARENT_PATH VARCHAR(255) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
+ PARENT_GROUP_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID)
);
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql
index c162d41e06..5b6b3b93f1 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql
@@ -41,6 +41,7 @@ IF NOT EXISTS(SELECT *
OWNER VARCHAR(255) DEFAULT NULL,
PARENT_PATH VARCHAR(255) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
+ PARENT_GROUP_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID)
);
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql
index 6dcc7bec44..86da197b12 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql
@@ -29,6 +29,7 @@ CREATE TABLE IF NOT EXISTS DM_GROUP (
OWNER VARCHAR(255) DEFAULT NULL,
PARENT_PATH VARCHAR(255) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
+ PARENT_GROUP_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID)
)
ENGINE = InnoDB;
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql
index a6f87c9cb6..6cc55f7e74 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql
@@ -52,6 +52,7 @@ CREATE TABLE DM_GROUP (
OWNER VARCHAR2(255) DEFAULT NULL,
PARENT_PATH VARCHAR2(255) DEFAULT NULL,
TENANT_ID NUMBER(10) DEFAULT 0,
+ PARENT_GROUP_ID NUMBER(10) DEFAULT 0,
CONSTRAINT PK_DM_GROUP PRIMARY KEY (ID)
)
/
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql
index 8c601111b7..b1fc128cf9 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql
@@ -23,6 +23,7 @@ CREATE TABLE IF NOT EXISTS DM_GROUP (
OWNER VARCHAR(45) DEFAULT NULL,
PARENT_PATH VARCHAR(255) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
+ PARENT_GROUP_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID)
)
;
From 67c529b0fae4c51142771dba1debb7eae074d29a Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Wed, 14 Jun 2023 17:16:38 +0530
Subject: [PATCH 11/50] fixes line issues
---
.../group/mgt/DeviceGroupRoleWrapper.java | 20 ++--
.../core/device/mgt/core/dao/GroupDAO.java | 92 +++++++++----------
2 files changed, 52 insertions(+), 60 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java
index 132730e915..768fe55524 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/DeviceGroupRoleWrapper.java
@@ -37,12 +37,10 @@ public class DeviceGroupRoleWrapper implements Serializable {
@ApiModelProperty(name = "id", value = "ID of the device group in the device group information database.")
private int id;
- @ApiModelProperty(name = "description", value = "The device group description that can be set on the device group by the user.",
- required = true)
+ @ApiModelProperty(name = "description", value = "The device group description that can be set on the device group by the user.", required = true)
private String description;
- @ApiModelProperty(name = "name", value = "The device group name that can be set on the device group by the user.",
- required = true)
+ @ApiModelProperty(name = "name", value = "The device group name that can be set on the device group by the user.", required = true)
private String name;
private String owner;
@@ -62,10 +60,8 @@ public class DeviceGroupRoleWrapper implements Serializable {
@ApiModelProperty(name = "userRoles", value = "User roles")
private List userRoles;
-// @ApiModelProperty(name = "DeviceGroupRoleWrapper", value = "Device group role wrapper")
-// private List DeviceGroupRoleWrapper;
-
- public DeviceGroupRoleWrapper() {}
+ public DeviceGroupRoleWrapper() {
+ }
public DeviceGroupRoleWrapper(String name) {
this.name = name;
@@ -79,7 +75,7 @@ public class DeviceGroupRoleWrapper implements Serializable {
this.status = status;
}
- private Map groupProperties;
+ private Map groupProperties;
public int getGroupId() {
return id;
@@ -113,11 +109,11 @@ public class DeviceGroupRoleWrapper implements Serializable {
this.owner = owner;
}
- public Map getGroupProperties() {
+ public Map getGroupProperties() {
return groupProperties;
}
- public void setGroupProperties(Map groupProperties) {
+ public void setGroupProperties(Map groupProperties) {
this.groupProperties = groupProperties;
}
@@ -152,4 +148,4 @@ public class DeviceGroupRoleWrapper implements Serializable {
public void setUserRoles(List userRoles) {
this.userRoles = userRoles;
}
-}
+}
\ No newline at end of file
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
index 55f1da1f0d..b7ef873c0d 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
@@ -32,6 +32,7 @@ import java.util.Map;
* This interface represents the key operations associated with persisting group related information.
*/
public interface GroupDAO {
+
/**
* Add new Device Group.
*
@@ -42,21 +43,18 @@ public interface GroupDAO {
*/
int addGroup(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException;
-
/**
* Add properties for device group.
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
*
- * @param groups to be added.
- * @param tenantId of the group.
+ * @param groups to be added.
+ * @param tenantId of the group.
* @return sql execution result.
* @throws GroupManagementDAOException
*/
int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException;
-
-
/**
* Add properties for device group.
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
@@ -67,7 +65,6 @@ public interface GroupDAO {
* @return sql execution result.
* @throws GroupManagementDAOException
*/
-
boolean addGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) throws GroupManagementDAOException;
/**
@@ -75,12 +72,11 @@ public interface GroupDAO {
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
*
- * @param groups to be updated.
- * @param tenantId of the group.
+ * @param groups to be updated.
+ * @param tenantId of the group.
* @return sql execution result.
* @throws GroupManagementDAOException
*/
-
boolean addGroupPropertiesWithRoles(DeviceGroupRoleWrapper groups, int groupId, int tenantId) throws GroupManagementDAOException;
/**
@@ -98,8 +94,8 @@ public interface GroupDAO {
/**
* Remove properties for device group.
*
- * @param groupId to be deleted.
- * @param tenantId of the group.
+ * @param groupId to be deleted.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException
*/
void deleteAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
@@ -116,19 +112,19 @@ public interface GroupDAO {
/**
* Retrives all properties stored against a group.
*
- * @param groupId to be deleted.
- * @param tenantId of the group.
+ * @param groupId to be deleted.
+ * @param tenantId of the group.
* @return sql execution result.
* @throws GroupManagementDAOException
*/
- Map getAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
+ Map getAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
/**
* Update an existing Device Group.
*
* @param deviceGroup group to update.
- * @param groupId of Device Group.
- * @param tenantId of the group.
+ * @param groupId of Device Group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException
*/
void updateGroup(DeviceGroup deviceGroup, int groupId, int tenantId)
@@ -138,7 +134,7 @@ public interface GroupDAO {
* Update existing Device Groups.
*
* @param deviceGroups groups to update.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException on error during updating of groups
*/
void updateGroups(List deviceGroups, int tenantId) throws GroupManagementDAOException;
@@ -146,8 +142,8 @@ public interface GroupDAO {
/**
* Delete an existing Device Group.
*
- * @param groupId of Device Group.
- * @param tenantId of the group.
+ * @param groupId of Device Group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException
*/
void deleteGroup(int groupId, int tenantId) throws GroupManagementDAOException;
@@ -156,7 +152,7 @@ public interface GroupDAO {
* Delete mappings of Device Groups.
*
* @param groupIds of Device Groups.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException on error during deletion of mappings of groups
*/
void deleteGroupsMapping(List groupIds, int tenantId) throws GroupManagementDAOException;
@@ -165,7 +161,7 @@ public interface GroupDAO {
* Delete existing Device Groups.
*
* @param groupIds of Device Groups.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException on error during deletion of groups
*/
void deleteGroups(List groupIds, int tenantId) throws GroupManagementDAOException;
@@ -173,8 +169,8 @@ public interface GroupDAO {
/**
* Get device group by id.
*
- * @param groupId of Device Group.
- * @param tenantId of the group.
+ * @param groupId of Device Group.
+ * @param tenantId of the group.
* @return Device Group in tenant with specified name.
* @throws GroupManagementDAOException
*/
@@ -184,7 +180,7 @@ public interface GroupDAO {
* Get children groups by parent path.
*
* @param parentPath of parent group.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @return {@link List} list of children device groups
* @throws GroupManagementDAOException on error during retrieval of children groups
*/
@@ -193,7 +189,7 @@ public interface GroupDAO {
/**
* Get root groups.
*
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @return {@link List} list of root device groups
* @throws GroupManagementDAOException on error during retrieval of root groups
*/
@@ -201,6 +197,7 @@ public interface GroupDAO {
/**
* Get the groups of device with device id provided
+ *
* @param deviceId
* @return groups which has the device.
* @throws GroupManagementDAOException
@@ -211,7 +208,7 @@ public interface GroupDAO {
* Get paginated list of Device Groups in tenant.
*
* @param paginationRequest to filter results.
- * @param tenantId of user's tenant.
+ * @param tenantId of user's tenant.
* @return List of all Device Groups in tenant.
* @throws GroupManagementDAOException
*/
@@ -251,7 +248,7 @@ public interface GroupDAO {
* Get paginated count of Device Groups in tenant.
*
* @param paginationRequest to filter results.
- * @param tenantId of user's tenant.
+ * @param tenantId of user's tenant.
* @return List of all Device Groups in tenant.
* @throws GroupManagementDAOException
*/
@@ -261,7 +258,7 @@ public interface GroupDAO {
* Check group already existed with given name.
*
* @param groupName of the Device Group.
- * @param tenantId of user's tenant.
+ * @param tenantId of user's tenant.
* @return existence of group with name
* @throws GroupManagementDAOException
*/
@@ -270,7 +267,7 @@ public interface GroupDAO {
/**
* Add device to a given Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param deviceId of the device.
* @param tenantId of user's tenant.
* @throws GroupManagementDAOException
@@ -280,7 +277,7 @@ public interface GroupDAO {
/**
* Remove device from the Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param deviceId of the device.
* @param tenantId of user's tenant.
* @throws GroupManagementDAOException
@@ -290,7 +287,7 @@ public interface GroupDAO {
/**
* Check device is belonging to a Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param deviceId of the device.
* @param tenantId of user's tenant.
* @throws GroupManagementDAOException
@@ -301,7 +298,7 @@ public interface GroupDAO {
/**
* Get count of devices in a Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param tenantId of user's tenant.
* @return device count.
* @throws GroupManagementDAOException
@@ -311,10 +308,10 @@ public interface GroupDAO {
/**
* Get paginated result of devices of a given tenant and device group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param startIndex for pagination.
- * @param rowCount for pagination.
- * @param tenantId of user's tenant.
+ * @param rowCount for pagination.
+ * @param tenantId of user's tenant.
* @return list of device in group
* @throws GroupManagementDAOException
*/
@@ -324,9 +321,9 @@ public interface GroupDAO {
/**
* Get All the devices that are in one of the given device status and belongs to given group
*
- * @param groupName Group name
+ * @param groupName Group name
* @param deviceStatuses Device Statuses
- * @param tenantId Tenant Id
+ * @param tenantId Tenant Id
* @return List of devices
* @throws GroupManagementDAOException if error occurred while retreving list of devices that are in one of the
* given device status and belongs to the given group
@@ -389,8 +386,8 @@ public interface GroupDAO {
/**
* Get count of all device groups which shared with a user role.
*
- * @param roles of the group.
- * @param tenantId of user's tenant.
+ * @param roles of the group.
+ * @param tenantId of user's tenant.
* @param parentPath of the group.
* @return count of device groups.
* @throws GroupManagementDAOException
@@ -420,27 +417,26 @@ public interface GroupDAO {
/**
* Get count of device groups which owned by user.
*
- * @param username of the owner.
- * @param tenantId of user's tenant.
+ * @param username of the owner.
+ * @param tenantId of user's tenant.
* @param parentPath of the group.
* @return count of device groups.
* @throws GroupManagementDAOException
*/
int getOwnGroupsCount(String username, int tenantId, String parentPath) throws GroupManagementDAOException;
-
/**
- * Get device Ids of devices which are assigned to groups.
+ components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java * Get device Ids of devices which are assigned to groups.
*
* @param paginationRequest Request object with offset and limit.
- * @param groupNames default group names that should be omitted when checking the device
- * whether they have been assigned to groups
- * @throws GroupManagementDAOException Might occur while retrieving information of group
- * unassigned devices
+ * @param groupNames default group names that should be omitted when checking the device
+ * whether they have been assigned to groups
* @return details of devices that are unassigned to groups.
+ * @throws GroupManagementDAOException Might occur while retrieving information of group
+ * unassigned devices
*/
List getGroupUnassignedDevices(PaginationRequest paginationRequest,
List groupNames)
throws GroupManagementDAOException;
-}
+}
\ No newline at end of file
From bb507173703f03f8565676ff18323e43aba6f506 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Wed, 14 Jun 2023 17:45:27 +0530
Subject: [PATCH 12/50] remove unnecessary imports, fixes line issues
---
.../jaxrs/service/impl/GroupManagementServiceImpl.java | 4 ----
.../device/mgt/core/dao/impl/AbstractGroupDAOImpl.java | 4 ----
.../mgt/core/service/GroupManagementProviderService.java | 5 ++---
.../core/service/GroupManagementProviderServiceImpl.java | 8 ++------
4 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
index b68bbd0f3a..ef9928dc39 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
@@ -49,9 +49,6 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils;
import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint;
import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.transaction.UserTransaction;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -467,5 +464,4 @@ public class GroupManagementServiceImpl implements GroupManagementService {
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
}
}
-
}
\ No newline at end of file
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
index 7331ab6ad5..5f29424336 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
@@ -197,8 +197,6 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
if (hasStatus) {
stmt.setString(7, deviceGroup.getStatus());
}
-
-
stmt.executeUpdate();
rs = stmt.getGeneratedKeys();
if (rs.next()) {
@@ -239,8 +237,6 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
if (hasStatus) {
stmt.setString(7, groups.getStatus());
}
-
-
stmt.executeUpdate();
rs = stmt.getGeneratedKeys();
if (rs.next()) {
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
index f65244842c..f52524db91 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
@@ -46,13 +46,12 @@ public interface GroupManagementProviderService {
/**
* Add new device group and create default role with default permissions.
*
- * @param groups to add
+ * @param groups to add
* @param defaultRole of the deviceGroup
* @param defaultPermissions of the default role
* @throws GroupManagementException
*/
- void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole,
- String[] defaultPermissions )throws GroupManagementException, GroupAlreadyExistException, RoleDoesNotExistException;
+ void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException, GroupAlreadyExistException, RoleDoesNotExistException;
/**
* Update existing device group.
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index 40d45b0963..2d0b82c194 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -147,9 +147,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
}
-
- public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions)
- throws GroupManagementException, GroupAlreadyExistException {
+ public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException, GroupAlreadyExistException {
if (groups == null) {
String msg = "Received incomplete data for createGroup";
log.error(msg);
@@ -168,9 +166,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} else {
DeviceGroup immediateParentGroup = groupDAO.getGroup(groups.getParentGroupId(), tenantId);
if (immediateParentGroup == null) {
- String msg = "Parent group with group ID '" + groups.getParentGroupId()
- + "' does not exist. Hence creating of group '" + groups.getName()
- + "' was not success";
+ String msg = "Parent group with group ID '" + groups.getParentGroupId() + "' does not exist. Hence creating of group '" + groups.getName() + "' was not success";
log.error(msg);
throw new GroupManagementException(msg);
}
From bc2bccac84c1971ebf5b560319054cbbcee60db8 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Wed, 14 Jun 2023 18:38:11 +0530
Subject: [PATCH 13/50] remove unnecessary code lines
---
.../core/device/mgt/core/dao/GroupDAO.java | 85 +++++++++----------
1 file changed, 42 insertions(+), 43 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
index b7ef873c0d..e1639e6262 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
@@ -32,7 +32,6 @@ import java.util.Map;
* This interface represents the key operations associated with persisting group related information.
*/
public interface GroupDAO {
-
/**
* Add new Device Group.
*
@@ -48,8 +47,8 @@ public interface GroupDAO {
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
*
- * @param groups to be added.
- * @param tenantId of the group.
+ * @param groups to be added.
+ * @param tenantId of the group.
* @return sql execution result.
* @throws GroupManagementDAOException
*/
@@ -72,8 +71,8 @@ public interface GroupDAO {
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
*
- * @param groups to be updated.
- * @param tenantId of the group.
+ * @param groups to be updated.
+ * @param tenantId of the group.
* @return sql execution result.
* @throws GroupManagementDAOException
*/
@@ -94,8 +93,8 @@ public interface GroupDAO {
/**
* Remove properties for device group.
*
- * @param groupId to be deleted.
- * @param tenantId of the group.
+ * @param groupId to be deleted.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException
*/
void deleteAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
@@ -112,19 +111,19 @@ public interface GroupDAO {
/**
* Retrives all properties stored against a group.
*
- * @param groupId to be deleted.
- * @param tenantId of the group.
+ * @param groupId to be deleted.
+ * @param tenantId of the group.
* @return sql execution result.
* @throws GroupManagementDAOException
*/
- Map getAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
+ Map getAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
/**
* Update an existing Device Group.
*
* @param deviceGroup group to update.
- * @param groupId of Device Group.
- * @param tenantId of the group.
+ * @param groupId of Device Group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException
*/
void updateGroup(DeviceGroup deviceGroup, int groupId, int tenantId)
@@ -134,7 +133,7 @@ public interface GroupDAO {
* Update existing Device Groups.
*
* @param deviceGroups groups to update.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException on error during updating of groups
*/
void updateGroups(List deviceGroups, int tenantId) throws GroupManagementDAOException;
@@ -142,8 +141,8 @@ public interface GroupDAO {
/**
* Delete an existing Device Group.
*
- * @param groupId of Device Group.
- * @param tenantId of the group.
+ * @param groupId of Device Group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException
*/
void deleteGroup(int groupId, int tenantId) throws GroupManagementDAOException;
@@ -152,7 +151,7 @@ public interface GroupDAO {
* Delete mappings of Device Groups.
*
* @param groupIds of Device Groups.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException on error during deletion of mappings of groups
*/
void deleteGroupsMapping(List groupIds, int tenantId) throws GroupManagementDAOException;
@@ -161,7 +160,7 @@ public interface GroupDAO {
* Delete existing Device Groups.
*
* @param groupIds of Device Groups.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @throws GroupManagementDAOException on error during deletion of groups
*/
void deleteGroups(List groupIds, int tenantId) throws GroupManagementDAOException;
@@ -169,8 +168,8 @@ public interface GroupDAO {
/**
* Get device group by id.
*
- * @param groupId of Device Group.
- * @param tenantId of the group.
+ * @param groupId of Device Group.
+ * @param tenantId of the group.
* @return Device Group in tenant with specified name.
* @throws GroupManagementDAOException
*/
@@ -180,7 +179,7 @@ public interface GroupDAO {
* Get children groups by parent path.
*
* @param parentPath of parent group.
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @return {@link List} list of children device groups
* @throws GroupManagementDAOException on error during retrieval of children groups
*/
@@ -189,7 +188,7 @@ public interface GroupDAO {
/**
* Get root groups.
*
- * @param tenantId of the group.
+ * @param tenantId of the group.
* @return {@link List} list of root device groups
* @throws GroupManagementDAOException on error during retrieval of root groups
*/
@@ -197,7 +196,6 @@ public interface GroupDAO {
/**
* Get the groups of device with device id provided
- *
* @param deviceId
* @return groups which has the device.
* @throws GroupManagementDAOException
@@ -208,7 +206,7 @@ public interface GroupDAO {
* Get paginated list of Device Groups in tenant.
*
* @param paginationRequest to filter results.
- * @param tenantId of user's tenant.
+ * @param tenantId of user's tenant.
* @return List of all Device Groups in tenant.
* @throws GroupManagementDAOException
*/
@@ -248,7 +246,7 @@ public interface GroupDAO {
* Get paginated count of Device Groups in tenant.
*
* @param paginationRequest to filter results.
- * @param tenantId of user's tenant.
+ * @param tenantId of user's tenant.
* @return List of all Device Groups in tenant.
* @throws GroupManagementDAOException
*/
@@ -258,7 +256,7 @@ public interface GroupDAO {
* Check group already existed with given name.
*
* @param groupName of the Device Group.
- * @param tenantId of user's tenant.
+ * @param tenantId of user's tenant.
* @return existence of group with name
* @throws GroupManagementDAOException
*/
@@ -267,7 +265,7 @@ public interface GroupDAO {
/**
* Add device to a given Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param deviceId of the device.
* @param tenantId of user's tenant.
* @throws GroupManagementDAOException
@@ -277,7 +275,7 @@ public interface GroupDAO {
/**
* Remove device from the Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param deviceId of the device.
* @param tenantId of user's tenant.
* @throws GroupManagementDAOException
@@ -287,7 +285,7 @@ public interface GroupDAO {
/**
* Check device is belonging to a Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param deviceId of the device.
* @param tenantId of user's tenant.
* @throws GroupManagementDAOException
@@ -298,7 +296,7 @@ public interface GroupDAO {
/**
* Get count of devices in a Device Group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param tenantId of user's tenant.
* @return device count.
* @throws GroupManagementDAOException
@@ -308,10 +306,10 @@ public interface GroupDAO {
/**
* Get paginated result of devices of a given tenant and device group.
*
- * @param groupId of Device Group.
+ * @param groupId of Device Group.
* @param startIndex for pagination.
- * @param rowCount for pagination.
- * @param tenantId of user's tenant.
+ * @param rowCount for pagination.
+ * @param tenantId of user's tenant.
* @return list of device in group
* @throws GroupManagementDAOException
*/
@@ -321,9 +319,9 @@ public interface GroupDAO {
/**
* Get All the devices that are in one of the given device status and belongs to given group
*
- * @param groupName Group name
+ * @param groupName Group name
* @param deviceStatuses Device Statuses
- * @param tenantId Tenant Id
+ * @param tenantId Tenant Id
* @return List of devices
* @throws GroupManagementDAOException if error occurred while retreving list of devices that are in one of the
* given device status and belongs to the given group
@@ -386,8 +384,8 @@ public interface GroupDAO {
/**
* Get count of all device groups which shared with a user role.
*
- * @param roles of the group.
- * @param tenantId of user's tenant.
+ * @param roles of the group.
+ * @param tenantId of user's tenant.
* @param parentPath of the group.
* @return count of device groups.
* @throws GroupManagementDAOException
@@ -417,22 +415,23 @@ public interface GroupDAO {
/**
* Get count of device groups which owned by user.
*
- * @param username of the owner.
- * @param tenantId of user's tenant.
+ * @param username of the owner.
+ * @param tenantId of user's tenant.
* @param parentPath of the group.
* @return count of device groups.
* @throws GroupManagementDAOException
*/
int getOwnGroupsCount(String username, int tenantId, String parentPath) throws GroupManagementDAOException;
+
/**
- components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java * Get device Ids of devices which are assigned to groups.
+ * Get device Ids of devices which are assigned to groups.
*
* @param paginationRequest Request object with offset and limit.
- * @param groupNames default group names that should be omitted when checking the device
- * whether they have been assigned to groups
- * @return details of devices that are unassigned to groups.
+ * @param groupNames default group names that should be omitted when checking the device
+ * whether they have been assigned to groups
* @throws GroupManagementDAOException Might occur while retrieving information of group
- * unassigned devices
+ * unassigned devices
+ * @return details of devices that are unassigned to groups.
*/
List getGroupUnassignedDevices(PaginationRequest paginationRequest,
From 00b107ee99d4493e8dc80e40776a7720ca02e89a Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Thu, 15 Jun 2023 11:15:23 +0530
Subject: [PATCH 14/50] remove unnecessary variable, change error msg
---
.../jaxrs/service/impl/GroupManagementServiceImpl.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
index ef9928dc39..1c077c00a5 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
@@ -435,15 +435,15 @@ public class GroupManagementServiceImpl implements GroupManagementService {
@Path("/roles/share")
@Override
public Response createGroupWithRoles(DeviceGroupRoleWrapper groups) {
- String owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
if (groups == null) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
- groups.setOwner(owner);
+ groups.setOwner(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
groups.setStatus(DeviceGroupConstants.GroupStatus.ACTIVE);
try {
DeviceMgtAPIUtils.getGroupManagementProviderService().createGroupWithRoles(groups, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
- DeviceGroup group = DeviceMgtAPIUtils.getGroupManagementProviderService().getGroup(groups.getName(), owner.isEmpty());
+ DeviceGroup group = DeviceMgtAPIUtils.getGroupManagementProviderService().getGroup(groups.getName(),
+ PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername().isEmpty());
if (group != null) {
DeviceMgtAPIUtils.getGroupManagementProviderService().manageGroupSharing(group.getGroupId(), groups.getUserRoles());
return Response.status(Response.Status.CREATED).entity(group.getGroupId()).build();
@@ -453,7 +453,7 @@ public class GroupManagementServiceImpl implements GroupManagementService {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
} catch (GroupManagementException e) {
- String msg = "Error occurred while adding new group.";
+ String msg = "Error occurred while adding " + groups.getName() + " group";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupAlreadyExistException e) {
From e66c3dc6f62fc8e22c0100c19395426fe0562401 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Thu, 15 Jun 2023 14:29:10 +0530
Subject: [PATCH 15/50] add error log
---
.../impl/admin/GroupManagementAdminServiceImpl.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
index 30546f214a..4495a3fe9c 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
@@ -152,21 +152,22 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
@Path("/roles/share")
@Override
public Response createGroupWithRoles(DeviceGroupRoleWrapper group) {
- String owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
if (group == null) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
- group.setOwner(owner);
+ group.setOwner(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
group.setStatus(DeviceGroupConstants.GroupStatus.ACTIVE);
try {
DeviceMgtAPIUtils.getGroupManagementProviderService().createGroupWithRoles(group, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
DeviceMgtAPIUtils.getGroupManagementProviderService().manageGroupSharing(group.getGroupId(), group.getUserRoles());
return Response.status(Response.Status.CREATED).build();
} catch (GroupManagementException e) {
- String msg = "Error occurred while adding new group.";
+ String msg = "Error occurred while adding " + group.getName() + " group";
+ log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupAlreadyExistException e) {
String msg = "Group already exists with name : " + group.getName() + ".";
+ log.warn(msg);
return Response.status(Response.Status.CONFLICT).entity(msg).build();
} catch (RoleDoesNotExistException e) {
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
From 3722bfc761dc927deb9ee5d392765b85fe200e5d Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Fri, 16 Jun 2023 01:58:42 +0530
Subject: [PATCH 16/50] add try with resources
---
.../core/dao/impl/AbstractGroupDAOImpl.java | 68 +++++++++----------
.../impl/group/PostgreSQLGroupDAOImpl.java | 47 +++++++------
.../GroupManagementProviderService.java | 8 ++-
.../GroupManagementProviderServiceImpl.java | 15 ++--
4 files changed, 72 insertions(+), 66 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
index 5f29424336..937b975259 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
@@ -211,9 +211,8 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
}
}
+ @Override
public int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException {
- PreparedStatement stmt = null;
- ResultSet rs;
int groupId = -1;
boolean hasStatus = false;
try {
@@ -227,27 +226,29 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
+ "VALUES (?, ?, ?, ?, ?, ?, ?)";
hasStatus = true;
}
- stmt = conn.prepareStatement(sql, new String[]{"ID"});
- stmt.setString(1, groups.getDescription());
- stmt.setString(2, groups.getName());
- stmt.setString(3, groups.getOwner());
- stmt.setInt(4, tenantId);
- stmt.setString(5, groups.getParentPath());
- stmt.setInt(6, groups.getParentGroupId());
- if (hasStatus) {
- stmt.setString(7, groups.getStatus());
- }
- stmt.executeUpdate();
- rs = stmt.getGeneratedKeys();
- if (rs.next()) {
- groupId = rs.getInt(1);
+ try (PreparedStatement stmt = conn.prepareStatement(sql, new String[]{"ID"})) {
+ stmt.setString(1, groups.getDescription());
+ stmt.setString(2, groups.getName());
+ stmt.setString(3, groups.getOwner());
+ stmt.setInt(4, tenantId);
+ stmt.setString(5, groups.getParentPath());
+ stmt.setInt(6, groups.getParentGroupId());
+ if (hasStatus) {
+ stmt.setString(7, groups.getStatus());
+ }
+ stmt.executeUpdate();
+ try (ResultSet rs = stmt.getGeneratedKeys();) {
+ if (rs.next()) {
+ groupId = rs.getInt(1);
+ }
+ return groupId;
+ }
}
- return groupId;
} catch (SQLException e) {
- throw new GroupManagementDAOException("Error occurred while adding deviceGroup '" +
- groups.getName() + "'", e);
- } finally {
- GroupManagementDAOUtil.cleanupResources(stmt, null);
+ String msg = "Error occurred while adding deviceGroup '" +
+ groups.getName() + "'";
+ log.error(msg);
+ throw new GroupManagementDAOException(msg, e);
}
}
@@ -282,27 +283,26 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
public boolean addGroupPropertiesWithRoles(DeviceGroupRoleWrapper groups, int groupId, int tenantId)
throws GroupManagementDAOException {
boolean status;
- PreparedStatement stmt = null;
try {
Connection conn = GroupManagementDAOFactory.getConnection();
- stmt = conn.prepareStatement(
+ try (PreparedStatement stmt = conn.prepareStatement(
"INSERT INTO GROUP_PROPERTIES(GROUP_ID, PROPERTY_NAME, " +
- "PROPERTY_VALUE, TENANT_ID) VALUES (?, ?, ?, ?)");
- for (Map.Entry entry : groups.getGroupProperties().entrySet()) {
- stmt.setInt(1, groupId);
- stmt.setString(2, entry.getKey());
- stmt.setString(3, entry.getValue());
- stmt.setInt(4, tenantId);
- stmt.addBatch();
+ "PROPERTY_VALUE, TENANT_ID) VALUES (?, ?, ?, ?)")) {
+ for (Map.Entry entry : groups.getGroupProperties().entrySet()) {
+ stmt.setInt(1, groupId);
+ stmt.setString(2, entry.getKey());
+ stmt.setString(3, entry.getValue());
+ stmt.setInt(4, tenantId);
+ stmt.addBatch();
+ }
+ stmt.executeBatch();
+ status = true;
}
- stmt.executeBatch();
- status = true;
} catch (SQLException e) {
String msg = "Error occurred while adding properties for group '" +
groups.getName() + "' values : " + groups.getGroupProperties();
+ log.error(msg);
throw new GroupManagementDAOException(msg, e);
- } finally {
- GroupManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java
index 00b581c1a4..67994b51a6 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java
@@ -19,6 +19,8 @@
package io.entgra.device.mgt.core.device.mgt.core.dao.impl.group;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.solr.common.StringUtils;
import io.entgra.device.mgt.core.device.mgt.common.Device;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
@@ -40,6 +42,8 @@ import java.util.List;
*/
public class PostgreSQLGroupDAOImpl extends AbstractGroupDAOImpl {
+ private static final Log log = LogFactory.getLog(PostgreSQLGroupDAOImpl.class);
+
@Override
public int addGroup(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException {
PreparedStatement stmt = null;
@@ -80,15 +84,14 @@ public class PostgreSQLGroupDAOImpl extends AbstractGroupDAOImpl {
}
}
+ @Override
public int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException {
- PreparedStatement stmt = null;
- ResultSet rs;
int groupId = -1;
boolean hasStatus = false;
try {
Connection conn = GroupManagementDAOFactory.getConnection();
String sql;
- if(StringUtils.isEmpty(groups.getStatus())) {
+ if (StringUtils.isEmpty(groups.getStatus())) {
sql = "INSERT INTO DM_GROUP(DESCRIPTION, GROUP_NAME, OWNER, TENANT_ID, PARENT_PATH) " +
"VALUES (?, ?, ?, ?) RETURNING ID";
} else {
@@ -96,26 +99,28 @@ public class PostgreSQLGroupDAOImpl extends AbstractGroupDAOImpl {
"VALUES (?, ?, ?, ?, ?) RETURNING ID";
hasStatus = true;
}
- stmt = conn.prepareStatement(sql);
- stmt.setString(1, groups.getDescription());
- stmt.setString(2, groups.getName());
- stmt.setString(3, groups.getOwner());
- stmt.setInt(4, tenantId);
- stmt.setString(5, groups.getParentPath());
- if(hasStatus) {
- stmt.setString(6, groups.getStatus());
- }
- stmt.execute();
- rs = stmt.getGeneratedKeys();
- if (rs.next()) {
- groupId = rs.getInt(1);
+ try (PreparedStatement stmt = conn.prepareStatement(sql)) {
+ stmt.setString(1, groups.getDescription());
+ stmt.setString(2, groups.getName());
+ stmt.setString(3, groups.getOwner());
+ stmt.setInt(4, tenantId);
+ stmt.setString(5, groups.getParentPath());
+ if (hasStatus) {
+ stmt.setString(6, groups.getStatus());
+ }
+ stmt.execute();
+ try (ResultSet rs = stmt.getGeneratedKeys()) {
+ if (rs.next()) {
+ groupId = rs.getInt(1);
+ }
+ return groupId;
+ }
}
- return groupId;
} catch (SQLException e) {
- throw new GroupManagementDAOException("Error occurred while adding deviceGroup '" +
- groups.getName() + "'", e);
- } finally {
- GroupManagementDAOUtil.cleanupResources(stmt, null);
+ String msg = "Error occurred while adding deviceGroup '" +
+ groups.getName() + "'";
+ log.error(msg);
+ throw new GroupManagementDAOException(msg, e);
}
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
index f52524db91..153b97b5bf 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
@@ -23,7 +23,13 @@ import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException;
import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
import io.entgra.device.mgt.core.device.mgt.common.PaginationResult;
-import io.entgra.device.mgt.core.device.mgt.common.group.mgt.*;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
import java.util.List;
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index 2d0b82c194..9540577805 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -35,6 +35,7 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.netbeans.lib.cvsclient.commandLine.command.status;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
@@ -147,7 +148,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
}
- public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException, GroupAlreadyExistException {
+ public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException {
if (groups == null) {
String msg = "Received incomplete data for createGroup";
log.error(msg);
@@ -179,23 +180,17 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
GroupManagementDAOFactory.commitTransaction();
} else {
- throw new GroupAlreadyExistException("Group exist with name " + groups.getName());
+ throw new GroupManagementException("Group exist with name " + groups.getName());
}
- } catch (GroupManagementDAOException e) {
+ } catch (GroupManagementDAOException | GroupManagementException e) {
GroupManagementDAOFactory.rollbackTransaction();
- String msg = "Error occurred while adding deviceGroup '" + groups.getName() + "' to database.";
+ String msg = e.getMessage();
log.error(msg, e);
throw new GroupManagementException(msg, e);
} catch (TransactionManagementException e) {
String msg = "Error occurred while initiating transaction.";
log.error(msg, e);
throw new GroupManagementException(msg, e);
- } catch (GroupAlreadyExistException ex) {
- throw ex;
- } catch (Exception e) {
- String msg = "Error occurred in creating group '" + groups.getName() + "'";
- log.error(msg, e);
- throw new GroupManagementException(msg, e);
} finally {
GroupManagementDAOFactory.closeConnection();
}
From 647d4fdb78e7b315ab6a6172a15e09833e330168 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Fri, 16 Jun 2023 09:48:52 +0530
Subject: [PATCH 17/50] add rollback
---
.../mgt/core/service/GroupManagementProviderServiceImpl.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index 9540577805..be1ad0d545 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -167,6 +167,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} else {
DeviceGroup immediateParentGroup = groupDAO.getGroup(groups.getParentGroupId(), tenantId);
if (immediateParentGroup == null) {
+ GroupManagementDAOFactory.rollbackTransaction();
String msg = "Parent group with group ID '" + groups.getParentGroupId() + "' does not exist. Hence creating of group '" + groups.getName() + "' was not success";
log.error(msg);
throw new GroupManagementException(msg);
@@ -182,7 +183,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} else {
throw new GroupManagementException("Group exist with name " + groups.getName());
}
- } catch (GroupManagementDAOException | GroupManagementException e) {
+ } catch (GroupManagementDAOException e) {
GroupManagementDAOFactory.rollbackTransaction();
String msg = e.getMessage();
log.error(msg, e);
From cf2bd5e9353587cffbb5c1151c77ac938178416a Mon Sep 17 00:00:00 2001
From: Kavin Prathaban
Date: Fri, 16 Jun 2023 10:06:30 +0000
Subject: [PATCH 18/50] Add custom loggers (#136)
## Purpose
* Fixes https://roadmap.entgra.net/issues/10117
## Description
* Added custom logs for below cases:
1. Device connectivity events
2. Policy payload change events
3. Device enrollment history events
4. App install events
#### Log structure
**1. Device connectivity logs** - logs for newly added operations and calls for pending operations
Pattern :
{DateTime} {LogLevel} - {ActionTag} {OperationCode} {DeviceId} {DeviceType} {TenantDomain} {TenantId} {UserName} - log_message
```
[2023-06-15 00:12:09,093] INFO - [ADD_OPERATION] [DEVICE_LOCATION] [97] [android] [carbon.super] [-1234] [admin]- Operation added
[2023-06-15 00:12:10,344] INFO - [PENDING_OPERATION] [DEVICE_LOCATION] [675c60a9d31492d6] [android] [carbon.super] [-1234] [admin]- Device Connected
[2023-06-15 00:13:49,755] INFO - [ADD_OPERATION] [DEVICE_LOCK] [97] [android] [carbon.super] [-1234] [admin]- Operation added
[2023-06-15 00:13:56,513] INFO - [ADD_OPERATION] [DEVICE_MUTE] [97] [android] [carbon.super] [-1234] [admin]- Operation added
[2023-06-15 00:14:23,839] INFO - [PENDING_OPERATION] [DEVICE_MUTE]
[2023-06-15 00:15:12,549] INFO - [ADD_OPERATION] [INSTALL_APPLICATION] [97] [android] [carbon.super] [-1234] [admin]- Operation added
[2023-06-15 00:15:29,703] INFO - [PENDING_OPERATION] [INSTALL_APPLICATION] [675c60a9d31492d6] [android] [carbon.super] [-1234] [admin]- Device Connected
```
**2. Policy payload change events** - logs for creating policy, updating policy, deleting policy, change policy priorities and apply changes to device logs
Pattern :
{DateTime} {LogLevel} - {ActionTag} {PolicyName} {TenantDomain} {TenantId} {Payload} {UserName} - log_message
```
[2023-06-15 00:15:53,264] INFO - [UPDATE_POLICY] [passcodeios] [carbon.super] [-1234] [{"policyPayloadVersion":"2.0","id":33,"priorityId":1,"profile":{"profileId":33,"profileName":"passcodeios","tenantId":0,"deviceType":"ios","updatedDate":"Jun 15, 2023 12:15:53 AM","profileFeaturesList":[{"id":33,"featureCode":"PASSCODE_POLICY","profileId":0,"deviceType":"ios","content":"{\"forcePIN\":true,\"allowSimple\":true,\"requireAlphanumeric\":true,\"minLength\":7.0,\"minComplexChars\":4.0,\"pinHistory\":\"\"}","correctiveActions":[]}]},"policyName":"passcodeios","generic":false,"roles":["ANY"],"devices":[],"users":[],"active":false,"updated":false,"description":"test","compliance":"enforce","tenantId":-1234,"profileId":33,"policyType":"GENERAL"}] [admin] - Policy updated
[2023-06-15 00:34:38,980] INFO - [ADD_POLICY] [application management policy] [carbon.super] [-1234] [{"policyPayloadVersion":"2.0","id":65,"priorityId":0,"profile":{"profileId":65,"profileName":"application management policy","tenantId":0,"deviceType":"windows","createdDate":"Jun 15, 2023 12:34:38 AM","updatedDate":"Jun 15, 2023 12:34:38 AM","profileFeaturesList":[{"id":65,"featureCode":"ALLOW_ALL_TRUSTED_APPS","profileId":0,"deviceType":"windows","content":"{\"enabled\":true}","correctiveActions":[]},{"id":73,"featureCode":"RESTRICT_APP_TO_SYSTEM_VOLUME","profileId":0,"deviceType":"windows","content":"{\"enabled\":false}","correctiveActions":[]}]},"policyName":"application management policy","generic":false,"roles":["ANY"],"devices":[],"users":[],"active":false,"updated":false,"description":"test","compliance":"enforce","tenantId":-1234,"profileId":0,"policyType":"GENERAL"}] [admin] - Policy created
[2023-06-15 00:35:05,420] INFO - [DELETE_POLICY] [passcodeios] [carbon.super] [-1234] [{"policyPayloadVersion":"2.0","id":33,"priorityId":1,"profile":{"profileId":33,"profileName":"passcodeios","tenantId":-1234,"deviceType":"ios","createdDate":"Jun 13, 2023 10:24:30 PM","updatedDate":"Jun 15, 2023 12:15:53 AM","profileFeaturesList":[{"id":33,"featureCode":"PASSCODE_POLICY","profileId":33,"deviceType":"ios","content":"{\"forcePIN\":true,\"allowSimple\":true,\"requireAlphanumeric\":true,\"minLength\":7.0,\"minComplexChars\":4.0,\"pinHistory\":\"\"}","correctiveActions":[]}]},"policyName":"passcodeios","generic":false,"roles":["ANY"],"devices":[],"users":[],"active":false,"updated":true,"description":"test","compliance":"enforce","policyCriterias":[],"tenantId":-1234,"profileId":33,"deviceGroups":[],"policyType":"GENERAL"}] [admin] - Policy deleted
[2023-06-15 00:35:12,768] INFO - [UPDATE_POLICY_PRIORITIES] [] [carbon.super] [-1234] [[{"id":65,"priorityId":1,"generic":false,"active":false,"updated":false,"tenantId":0,"profileId":0},{"id":34,"priorityId":2,"generic":false,"active":false,"updated":false,"tenantId":0,"profileId":0}]] [admin] - Policy priorities updated
[2023-06-15 00:35:25,395] INFO - [PUBLISH_CHANGES] [] [carbon.super] [-1234] [] [admin] - Apply changes to device
```
**3. Device enrollment history events** - logs for device enrollment and dis-enrollment
Pattern :
{DateTime} {LogLevel} - {DeviceId} {DeviceType} {Owner} {Ownership} {TenantId} {TenantDomain} {UserName} - log_message
```
[2023-06-15 00:12:09,078] INFO - [97] [android] [admin] [BYOD] [-1234] [carbon.super] [admin] - Device enrolled successfully
[2023-06-15 00:47:36,278] INFO - [97] [android] [admin] [BYOD] [-1234] [carbon.super] [admin] - Device disenrolled successfully
```
**4. App install events** - logs for app installation and uninstallation
Pattern :
{DateTime} {LogLevel} - {AppId} {AppName} {AppType} {SubType} {Action} {Device} {TenantId} {TenantDomain} {UserName} - log_message
```
[2023-06-15 00:15:12,550] INFO - [1] [Calculator] [PUBLIC] [DEVICE] [install] [deviceId {id='675c60a9d31492d6', type='android'}] [-1234] [carbon.super] [admin] - App install triggered
[2023-06-15 00:46:24,454] INFO - [2] [Sololearn] [ENTERPRISE] [DEVICE] [install] [deviceId {id='675c60a9d31492d6', type='android'}] [-1234] [carbon.super] [admin] - App install triggered
[2023-06-15 00:46:40,498] INFO - [3] [Engineering] [WEB_CLIP] [DEVICE] [install] [deviceId {id='675c60a9d31492d6', type='android'}] [-1234] [carbon.super] [admin] - Web app install triggered
```
## Related PRs
* https://repository.entgra.net/proprietary/product-uem/pulls/6
Co-authored-by: prathabanKavin
Co-authored-by: Pahansith Gunathilake
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/136
Co-authored-by: Kavin Prathaban
Co-committed-by: Kavin Prathaban
---
.../core/impl/SubscriptionManagerImpl.java | 17 +-
.../operation/mgt/OperationManagerImpl.java | 27 +-
.../DeviceManagementProviderServiceImpl.java | 18 +-
.../logger/AppInstallLogContext.java | 181 ++++++++++
.../logger/DeviceConnectivityLogContext.java | 150 +++++++++
.../logger/DeviceEnrolmentLogContext.java | 149 ++++++++
.../notification/logger/PolicyLogContext.java | 133 ++++++++
.../impl/EntgraAppInstallLoggerImpl.java | 318 ++++++++++++++++++
.../EntgraDeviceConnectivityLoggerImpl.java | 318 ++++++++++++++++++
.../impl/EntgraDeviceEnrolmentLoggerImpl.java | 318 ++++++++++++++++++
.../logger/impl/EntgraDeviceLoggerImpl.java | 7 -
.../logger/impl/EntgraPolicyLoggerImpl.java | 318 ++++++++++++++++++
.../logger/impl/EntgraUserLoggerImpl.java | 2 -
.../logger/util/MDCContextUtil.java | 102 +++++-
.../impl/PolicyAdministratorPointImpl.java | 10 +-
.../mgt/core/mgt/impl/PolicyManagerImpl.java | 41 ++-
16 files changed, 2079 insertions(+), 30 deletions(-)
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/AppInstallLogContext.java
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceConnectivityLogContext.java
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceEnrolmentLogContext.java
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/PolicyLogContext.java
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraAppInstallLoggerImpl.java
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceConnectivityLoggerImpl.java
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceEnrolmentLoggerImpl.java
create mode 100644 components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraPolicyLoggerImpl.java
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
index 2412176b67..d89039dee5 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
@@ -20,6 +20,9 @@ package io.entgra.device.mgt.core.application.mgt.core.impl;
import com.google.gson.Gson;
import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.AppInstallLogContext;
+import io.entgra.device.mgt.core.notification.logger.impl.EntgraAppInstallLoggerImpl;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethodBase;
@@ -111,8 +114,8 @@ import java.util.stream.Collectors;
* This is the default implementation for the Subscription Manager.
*/
public class SubscriptionManagerImpl implements SubscriptionManager {
-
- private static final Log log = LogFactory.getLog(SubscriptionManagerImpl.class);
+ AppInstallLogContext.Builder appInstallLogContextBuilder = new AppInstallLogContext.Builder();
+ private static final EntgraLogger log = new EntgraAppInstallLoggerImpl(SubscriptionManagerImpl.class);
private SubscriptionDAO subscriptionDAO;
private ApplicationDAO applicationDAO;
private LifecycleStateManager lifecycleStateManager;
@@ -644,7 +647,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
Properties properties,
boolean isOperationReExecutingDisabled)
throws ApplicationManagementException {
-
+ String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain());
//Get app subscribing info of each device
SubscribingDeviceIdHolder subscribingDeviceIdHolder = getSubscribingDeviceIdHolder(devices,
applicationDTO.getApplicationReleaseDTOs().get(0).getId());
@@ -694,10 +699,16 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
Activity activity = addAppOperationOnDevices(applicationDTO, new ArrayList<>(entry.getValue()),
entry.getKey(), action, properties);
activityList.add(activity);
+ for (DeviceIdentifier identifier : deviceIdentifiers) {
+ log.info(String.format("Web app %s triggered", action), appInstallLogContextBuilder.setAppId(String.valueOf(applicationDTO.getId())).setAppName(applicationDTO.getName()).setAppType(applicationDTO.getType()).setSubType(subType).setTenantId(tenantId).setTenantDomain(tenantDomain).setDevice(String.valueOf(identifier)).setUserName(username).setAction(action).build());
+ }
}
} else {
Activity activity = addAppOperationOnDevices(applicationDTO, deviceIdentifiers, deviceType, action, properties);
activityList.add(activity);
+ for (DeviceIdentifier identifier : deviceIdentifiers) {
+ log.info(String.format("App %s triggered", action), appInstallLogContextBuilder.setAppId(String.valueOf(applicationDTO.getId())).setAppName(applicationDTO.getName()).setAppType(applicationDTO.getType()).setSubType(subType).setTenantId(tenantId).setTenantDomain(tenantDomain).setDevice(String.valueOf(identifier)).setUserName(username).setAction(action).build());
+ }
}
ApplicationInstallResponse applicationInstallResponse = new ApplicationInstallResponse();
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
index 7373e52e5f..51b93d5fdd 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
@@ -19,9 +19,11 @@
package io.entgra.device.mgt.core.device.mgt.core.operation.mgt;
import com.google.gson.Gson;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.DeviceConnectivityLogContext;
+import io.entgra.device.mgt.core.notification.logger.impl.EntgraDeviceConnectivityLoggerImpl;
+import io.entgra.device.mgt.core.notification.logger.impl.EntgraPolicyLoggerImpl;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest;
@@ -91,7 +93,8 @@ import java.util.concurrent.ThreadPoolExecutor;
*/
public class OperationManagerImpl implements OperationManager {
- private static final Log log = LogFactory.getLog(OperationManagerImpl.class);
+ DeviceConnectivityLogContext.Builder deviceConnectivityLogContextBuilder = new DeviceConnectivityLogContext.Builder();
+ private static final EntgraLogger log = new EntgraDeviceConnectivityLoggerImpl(OperationManagerImpl.class);
private static final int CACHE_VALIDITY_PERIOD = 5 * 60 * 1000;
private static final String NOTIFIER_TYPE_LOCAL = "LOCAL";
private static final String SYSTEM = "system";
@@ -174,6 +177,8 @@ public class OperationManagerImpl implements OperationManager {
}
}
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
DeviceIDHolder deviceValidationResult = DeviceManagerUtil.validateDeviceIdentifiers(deviceIds);
List validDeviceIds = deviceValidationResult.getValidDeviceIDList();
if (!validDeviceIds.isEmpty()) {
@@ -250,6 +255,10 @@ public class OperationManagerImpl implements OperationManager {
activity.setActivityStatus(
this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult));
}
+ for (DeviceIdentifier deviceId : authorizedDeviceIds) {
+ device = getDevice(deviceId);
+ log.info("Operation added", deviceConnectivityLogContextBuilder.setDeviceId(String.valueOf(device.getId())).setDeviceType(deviceType).setActionTag("ADD_OPERATION").setTenantDomain(tenantDomain).setTenantId(tenantId).setUserName(initiatedBy).setOperationCode(operationCode).build());
+ }
return activity;
} catch (OperationManagementDAOException e) {
OperationManagementDAOFactory.rollbackTransaction();
@@ -696,7 +705,9 @@ public class OperationManagerImpl implements OperationManager {
if (log.isDebugEnabled()) {
log.debug("Device identifier id:[" + deviceId.getId() + "] type:[" + deviceId.getType() + "]");
}
-
+ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
+ String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for the given device Identifier:" +
@@ -709,16 +720,18 @@ public class OperationManagerImpl implements OperationManager {
case INACTIVE:
case UNREACHABLE:
this.setEnrolmentStatus(enrolmentId, EnrolmentInfo.Status.ACTIVE);
- int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceCacheManagerImpl.getInstance().removeDeviceFromCache(deviceId, tenantId);
break;
}
-
+ log.info("Device Connected", deviceConnectivityLogContextBuilder.setDeviceId(deviceId.getId()).setDeviceType(deviceId.getType()).setActionTag("PENDING_OPERATION").setTenantDomain(tenantDomain).setTenantId(String.valueOf(tenantId)).setUserName(userName).build());
return getOperations(deviceId, Operation.Status.PENDING, enrolmentId);
}
@Override
public List extends Operation> getPendingOperations(Device device) throws OperationManagementException {
+ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
+ String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for the given device Identifier:" +
@@ -736,10 +749,10 @@ public class OperationManagerImpl implements OperationManager {
this.setEnrolmentStatus(enrolmentId, EnrolmentInfo.Status.ACTIVE);
enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
device.setEnrolmentInfo(enrolmentInfo);
- int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceCacheManagerImpl.getInstance().addDeviceToCache(deviceIdentifier, device, tenantId);
break;
}
+ log.info("Device Connected", deviceConnectivityLogContextBuilder.setDeviceId(device.getDeviceIdentifier()).setDeviceType(device.getType()).setActionTag("PENDING_OPERATION").setTenantDomain(tenantDomain).setTenantId(String.valueOf(tenantId)).setUserName(userName).build());
return getOperations(deviceIdentifier, Operation.Status.PENDING, enrolmentId);
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
index f9c5ec4f7c..8dcaf1ebca 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
@@ -20,10 +20,11 @@ package io.entgra.device.mgt.core.device.mgt.core.service;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.DeviceEnrolmentLogContext;
+import io.entgra.device.mgt.core.notification.logger.impl.EntgraDeviceEnrolmentLoggerImpl;
import org.apache.commons.collections.map.SingletonMap;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
@@ -172,7 +173,9 @@ import java.util.stream.Collectors;
public class DeviceManagementProviderServiceImpl implements DeviceManagementProviderService,
PluginInitializationListener {
- private static final Log log = LogFactory.getLog(DeviceManagementProviderServiceImpl.class);
+ DeviceEnrolmentLogContext.Builder deviceEnrolmentLogContextBuilder = new DeviceEnrolmentLogContext.Builder();
+
+ private static final EntgraLogger log = new EntgraDeviceEnrolmentLoggerImpl(DeviceManagementProviderServiceImpl.class);
private static final String OPERATION_RESPONSE_EVENT_STREAM_DEFINITION = "org.wso2.iot.OperationResponseStream";
private final DeviceManagementPluginRepository pluginRepository;
@@ -260,6 +263,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
return false;
}
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
+ String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
EnrollmentConfiguration enrollmentConfiguration = DeviceManagerUtil.getEnrollmentConfigurationEntry();
String deviceSerialNumber = null;
if (enrollmentConfiguration != null) {
@@ -346,6 +351,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
device.getType() + " upon the user '" + device.getEnrolmentInfo().getOwner() +
"'");
}
+ log.info("Device enrolled successfully", deviceEnrolmentLogContextBuilder.setDeviceId(String.valueOf(existingDevice.getId())).setDeviceType(String.valueOf(existingDevice.getType())).setOwner(newEnrolmentInfo.getOwner()).setOwnership(String.valueOf(newEnrolmentInfo.getOwnership())).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).setUserName(userName).build());
status = true;
} else {
log.warn("Unable to update device enrollment for device : " + device.getDeviceIdentifier() +
@@ -382,6 +388,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
device.setEnrolmentInfo(enrollment);
DeviceManagementDAOFactory.commitTransaction();
+ log.info("Device enrolled successfully", deviceEnrolmentLogContextBuilder.setDeviceId(String.valueOf(device.getId())).setDeviceType(String.valueOf(device.getType())).setOwner(enrollment.getOwner()).setOwnership(String.valueOf(enrollment.getOwnership())).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).setUserName(userName).build());
} else {
DeviceManagementDAOFactory.rollbackTransaction();
throw new DeviceManagementException("No device type registered with name - " + device.getType()
@@ -570,7 +577,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
int tenantId = this.getTenantId();
-
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
+ String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
Device device = this.getDevice(deviceId, false);
if (device == null) {
if (log.isDebugEnabled()) {
@@ -604,7 +612,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
}
//procees to dis-enroll a device from traccar ends
-
+ log.info("Device disenrolled successfully", deviceEnrolmentLogContextBuilder.setDeviceId(String.valueOf(device.getId())).setDeviceType(String.valueOf(device.getType())).setOwner(device.getEnrolmentInfo().getOwner()).setOwnership(String.valueOf(device.getEnrolmentInfo().getOwnership())).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).setUserName(userName).build());
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
String msg = "Error occurred while dis-enrolling '" + deviceId.getType() +
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/AppInstallLogContext.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/AppInstallLogContext.java
new file mode 100644
index 0000000000..33cffac366
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/AppInstallLogContext.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+
+public class AppInstallLogContext extends LogContext {
+ private final String appId;
+ private final String appName;
+ private final String appType;
+ private final String subType;
+ private final String tenantId;
+ private final String tenantDomain;
+ private final String device;
+ private final String userName;
+ private final String action;
+
+ private AppInstallLogContext(Builder builder) {
+ this.appId = builder.appId;
+ this.appName = builder.appName;
+ this.appType = builder.appType;
+ this.subType = builder.subType;
+ this.tenantId = builder.tenantId;
+ this.tenantDomain = builder.tenantDomain;
+ this.device = builder.device;
+ this.userName = builder.userName;
+ this.action = builder.action;
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public String getAppType() {
+ return appType;
+ }
+
+ public String getSubType() {
+ return subType;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public String getDevice() {
+ return device;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public static class Builder {
+ private String appId;
+ private String appName;
+ private String appType;
+ private String subType;
+ private String tenantId;
+ private String tenantDomain;
+ private String device;
+ private String userName;
+ private String action;
+
+ public Builder() {
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public Builder setUserName(String userName) {
+ this.userName = userName;
+ return this;
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public Builder setAppId(String appId) {
+ this.appId = appId;
+ return this;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public Builder setAppName(String appName) {
+ this.appName = appName;
+ return this;
+ }
+
+ public String getAppType() {
+ return appType;
+ }
+
+ public Builder setAppType(String appType) {
+ this.appType = appType;
+ return this;
+ }
+
+ public String getSubType() {
+ return subType;
+ }
+
+ public Builder setSubType(String subType) {
+ this.subType = subType;
+ return this;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public Builder setTenantDomain(String tenantDomain) {
+ this.tenantDomain = tenantDomain;
+ return this;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public Builder setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ public String getDevice() {
+ return device;
+ }
+
+ public Builder setDevice(String device) {
+ this.device = device;
+ return this;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public Builder setAction(String action) {
+ this.action = action;
+ return this;
+ }
+
+ public AppInstallLogContext build() {
+ return new AppInstallLogContext(this);
+ }
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceConnectivityLogContext.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceConnectivityLogContext.java
new file mode 100644
index 0000000000..d110e84a43
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceConnectivityLogContext.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+
+public class DeviceConnectivityLogContext extends LogContext {
+
+ private final String deviceId;
+ private final String deviceType;
+ private final String actionTag;
+ private final String operationCode;
+ private final String tenantId;
+ private final String tenantDomain;
+ private final String userName;
+
+ private DeviceConnectivityLogContext(Builder builder) {
+ this.deviceId = builder.deviceId;
+ this.deviceType = builder.deviceType;
+ this.actionTag = builder.actionTag;
+ this.operationCode = builder.operationCode;
+ this.tenantId = builder.tenantId;
+ this.tenantDomain = builder.tenantDomain;
+ this.userName = builder.userName;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public String getDeviceType() {
+ return deviceType;
+ }
+
+ public String getActionTag() {
+ return actionTag;
+ }
+
+ public String getOperationCode() {
+ return operationCode;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public static class Builder {
+ private String deviceId;
+ private String deviceType;
+ private String operationCode;
+ private String actionTag;
+ private String tenantId;
+ private String tenantDomain;
+ private String userName;
+
+ public Builder() {
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public Builder setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ return this;
+ }
+
+ public String getDeviceType() {
+ return deviceType;
+ }
+
+ public Builder setDeviceType(String deviceType) {
+ this.deviceType = deviceType;
+ return this;
+ }
+
+ public String getOperationCode() {
+ return operationCode;
+ }
+
+ public Builder setOperationCode(String operationCode) {
+ this.operationCode = operationCode;
+ return this;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public Builder setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public Builder setTenantDomain(String tenantDomain) {
+ this.tenantDomain = tenantDomain;
+ return this;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public Builder setUserName(String userName) {
+ this.userName = userName;
+ return this;
+ }
+
+ public String getActionTag() {
+ return actionTag;
+ }
+
+ public Builder setActionTag(String actionTag) {
+ this.actionTag = actionTag;
+ return this;
+ }
+
+ public DeviceConnectivityLogContext build() {
+ return new DeviceConnectivityLogContext(this);
+ }
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceEnrolmentLogContext.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceEnrolmentLogContext.java
new file mode 100644
index 0000000000..b355b29671
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/DeviceEnrolmentLogContext.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+
+public class DeviceEnrolmentLogContext extends LogContext {
+ private final String deviceId;
+ private final String deviceType;
+ private final String owner;
+ private final String ownership;
+ private final String tenantID;
+ private final String tenantDomain;
+ private final String userName;
+
+ private DeviceEnrolmentLogContext(Builder builder) {
+ this.deviceId = builder.deviceId;
+ this.deviceType = builder.deviceType;
+ this.owner = builder.owner;
+ this.ownership = builder.ownership;
+ this.tenantID = builder.tenantID;
+ this.tenantDomain = builder.tenantDomain;
+ this.userName = builder.userName;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public String getDeviceType() {
+ return deviceType;
+ }
+
+ public String getOwnership() {
+ return ownership;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+ public static class Builder {
+ private String deviceId;
+ private String deviceType;
+ private String owner;
+ private String ownership;
+ private String tenantID;
+ private String tenantDomain;
+ private String userName;
+
+ public Builder() {
+ }
+
+ public String getDeviceType() {
+ return deviceType;
+ }
+
+ public Builder setDeviceType(String deviceType) {
+ this.deviceType = deviceType;
+ return this;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public Builder setTenantID(String tenantID) {
+ this.tenantID = tenantID;
+ return this;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public Builder setTenantDomain(String tenantDomain) {
+ this.tenantDomain = tenantDomain;
+ return this;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public Builder setUserName(String userName) {
+ this.userName = userName;
+ return this;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public Builder setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ return this;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public Builder setOwner(String owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ public String getOwnership() {
+ return ownership;
+ }
+
+ public Builder setOwnership(String ownership) {
+ this.ownership = ownership;
+ return this;
+ }
+
+ public DeviceEnrolmentLogContext build() {
+ return new DeviceEnrolmentLogContext(this);
+ }
+
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/PolicyLogContext.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/PolicyLogContext.java
new file mode 100644
index 0000000000..9dbd10a059
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/PolicyLogContext.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+
+public class PolicyLogContext extends LogContext {
+ private final String policyName;
+ private final String payload;
+ private final String actionTag;
+ private final String userName;
+ private final String tenantID;
+ private final String tenantDomain;
+
+ private PolicyLogContext(Builder builder) {
+ this.policyName = builder.policyName;
+ this.payload = builder.payload;
+ this.actionTag = builder.actionTag;
+ this.userName = builder.userName;
+ this.tenantID = builder.tenantID;
+ this.tenantDomain = builder.tenantDomain;
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public String getActionTag() {
+ return actionTag;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public static class Builder {
+ private String policyName;
+ private String payload;
+ private String actionTag;
+ private String userName;
+ private String tenantID;
+ private String tenantDomain;
+
+ public Builder() {
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public Builder setPolicyName(String policyName) {
+ this.policyName = policyName;
+ return this;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public Builder setPayload(String payload) {
+ this.payload = payload;
+ return this;
+ }
+
+ public String getActionTag() {
+ return actionTag;
+ }
+
+ public Builder setActionTag(String actionTag) {
+ this.actionTag = actionTag;
+ return this;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public Builder setUserName(String userName) {
+ this.userName = userName;
+ return this;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public Builder setTenantID(String tenantID) {
+ this.tenantID = tenantID;
+ return this;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public Builder setTenantDomain(String tenantDomain) {
+ this.tenantDomain = tenantDomain;
+ return this;
+ }
+
+ public PolicyLogContext build() {
+ return new PolicyLogContext(this);
+ }
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraAppInstallLoggerImpl.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraAppInstallLoggerImpl.java
new file mode 100644
index 0000000000..81f071c2af
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraAppInstallLoggerImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger.impl;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.AppInstallLogContext;
+import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.MDC;
+
+public class EntgraAppInstallLoggerImpl implements EntgraLogger {
+
+ private static Log log = null;
+
+ public EntgraAppInstallLoggerImpl(Class> clazz) {
+ log = LogFactory.getLog(clazz);
+ }
+
+ public void info(String message) {
+ log.info(message);
+ }
+
+ public void info(String message, Throwable t) {
+ log.info(message, t);
+ }
+
+ @Override
+ public void info(Object o) {
+ log.info(o);
+ }
+
+ @Override
+ public void info(Object o, Throwable throwable) {
+ log.info(o, throwable);
+ }
+
+ @Override
+ public void info(String message, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.info(message);
+ }
+
+ @Override
+ public void info(Object object, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.info(object);
+ }
+
+ @Override
+ public void info(Object object, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.info(object, t);
+ }
+
+ public void debug(String message) {
+ log.debug(message);
+ }
+
+ public void debug(String message, Throwable t) {
+ log.debug(message, t);
+ }
+
+ @Override
+ public void debug(Object o) {
+ log.debug(o);
+ }
+
+ @Override
+ public void debug(Object o, Throwable throwable) {
+ log.debug(o, throwable);
+ }
+
+ @Override
+ public void debug(String message, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.debug(message);
+ }
+
+ @Override
+ public void debug(Object object, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.debug(object);
+ }
+
+ @Override
+ public void debug(Object object, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.debug(object, t);
+ }
+
+ public void error(String message) {
+ log.error(message);
+ }
+
+ public void error(String message, Throwable t) {
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object o) {
+ log.error(o);
+ }
+
+ @Override
+ public void error(Object o, Throwable throwable) {
+ log.error(o, throwable);
+ }
+
+ @Override
+ public void error(String message, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.error(message);
+ }
+
+ @Override
+ public void error(String message, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object object, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.error(object);
+ }
+
+ @Override
+ public void error(Object object, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.error(object, t);
+ }
+
+ public void warn(String message) {
+ log.warn(message);
+ }
+
+ public void warn(String message, Throwable t) {
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object o) {
+ log.warn(o);
+ }
+
+ @Override
+ public void warn(Object o, Throwable throwable) {
+ log.warn(o, throwable);
+ }
+
+ @Override
+ public void warn(String message, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.warn(message);
+ }
+
+ @Override
+ public void warn(String message, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object object, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.warn(object);
+ }
+
+ @Override
+ public void warn(Object object, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.warn(object, t);
+ }
+
+ public void trace(String message) {
+ log.trace(message);
+ }
+
+ public void trace(String message, Throwable t) {
+ log.trace(message, t);
+ }
+
+ @Override
+ public void trace(Object o) {
+ log.trace(o);
+ }
+
+ @Override
+ public void trace(Object o, Throwable throwable) {
+ log.trace(o, throwable);
+ }
+
+ @Override
+ public void trace(String message, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.trace(message);
+ }
+
+ @Override
+ public void trace(Object object, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.trace(object);
+ }
+
+ @Override
+ public void trace(Object object, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.trace(object, t);
+ }
+
+ public void fatal(String message) {
+ log.fatal(message);
+ }
+
+ public void fatal(String message, Throwable t) {
+ log.fatal(message, t);
+ }
+
+ @Override
+ public void fatal(Object o) {
+ log.fatal(0);
+ }
+
+ @Override
+ public void fatal(Object o, Throwable throwable) {
+ log.fatal(0, throwable);
+ }
+
+ @Override
+ public void fatal(String message, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.fatal(message);
+ }
+
+ @Override
+ public void fatal(Object object, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.fatal(object);
+ }
+
+ @Override
+ public void fatal(Object object, Throwable t, LogContext logContext) {
+ AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
+ MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
+ log.fatal(object, t);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return log.isErrorEnabled();
+ }
+
+ @Override
+ public boolean isFatalEnabled() {
+ return log.isFatalEnabled();
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return log.isWarnEnabled();
+ }
+
+ @Override
+ public void clearLogContext() {
+ MDC.clear();
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceConnectivityLoggerImpl.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceConnectivityLoggerImpl.java
new file mode 100644
index 0000000000..aaa62bf488
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceConnectivityLoggerImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger.impl;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.DeviceConnectivityLogContext;
+import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.MDC;
+
+public class EntgraDeviceConnectivityLoggerImpl implements EntgraLogger {
+
+ private static Log log = null;
+
+ public EntgraDeviceConnectivityLoggerImpl(Class> clazz) {
+ log = LogFactory.getLog(clazz);
+ }
+
+ public void info(String message) {
+ log.info(message);
+ }
+
+ public void info(String message, Throwable t) {
+ log.info(message, t);
+ }
+
+ @Override
+ public void info(Object o) {
+ log.info(o);
+ }
+
+ @Override
+ public void info(Object o, Throwable throwable) {
+ log.info(o, throwable);
+ }
+
+ @Override
+ public void info(String message, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.info(message);
+ }
+
+ @Override
+ public void info(Object object, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.info(object);
+ }
+
+ @Override
+ public void info(Object object, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.info(object, t);
+ }
+
+ public void debug(String message) {
+ log.debug(message);
+ }
+
+ public void debug(String message, Throwable t) {
+ log.debug(message, t);
+ }
+
+ @Override
+ public void debug(Object o) {
+ log.debug(o);
+ }
+
+ @Override
+ public void debug(Object o, Throwable throwable) {
+ log.debug(o, throwable);
+ }
+
+ @Override
+ public void debug(String message, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.debug(message);
+ }
+
+ @Override
+ public void debug(Object object, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.debug(object);
+ }
+
+ @Override
+ public void debug(Object object, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.debug(object, t);
+ }
+
+ public void error(String message) {
+ log.error(message);
+ }
+
+ public void error(String message, Throwable t) {
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object o) {
+ log.error(o);
+ }
+
+ @Override
+ public void error(Object o, Throwable throwable) {
+ log.error(o, throwable);
+ }
+
+ @Override
+ public void error(String message, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.error(message);
+ }
+
+ @Override
+ public void error(String message, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object object, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.error(object);
+ }
+
+ @Override
+ public void error(Object object, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.error(object, t);
+ }
+
+ public void warn(String message) {
+ log.warn(message);
+ }
+
+ public void warn(String message, Throwable t) {
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object o) {
+ log.warn(o);
+ }
+
+ @Override
+ public void warn(Object o, Throwable throwable) {
+ log.warn(o, throwable);
+ }
+
+ @Override
+ public void warn(String message, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.warn(message);
+ }
+
+ @Override
+ public void warn(String message, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object object, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.warn(object);
+ }
+
+ @Override
+ public void warn(Object object, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.warn(object, t);
+ }
+
+ public void trace(String message) {
+ log.trace(message);
+ }
+
+ public void trace(String message, Throwable t) {
+ log.trace(message, t);
+ }
+
+ @Override
+ public void trace(Object o) {
+ log.trace(o);
+ }
+
+ @Override
+ public void trace(Object o, Throwable throwable) {
+ log.trace(o, throwable);
+ }
+
+ @Override
+ public void trace(String message, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.trace(message);
+ }
+
+ @Override
+ public void trace(Object object, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.trace(object);
+ }
+
+ @Override
+ public void trace(Object object, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.trace(object, t);
+ }
+
+ public void fatal(String message) {
+ log.fatal(message);
+ }
+
+ public void fatal(String message, Throwable t) {
+ log.fatal(message, t);
+ }
+
+ @Override
+ public void fatal(Object o) {
+ log.fatal(0);
+ }
+
+ @Override
+ public void fatal(Object o, Throwable throwable) {
+ log.fatal(0, throwable);
+ }
+
+ @Override
+ public void fatal(String message, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.fatal(message);
+ }
+
+ @Override
+ public void fatal(Object object, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.fatal(object);
+ }
+
+ @Override
+ public void fatal(Object object, Throwable t, LogContext logContext) {
+ DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
+ MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
+ log.fatal(object, t);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return log.isErrorEnabled();
+ }
+
+ @Override
+ public boolean isFatalEnabled() {
+ return log.isFatalEnabled();
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return log.isWarnEnabled();
+ }
+
+ @Override
+ public void clearLogContext() {
+ MDC.clear();
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceEnrolmentLoggerImpl.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceEnrolmentLoggerImpl.java
new file mode 100644
index 0000000000..db0b7dd265
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceEnrolmentLoggerImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger.impl;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.DeviceEnrolmentLogContext;
+import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.MDC;
+
+public class EntgraDeviceEnrolmentLoggerImpl implements EntgraLogger {
+
+ private static Log log = null;
+
+ public EntgraDeviceEnrolmentLoggerImpl(Class> clazz) {
+ log = LogFactory.getLog(clazz);
+ }
+
+ public void info(String message) {
+ log.info(message);
+ }
+
+ public void info(String message, Throwable t) {
+ log.info(message, t);
+ }
+
+ @Override
+ public void info(Object o) {
+ log.info(o);
+ }
+
+ @Override
+ public void info(Object o, Throwable throwable) {
+ log.info(o, throwable);
+ }
+
+ @Override
+ public void info(String message, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.info(message);
+ }
+
+ @Override
+ public void info(Object object, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.info(object);
+ }
+
+ @Override
+ public void info(Object object, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.info(object, t);
+ }
+
+ public void debug(String message) {
+ log.debug(message);
+ }
+
+ public void debug(String message, Throwable t) {
+ log.debug(message, t);
+ }
+
+ @Override
+ public void debug(Object o) {
+ log.debug(o);
+ }
+
+ @Override
+ public void debug(Object o, Throwable throwable) {
+ log.debug(o, throwable);
+ }
+
+ @Override
+ public void debug(String message, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.debug(message);
+ }
+
+ @Override
+ public void debug(Object object, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.debug(object);
+ }
+
+ @Override
+ public void debug(Object object, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.debug(object, t);
+ }
+
+ public void error(String message) {
+ log.error(message);
+ }
+
+ public void error(String message, Throwable t) {
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object o) {
+ log.error(o);
+ }
+
+ @Override
+ public void error(Object o, Throwable throwable) {
+ log.error(o, throwable);
+ }
+
+ @Override
+ public void error(String message, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.error(message);
+ }
+
+ @Override
+ public void error(String message, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object object, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.error(object);
+ }
+
+ @Override
+ public void error(Object object, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.error(object, t);
+ }
+
+ public void warn(String message) {
+ log.warn(message);
+ }
+
+ public void warn(String message, Throwable t) {
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object o) {
+ log.warn(o);
+ }
+
+ @Override
+ public void warn(Object o, Throwable throwable) {
+ log.warn(o, throwable);
+ }
+
+ @Override
+ public void warn(String message, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.warn(message);
+ }
+
+ @Override
+ public void warn(String message, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object object, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.warn(object);
+ }
+
+ @Override
+ public void warn(Object object, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.warn(object, t);
+ }
+
+ public void trace(String message) {
+ log.trace(message);
+ }
+
+ public void trace(String message, Throwable t) {
+ log.trace(message, t);
+ }
+
+ @Override
+ public void trace(Object o) {
+ log.trace(o);
+ }
+
+ @Override
+ public void trace(Object o, Throwable throwable) {
+ log.trace(o, throwable);
+ }
+
+ @Override
+ public void trace(String message, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.trace(message);
+ }
+
+ @Override
+ public void trace(Object object, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.trace(object);
+ }
+
+ @Override
+ public void trace(Object object, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.trace(object, t);
+ }
+
+ public void fatal(String message) {
+ log.fatal(message);
+ }
+
+ public void fatal(String message, Throwable t) {
+ log.fatal(message, t);
+ }
+
+ @Override
+ public void fatal(Object o) {
+ log.fatal(0);
+ }
+
+ @Override
+ public void fatal(Object o, Throwable throwable) {
+ log.fatal(0, throwable);
+ }
+
+ @Override
+ public void fatal(String message, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.fatal(message);
+ }
+
+ @Override
+ public void fatal(Object object, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.fatal(object);
+ }
+
+ @Override
+ public void fatal(Object object, Throwable t, LogContext logContext) {
+ DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
+ MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
+ log.fatal(object, t);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return log.isErrorEnabled();
+ }
+
+ @Override
+ public boolean isFatalEnabled() {
+ return log.isFatalEnabled();
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return log.isWarnEnabled();
+ }
+
+ @Override
+ public void clearLogContext() {
+ MDC.clear();
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceLoggerImpl.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceLoggerImpl.java
index ae10ae87c2..a51987463f 100644
--- a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceLoggerImpl.java
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraDeviceLoggerImpl.java
@@ -17,7 +17,6 @@
*/
package io.entgra.device.mgt.core.notification.logger.impl;
-
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
import io.entgra.device.mgt.core.notification.logger.DeviceLogContext;
@@ -26,7 +25,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.MDC;
-
public class EntgraDeviceLoggerImpl implements EntgraLogger {
private static Log log = null;
@@ -74,7 +72,6 @@ public class EntgraDeviceLoggerImpl implements EntgraLogger {
log.info(object, t);
}
-
public void debug(String message) {
log.debug(message);
}
@@ -114,7 +111,6 @@ public class EntgraDeviceLoggerImpl implements EntgraLogger {
log.debug(object, t);
}
-
public void error(String message) {
log.error(message);
}
@@ -161,7 +157,6 @@ public class EntgraDeviceLoggerImpl implements EntgraLogger {
log.error(object, t);
}
-
public void warn(String message) {
log.warn(message);
}
@@ -208,7 +203,6 @@ public class EntgraDeviceLoggerImpl implements EntgraLogger {
log.warn(object, t);
}
-
public void trace(String message) {
log.trace(message);
}
@@ -248,7 +242,6 @@ public class EntgraDeviceLoggerImpl implements EntgraLogger {
log.trace(object, t);
}
-
public void fatal(String message) {
log.fatal(message);
}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraPolicyLoggerImpl.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraPolicyLoggerImpl.java
new file mode 100644
index 0000000000..218252f260
--- /dev/null
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraPolicyLoggerImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.notification.logger.impl;
+
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.PolicyLogContext;
+import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.MDC;
+
+public class EntgraPolicyLoggerImpl implements EntgraLogger {
+
+ private static Log log = null;
+
+ public EntgraPolicyLoggerImpl(Class> clazz) {
+ log = LogFactory.getLog(clazz);
+ }
+
+ public void info(String message) {
+ log.info(message);
+ }
+
+ public void info(String message, Throwable t) {
+ log.info(message, t);
+ }
+
+ @Override
+ public void info(Object o) {
+ log.info(o);
+ }
+
+ @Override
+ public void info(Object o, Throwable throwable) {
+ log.info(o, throwable);
+ }
+
+ @Override
+ public void info(String message, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.info(message);
+ }
+
+ @Override
+ public void info(Object object, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.info(object);
+ }
+
+ @Override
+ public void info(Object object, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.info(object, t);
+ }
+
+ public void debug(String message) {
+ log.debug(message);
+ }
+
+ public void debug(String message, Throwable t) {
+ log.debug(message, t);
+ }
+
+ @Override
+ public void debug(Object o) {
+ log.debug(o);
+ }
+
+ @Override
+ public void debug(Object o, Throwable throwable) {
+ log.debug(o, throwable);
+ }
+
+ @Override
+ public void debug(String message, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.debug(message);
+ }
+
+ @Override
+ public void debug(Object object, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.debug(object);
+ }
+
+ @Override
+ public void debug(Object object, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.debug(object, t);
+ }
+
+ public void error(String message) {
+ log.error(message);
+ }
+
+ public void error(String message, Throwable t) {
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object o) {
+ log.error(o);
+ }
+
+ @Override
+ public void error(Object o, Throwable throwable) {
+ log.error(o, throwable);
+ }
+
+ @Override
+ public void error(String message, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.error(message);
+ }
+
+ @Override
+ public void error(String message, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.error(message, t);
+ }
+
+ @Override
+ public void error(Object object, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.error(object);
+ }
+
+ @Override
+ public void error(Object object, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.error(object, t);
+ }
+
+ public void warn(String message) {
+ log.warn(message);
+ }
+
+ public void warn(String message, Throwable t) {
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object o) {
+ log.warn(o);
+ }
+
+ @Override
+ public void warn(Object o, Throwable throwable) {
+ log.warn(o, throwable);
+ }
+
+ @Override
+ public void warn(String message, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.warn(message);
+ }
+
+ @Override
+ public void warn(String message, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.warn(message, t);
+ }
+
+ @Override
+ public void warn(Object object, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.warn(object);
+ }
+
+ @Override
+ public void warn(Object object, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.warn(object, t);
+ }
+
+ public void trace(String message) {
+ log.trace(message);
+ }
+
+ public void trace(String message, Throwable t) {
+ log.trace(message, t);
+ }
+
+ @Override
+ public void trace(Object o) {
+ log.trace(o);
+ }
+
+ @Override
+ public void trace(Object o, Throwable throwable) {
+ log.trace(o, throwable);
+ }
+
+ @Override
+ public void trace(String message, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.trace(message);
+ }
+
+ @Override
+ public void trace(Object object, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.trace(object);
+ }
+
+ @Override
+ public void trace(Object object, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.trace(object, t);
+ }
+
+ public void fatal(String message) {
+ log.fatal(message);
+ }
+
+ public void fatal(String message, Throwable t) {
+ log.fatal(message, t);
+ }
+
+ @Override
+ public void fatal(Object o) {
+ log.fatal(0);
+ }
+
+ @Override
+ public void fatal(Object o, Throwable throwable) {
+ log.fatal(0, throwable);
+ }
+
+ @Override
+ public void fatal(String message, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.fatal(message);
+ }
+
+ @Override
+ public void fatal(Object object, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.fatal(object);
+ }
+
+ @Override
+ public void fatal(Object object, Throwable t, LogContext logContext) {
+ PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
+ MDCContextUtil.populatePolicyMDCContext(policyLogContext);
+ log.fatal(object, t);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return log.isErrorEnabled();
+ }
+
+ @Override
+ public boolean isFatalEnabled() {
+ return log.isFatalEnabled();
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return log.isWarnEnabled();
+ }
+
+ @Override
+ public void clearLogContext() {
+ MDC.clear();
+ }
+}
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraUserLoggerImpl.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraUserLoggerImpl.java
index 6a082b013d..fa482605f6 100644
--- a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraUserLoggerImpl.java
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/impl/EntgraUserLoggerImpl.java
@@ -17,7 +17,6 @@
*/
package io.entgra.device.mgt.core.notification.logger.impl;
-
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
import io.entgra.device.mgt.core.notification.logger.UserLogContext;
@@ -26,7 +25,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.MDC;
-
public class EntgraUserLoggerImpl implements EntgraLogger {
private static Log log = null;
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java
index 09f903188a..dc046e8eeb 100644
--- a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java
@@ -17,8 +17,7 @@
*/
package io.entgra.device.mgt.core.notification.logger.util;
-import io.entgra.device.mgt.core.notification.logger.DeviceLogContext;
-import io.entgra.device.mgt.core.notification.logger.UserLogContext;
+import io.entgra.device.mgt.core.notification.logger.*;
import org.apache.log4j.MDC;
public final class MDCContextUtil {
@@ -62,6 +61,105 @@ public final class MDCContextUtil {
}
}
+
+ public static void populatePolicyMDCContext(final PolicyLogContext mdcContext) {
+ if (mdcContext.getPolicyName() != null) {
+ MDC.put("PolicyName", mdcContext.getPolicyName());
+ }
+ if (mdcContext.getPayload() != null) {
+ MDC.put("Payload", mdcContext.getPayload());
+ }
+ if (mdcContext.getActionTag() != null) {
+ MDC.put("ActionTag", mdcContext.getActionTag());
+ }
+ if (mdcContext.getUserName() != null) {
+ MDC.put("UserName", mdcContext.getUserName());
+ }
+ if (mdcContext.getTenantDomain() != null) {
+ MDC.put("TenantDomain", mdcContext.getTenantDomain());
+ }
+ if (mdcContext.getTenantID() != null) {
+ MDC.put("TenantId", mdcContext.getTenantID());
+ }
+ }
+
+ public static void populateAppInstallMDCContext(final AppInstallLogContext mdcContext) {
+ if (mdcContext.getAppId() != null) {
+ MDC.put("AppId", mdcContext.getAppId());
+ }
+ if (mdcContext.getAppName() != null) {
+ MDC.put("AppName", mdcContext.getAppName());
+ }
+ if (mdcContext.getAppType() != null) {
+ MDC.put("AppType", mdcContext.getAppType());
+ }
+ if (mdcContext.getSubType() != null) {
+ MDC.put("SubType", mdcContext.getSubType());
+ }
+ if (mdcContext.getDevice() != null) {
+ MDC.put("Device", mdcContext.getDevice());
+ }
+ if (mdcContext.getTenantDomain() != null) {
+ MDC.put("TenantDomain", mdcContext.getTenantDomain());
+ }
+ if (mdcContext.getTenantId() != null) {
+ MDC.put("TenantId", mdcContext.getTenantId());
+ }
+ if (mdcContext.getUserName() != null) {
+ MDC.put("UserName", mdcContext.getUserName());
+ }
+ if (mdcContext.getAction() != null) {
+ MDC.put("Action", mdcContext.getAction());
+ }
+ }
+
+ public static void populateDeviceConnectivityMDCContext(final DeviceConnectivityLogContext mdcContext) {
+ if (mdcContext.getDeviceId() != null) {
+ MDC.put("DeviceId", mdcContext.getDeviceId());
+ }
+ if (mdcContext.getDeviceType() != null) {
+ MDC.put("DeviceType", mdcContext.getDeviceType());
+ }
+ if (mdcContext.getOperationCode() != null) {
+ MDC.put("OperationCode", mdcContext.getOperationCode());
+ }
+ if (mdcContext.getTenantDomain() != null) {
+ MDC.put("TenantDomain", mdcContext.getTenantDomain());
+ }
+ if (mdcContext.getTenantId() != null) {
+ MDC.put("TenantId", mdcContext.getTenantId());
+ }
+ if (mdcContext.getUserName() != null) {
+ MDC.put("UserName", mdcContext.getUserName());
+ }
+ if (mdcContext.getActionTag() != null) {
+ MDC.put("ActionTag", mdcContext.getActionTag());
+ }
+ }
+
+ public static void populateDeviceEnrolmentMDCContext(final DeviceEnrolmentLogContext mdcContext) {
+ if (mdcContext.getDeviceId() != null) {
+ MDC.put("DeviceId", mdcContext.getDeviceId());
+ }
+ if (mdcContext.getDeviceType() != null) {
+ MDC.put("DeviceType", mdcContext.getDeviceType());
+ }
+ if (mdcContext.getOwner() != null) {
+ MDC.put("Owner", mdcContext.getOwner());
+ }
+ if (mdcContext.getOwnership() != null) {
+ MDC.put("Ownership", mdcContext.getOwnership());
+ }
+ if (mdcContext.getTenantID() != null) {
+ MDC.put("TenantId", mdcContext.getTenantID());
+ }
+ if (mdcContext.getTenantDomain() != null) {
+ MDC.put("TenantDomain", mdcContext.getTenantDomain());
+ }
+ if (mdcContext.getUserName() != null) {
+ MDC.put("UserName", mdcContext.getUserName());
+ }
+ }
}
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java
index 2521eab3a1..7ead0213c9 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java
@@ -19,6 +19,9 @@
package io.entgra.device.mgt.core.policy.mgt.core.impl;
import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.PolicyLogContext;
+import io.entgra.device.mgt.core.notification.logger.impl.EntgraPolicyLoggerImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
@@ -50,7 +53,8 @@ import java.util.Set;
public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
- private static final Log log = LogFactory.getLog(PolicyAdministratorPointImpl.class);
+ PolicyLogContext.Builder policyLogContextBuilder = new PolicyLogContext.Builder();
+ private static final EntgraLogger log = new EntgraPolicyLoggerImpl(PolicyAdministratorPointImpl.class);
private PolicyManager policyManager;
private ProfileManager profileManager;
@@ -131,6 +135,8 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
try {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
+ String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
TaskService taskService = PolicyManagementDataHolder.getInstance().getTaskService();
if (log.isDebugEnabled()) {
@@ -164,11 +170,13 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
properties, triggerInfo);
taskManager.registerTask(taskInfo);
taskManager.scheduleTask(taskInfo.getName());
+ log.info("Apply changes to device", policyLogContextBuilder.setActionTag("PUBLISH_CHANGES").setUserName(userName).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).build());
} else {
if (!taskManager.isTaskScheduled(taskName)) {
TaskInfo taskInfo = new TaskInfo(taskName, PolicyManagementConstants.DELEGATION_TASK_CLAZZ,
properties, triggerInfo);
taskManager.scheduleTask(taskInfo.getName());
+ log.info("Apply changes to device", policyLogContextBuilder.setActionTag("PUBLISH_CHANGES").setUserName(userName).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).build());
} else {
throw new PolicyManagementException("There is a task already running for policy changes. Please try " +
"to apply " +
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java
index fd5b3b5fdb..9d362bcc9e 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java
@@ -18,10 +18,12 @@
package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl;
+import com.google.gson.Gson;
import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest;
+import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
+import io.entgra.device.mgt.core.notification.logger.PolicyLogContext;
+import io.entgra.device.mgt.core.notification.logger.impl.EntgraPolicyLoggerImpl;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import io.entgra.device.mgt.core.device.mgt.common.Device;
import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier;
import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext;
@@ -61,6 +63,7 @@ import io.entgra.device.mgt.core.policy.mgt.core.mgt.ProfileManager;
import io.entgra.device.mgt.core.policy.mgt.core.mgt.bean.UpdatedPolicyDeviceListBean;
import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants;
import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
import java.sql.SQLException;
import java.sql.Timestamp;
@@ -73,12 +76,13 @@ import java.util.Map;
public class PolicyManagerImpl implements PolicyManager {
+ PolicyLogContext.Builder policyLogContextBuilder = new PolicyLogContext.Builder();
private final PolicyDAO policyDAO;
private final ProfileDAO profileDAO;
private final FeatureDAO featureDAO;
private final ProfileManager profileManager;
private final PolicyConfiguration policyConfiguration;
- private static final Log log = LogFactory.getLog(PolicyManagerImpl.class);
+ private static final EntgraLogger log = new EntgraPolicyLoggerImpl(PolicyManagerImpl.class);
public PolicyManagerImpl() {
this.policyDAO = PolicyManagementDAOFactory.getPolicyDAO();
@@ -90,6 +94,9 @@ public class PolicyManagerImpl implements PolicyManager {
@Override
public Policy addPolicy(Policy policy) throws PolicyManagementException {
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain());
+ String userName = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
try {
PolicyManagementDAOFactory.beginTransaction();
if (policy.getProfile() != null && policy.getProfile().getProfileId() == 0) {
@@ -171,11 +178,16 @@ public class PolicyManagerImpl implements PolicyManager {
} finally {
PolicyManagementDAOFactory.closeConnection();
}
+ String stringPayload = new Gson().toJson(policy);
+ log.info("Policy created", policyLogContextBuilder.setPolicyName(policy.getPolicyName()).setPayload(stringPayload).setActionTag("ADD_POLICY").setUserName(userName).setTenantID(tenantId).setTenantDomain(tenantDomain).build());
return policy;
}
@Override
public Policy updatePolicy(Policy policy) throws PolicyManagementException {
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain());
+ String userName = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
try {
// Previous policy needs to be obtained before beginning the transaction
Policy previousPolicy = this.getPolicy(policy.getId());
@@ -317,6 +329,8 @@ public class PolicyManagerImpl implements PolicyManager {
} finally {
PolicyManagementDAOFactory.closeConnection();
}
+ String stringPayload = new Gson().toJson(policy);
+ log.info("Policy updated", policyLogContextBuilder.setPolicyName(policy.getPolicyName()).setPayload(stringPayload).setActionTag("UPDATE_POLICY").setUserName(userName).setTenantID(tenantId).setTenantDomain(tenantDomain).build());
return policy;
}
@@ -506,6 +520,10 @@ public class PolicyManagerImpl implements PolicyManager {
@Override
public boolean updatePolicyPriorities(List policies) throws PolicyManagementException {
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain());
+ String userName = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
+ String stringPayload = new Gson().toJson(policies);
boolean bool;
try {
List existingPolicies;
@@ -534,18 +552,24 @@ public class PolicyManagerImpl implements PolicyManager {
} finally {
PolicyManagementDAOFactory.closeConnection();
}
+ log.info("Policy priorities updated", policyLogContextBuilder.setPayload(stringPayload).setActionTag("UPDATE_POLICY_PRIORITIES").setUserName(userName).setTenantID(tenantId).setTenantDomain(tenantDomain).build());
return bool;
}
@Override
public boolean deletePolicy(Policy policy) throws PolicyManagementException {
try {
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain());
+ String userName = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
PolicyManagementDAOFactory.beginTransaction();
policyDAO.deleteAllPolicyRelatedConfigs(policy.getId());
policyDAO.deletePolicy(policy.getId());
featureDAO.deleteFeaturesOfProfile(policy.getProfileId());
profileDAO.deleteProfile(policy.getProfileId());
PolicyManagementDAOFactory.commitTransaction();
+ String stringPayload = new Gson().toJson(policy);
+ log.info("Policy deleted", policyLogContextBuilder.setPolicyName(policy.getPolicyName()).setPayload(stringPayload).setActionTag("DELETE_POLICY").setUserName(userName).setTenantID(tenantId).setTenantDomain(tenantDomain).build());
return true;
} catch (PolicyManagerDAOException e) {
PolicyManagementDAOFactory.rollbackTransaction();
@@ -566,6 +590,9 @@ public class PolicyManagerImpl implements PolicyManager {
@Override
public boolean deletePolicy(int policyId) throws PolicyManagementException {
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain());
+ String userName = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
boolean bool;
List policies = this.getPolicies();
Policy pol = null;
@@ -596,6 +623,8 @@ public class PolicyManagerImpl implements PolicyManager {
featureDAO.deleteFeaturesOfProfile(policy.getProfileId());
profileDAO.deleteProfile(policy.getProfileId());
PolicyManagementDAOFactory.commitTransaction();
+ String stringPayload = new Gson().toJson(policy);
+ log.info("Policy deleted", policyLogContextBuilder.setPolicyName(policy.getPolicyName()).setPayload(stringPayload).setActionTag("DELETE_POLICY").setUserName(userName).setTenantID(tenantId).setTenantDomain(tenantDomain).build());
return bool;
} catch (PolicyManagerDAOException e) {
PolicyManagementDAOFactory.rollbackTransaction();
@@ -654,6 +683,9 @@ public class PolicyManagerImpl implements PolicyManager {
List deviceList = new ArrayList<>();
DeviceManagementProviderService deviceManagementService = PolicyManagementDataHolder
.getInstance().getDeviceManagementService();
+ String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain());
+ String userName = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername());
for (DeviceIdentifier deviceIdentifier : deviceIdentifierList) {
try {
Device device = deviceManagementService.getDevice(deviceIdentifier, false);
@@ -682,6 +714,9 @@ public class PolicyManagerImpl implements PolicyManager {
}
policy.setDevices(deviceList);
}
+ String policyPayload = new Gson().toJson(policy);
+ String deviceListPayload = new Gson().toJson(deviceList);
+ log.info("Policy added to devices", policyLogContextBuilder.setPolicyName(policy.getPolicyName()).setPayload(" Policy: " + policyPayload + " DeviceList: " + deviceListPayload).setActionTag("ADD_POLICY_TO_DEVICE").setUserName(userName).setTenantID(tenantId).setTenantDomain(tenantDomain).build());
} catch (PolicyManagerDAOException e) {
PolicyManagementDAOFactory.rollbackTransaction();
throw new PolicyManagementException("Error occurred while adding the policy ("
From 48be39a96386b5726b6ff5a92b44ea7d76af964d Mon Sep 17 00:00:00 2001
From: inoshperera
Date: Sun, 18 Jun 2023 12:22:01 +0530
Subject: [PATCH 19/50] Add the logic to save device id to certificate DB
partialy fixes https://roadmap.entgra.net/issues/10145
---
.../mgt/core/bean/Certificate.java | 9 +++++
.../mgt/core/dao/CertificateDAO.java | 11 ++++++
.../dao/impl/AbstractCertificateDAOImpl.java | 34 +++++++++++++++++++
.../mgt/core/impl/CertificateGenerator.java | 29 ++++++++++++++--
4 files changed, 80 insertions(+), 3 deletions(-)
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/bean/Certificate.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/bean/Certificate.java
index 5ced778afa..40a9ef1c6c 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/bean/Certificate.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/bean/Certificate.java
@@ -25,6 +25,15 @@ public class Certificate {
X509Certificate certificate;
int tenantId;
String tenantDomain;
+ String deviceIdentifier;
+
+ public String getDeviceIdentifier() {
+ return deviceIdentifier;
+ }
+
+ public void setDeviceIdentifier(String deviceIdentifier) {
+ this.deviceIdentifier = deviceIdentifier;
+ }
public int getTenantId() {
return tenantId;
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java
index fe1d829a82..3204b8e7b9 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/CertificateDAO.java
@@ -41,6 +41,17 @@ public interface CertificateDAO {
void addCertificate(List certificate)
throws CertificateManagementDAOException;
+ /**
+ * This can be used to store a certificate in the database, where it will be stored against the serial number
+ * of the certificate.
+ *
+ * @param certificate Holds the certificate and relevant details.
+ * @throws CertificateManagementDAOException
+ *
+ */
+ void addCertificate(Certificate certificate)
+ throws CertificateManagementDAOException;
+
/**
* Usage is to obtain a certificate stored in the database by providing the common name.
*
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java
index e536eaf646..caa3bf1e19 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java
@@ -81,6 +81,40 @@ public abstract class AbstractCertificateDAOImpl implements CertificateDAO{
}
}
+ @Override
+ public void addCertificate(Certificate certificate)
+ throws CertificateManagementDAOException {
+ Connection conn;
+ PreparedStatement stmt = null;
+ try {
+ conn = this.getConnection();
+ stmt = conn.prepareStatement(
+ "INSERT INTO DM_DEVICE_CERTIFICATE (SERIAL_NUMBER, CERTIFICATE, TENANT_ID," +
+ " USERNAME, DEVICE_IDENTIFIER) VALUES (?,?,?,?,?)");
+ PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.
+ getThreadLocalCarbonContext();
+ String username = threadLocalCarbonContext.getUsername();
+ // the serial number of the certificate used for its creation is set as its alias.
+ String serialNumber = certificate.getSerial();
+ if (serialNumber == null || serialNumber.isEmpty()) {
+ serialNumber = String.valueOf(certificate.getCertificate().getSerialNumber());
+ }
+ byte[] bytes = Serializer.serialize(certificate.getCertificate());
+
+ stmt.setString(1, serialNumber);
+ stmt.setBytes(2, bytes);
+ stmt.setInt(3, certificate.getTenantId());
+ stmt.setString(4, username);
+ stmt.setString(5, certificate.getDeviceIdentifier());
+ stmt.executeUpdate();
+ } catch (SQLException | IOException e) {
+ throw new CertificateManagementDAOException("Error occurred while saving the " +
+ "certificate. ", e);
+ } finally {
+ CertificateManagementDAOUtil.cleanupResources(stmt, null);
+ }
+ }
+
@Override
public CertificateResponse retrieveCertificate(String serialNumber)
throws CertificateManagementDAOException {
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
index e3973ed152..2a43704688 100755
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java
@@ -710,6 +710,30 @@ public class CertificateGenerator {
}
}
+ public void saveCertificate(org.wso2.carbon.certificate.mgt.core.bean.Certificate
+ certificate) throws KeystoreException {
+
+ if (certificate == null) {
+ return;
+ }
+
+ try {
+ CertificateDAO certificateDAO = CertificateManagementDAOFactory.getCertificateDAO();
+ CertificateManagementDAOFactory.beginTransaction();
+ certificateDAO.addCertificate(certificate);
+ CertificateManagementDAOFactory.commitTransaction();
+ } catch (CertificateManagementDAOException e) {
+ String errorMsg = "Error occurred when saving the generated certificate in database";
+ log.error(errorMsg);
+ CertificateManagementDAOFactory.rollbackTransaction();
+ throw new KeystoreException(errorMsg, e);
+ } catch (TransactionManagementException e) {
+ String errorMsg = "Error occurred when saving the generated certificate in database";
+ log.error(errorMsg);
+ throw new KeystoreException(errorMsg, e);
+ }
+ }
+
public void saveCertInKeyStore(List certificate)
throws KeystoreException {
@@ -845,11 +869,10 @@ public class CertificateGenerator {
org.wso2.carbon.certificate.mgt.core.bean.Certificate certificate =
new org.wso2.carbon.certificate.mgt.core.bean.Certificate();
- List certificates = new ArrayList<>();
certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
certificate.setCertificate(issuedCert);
- certificates.add(certificate);
- saveCertInKeyStore(certificates);
+ certificate.setDeviceIdentifier(commonName);
+ saveCertificate(certificate);
} catch (OperatorCreationException e) {
String errorMsg = "Error creating the content signer";
From 94408c7ce3f0f6fd4a97ec7bc6878fc147152e85 Mon Sep 17 00:00:00 2001
From: rajitha
Date: Thu, 15 Jun 2023 14:08:46 +0530
Subject: [PATCH 20/50] Add otp token
---
.../DeviceManagementConfigService.java | 7 +++-
.../DeviceManagementConfigServiceImpl.java | 37 ++++++++++++++++++-
.../config/jaxrs/util/DeviceMgtAPIUtils.java | 16 ++++++++
3 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java
index d5fe117a63..1adeb44f17 100644
--- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java
+++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java
@@ -156,7 +156,12 @@ public interface DeviceManagementConfigService {
value = "The properties list using for query a device",
required = true)
@QueryParam("properties")
- String properties);
+ String properties,
+ @ApiParam(
+ name = "withAccessToken",
+ value = "Whether to use access token or otp token for device configuration")
+ @QueryParam("withAccessToken")
+ boolean withAccessToken);
@PUT
@Path("/device/transfer")
diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java
index 8aea316c55..cf2fc9c83a 100644
--- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java
+++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java
@@ -35,8 +35,12 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfiguratio
import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException;
+import org.wso2.carbon.device.mgt.common.exceptions.OTPManagementException;
import org.wso2.carbon.device.mgt.common.general.TenantDetail;
+import org.wso2.carbon.device.mgt.common.otp.mgt.OTPEmailTypes;
+import org.wso2.carbon.device.mgt.common.otp.mgt.dto.OneTimePinDTO;
import org.wso2.carbon.device.mgt.common.permission.mgt.PermissionManagementException;
+import org.wso2.carbon.device.mgt.common.spi.OTPManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
@@ -77,7 +81,8 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig
@Path("/configurations")
@Produces(MediaType.APPLICATION_JSON)
public Response getConfiguration(@HeaderParam("token") String token,
- @QueryParam("properties") String properties) {
+ @QueryParam("properties") String properties,
+ @QueryParam("withAccessToken") boolean withAccessToken) {
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
try {
if (token == null || token.isEmpty()) {
@@ -102,7 +107,8 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig
deviceProps.put("token", token);
DeviceConfiguration devicesConfiguration =
dms.getDeviceConfiguration(deviceProps);
- setAccessTokenToDeviceConfigurations(devicesConfiguration);
+ if (withAccessToken) setAccessTokenToDeviceConfigurations(devicesConfiguration);
+ else setOTPTokenToDeviceConfigurations(devicesConfiguration);
return Response.status(Response.Status.OK).entity(devicesConfiguration).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving configurations";
@@ -214,6 +220,33 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig
}
}
+ private void setOTPTokenToDeviceConfigurations(DeviceConfiguration deviceConfiguration)
+ throws DeviceManagementException {
+ OneTimePinDTO oneTimePinData = new OneTimePinDTO();
+ oneTimePinData.setEmail(OTPEmailTypes.DEVICE_ENROLLMENT.toString());
+ oneTimePinData.setEmailType(OTPEmailTypes.DEVICE_ENROLLMENT.toString());
+ oneTimePinData.setUsername(deviceConfiguration.getDeviceOwner());
+ PrivilegedCarbonContext.startTenantFlow();
+ PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
+ deviceConfiguration.getTenantDomain(), true);
+ oneTimePinData.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
+ PrivilegedCarbonContext.endTenantFlow();
+ OTPManagementService otpManagementService = DeviceMgtAPIUtils.getOtpManagementService();
+ try {
+ OneTimePinDTO oneTimePinDTO = otpManagementService.generateOneTimePin(oneTimePinData, true);
+ if (oneTimePinDTO == null) {
+ String msg = "Null value returned when generating OTP token for " + oneTimePinData.getOtpToken();
+ log.error(msg);
+ throw new DeviceManagementException(msg);
+ }
+ deviceConfiguration.setAccessToken(oneTimePinDTO.getOtpToken());
+ } catch (OTPManagementException ex) {
+ String msg = "Error occurred while generating one time pin: " + ex.getMessage();
+ log.error(msg, ex);
+ throw new DeviceManagementException(msg, ex);
+ }
+ }
+
@Override
@Path("/tenants")
@GET
diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/util/DeviceMgtAPIUtils.java
index cf098c6edc..7ad136cd7f 100644
--- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/util/DeviceMgtAPIUtils.java
+++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/util/DeviceMgtAPIUtils.java
@@ -21,6 +21,7 @@ package io.entgra.carbon.device.mgt.config.jaxrs.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.wso2.carbon.device.mgt.common.spi.OTPManagementService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.user.core.service.RealmService;
@@ -34,6 +35,8 @@ public class DeviceMgtAPIUtils {
private static DeviceManagementProviderService deviceManagementProviderService = null;
private static RealmService realmService = null;
+ private static OTPManagementService otpManagementService = null;
+
public static DeviceManagementProviderService getDeviceManagementService() {
if (deviceManagementProviderService == null) {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
@@ -48,6 +51,19 @@ public class DeviceMgtAPIUtils {
return deviceManagementProviderService;
}
+ public static OTPManagementService getOtpManagementService() {
+ if (otpManagementService == null) {
+ PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
+ otpManagementService = (OTPManagementService) ctx.getOSGiService(OTPManagementService.class, null);
+ if (otpManagementService == null) {
+ String msg = "OTP Management Service has not initialized.";
+ log.error(msg);
+ throw new IllegalStateException(msg);
+ }
+ }
+ return otpManagementService;
+ }
+
public static RealmService getRealmService() {
if (realmService == null) {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
From cb99e4c285b4ee6a0ff1ff56ec516789e243a24c Mon Sep 17 00:00:00 2001
From: inoshperera
Date: Tue, 20 Jun 2023 23:37:12 +0530
Subject: [PATCH 21/50] iOS user enrollment support
Fixes https://roadmap.entgra.net/issues/10149
---
.../mgt/common/general/QREnrollmentDetails.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/general/QREnrollmentDetails.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/general/QREnrollmentDetails.java
index 38153881a2..fd270dc56d 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/general/QREnrollmentDetails.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/general/QREnrollmentDetails.java
@@ -18,10 +18,21 @@
package io.entgra.device.mgt.core.device.mgt.common.general;
+import java.util.Map;
+
public class QREnrollmentDetails {
String ownershipType;
String username;
String enrollmentMode;
+ Map customValues;
+
+ public Map getCustomValues() {
+ return customValues;
+ }
+
+ public void setCustomValues(Map customValues) {
+ this.customValues = customValues;
+ }
public String getOwnershipType() { return ownershipType; }
From b18003a1cdcbc84deef9bd6eabeabdb38a05c60a Mon Sep 17 00:00:00 2001
From: Pahansith
Date: Wed, 21 Jun 2023 06:20:17 +0530
Subject: [PATCH 22/50] Add OTP based remote session implementation
---
.../mgt/common/otp/mgt/OTPEmailTypes.java | 2 +-
.../interceptor/DefaultTokenHandler.java | 100 +++++-------------
.../ui/request/interceptor/UserHandler.java | 1 +
.../interceptor/util/HandlerConstants.java | 1 +
.../request/interceptor/util/HandlerUtil.java | 12 +++
5 files changed, 44 insertions(+), 72 deletions(-)
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java
index 9a182a0b14..ecfbc63905 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/otp/mgt/OTPEmailTypes.java
@@ -18,5 +18,5 @@
package org.wso2.carbon.device.mgt.common.otp.mgt;
public enum OTPEmailTypes {
- USER_VERIFY, DEVICE_ENROLLMENT, USER_INVITE
+ USER_VERIFY, DEVICE_ENROLLMENT, USER_INVITE, REMOTE_SESSION
}
diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java
index b244a5ed67..661027d10e 100644
--- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java
+++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java
@@ -18,21 +18,22 @@
package io.entgra.ui.request.interceptor;
import com.google.gson.Gson;
-import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import io.entgra.ui.request.interceptor.beans.AuthData;
import io.entgra.ui.request.interceptor.util.HandlerConstants;
import io.entgra.ui.request.interceptor.util.HandlerUtil;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.HttpHeaders;
import org.apache.http.HttpStatus;
-import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.entity.ContentType;
import io.entgra.ui.request.interceptor.beans.ProxyResponse;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
+import org.wso2.carbon.device.mgt.common.exceptions.OTPManagementException;
+import org.wso2.carbon.device.mgt.common.otp.mgt.OTPEmailTypes;
+import org.wso2.carbon.device.mgt.common.otp.mgt.dto.OneTimePinDTO;
+import org.wso2.carbon.device.mgt.common.spi.OTPManagementService;
+import org.wso2.carbon.user.api.UserStoreException;
+import org.wso2.carbon.user.core.service.RealmService;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
@@ -54,71 +55,28 @@ public class DefaultTokenHandler extends HttpServlet {
HttpSession httpSession = req.getSession(false);
if (httpSession != null) {
- AuthData authData = (AuthData) httpSession.getAttribute(HandlerConstants.SESSION_AUTH_DATA_KEY);
- if (authData == null) {
- HandlerUtil.sendUnAuthorizeResponse(resp);
- return;
+ String userWithDomain = (String) httpSession.getAttribute(HandlerConstants.USERNAME_WITH_DOMAIN);
+ String[] userNameParts = userWithDomain.split("@");
+
+ OneTimePinDTO oneTimePinData = new OneTimePinDTO();
+ oneTimePinData.setEmail(OTPEmailTypes.REMOTE_SESSION.toString());
+ oneTimePinData.setEmailType(OTPEmailTypes.REMOTE_SESSION.toString());
+ oneTimePinData.setUsername(userNameParts[0]);
+ PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
+ RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
+ try {
+ oneTimePinData.setTenantId(realmService.getTenantManager().getTenantId(userNameParts[1]));
+ } catch (UserStoreException e) {
+ throw new RuntimeException(e);
}
-
- AuthData defaultAuthData = (AuthData) httpSession
- .getAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY);
- if (defaultAuthData != null) {
- HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultAuthData.getAccessToken()));
- return;
- }
-
- String clientId = authData.getClientId();
- String clientSecret = authData.getClientSecret();
-
- String queryString = req.getQueryString();
- String scopeString = "";
- if (StringUtils.isNotEmpty(queryString)) {
- scopeString = req.getParameter("scopes");
- if (scopeString != null) {
- scopeString = "?scopes=" + scopeString;
- }
- }
-
- String iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR
- + System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)
- + HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme());
- String tokenUrl = iotsCoreUrl + "/api/device-mgt/v1.0/devices/" + clientId
- + "/" + clientSecret + "/default-token" + scopeString;
-
- HttpGet defaultTokenRequest = new HttpGet(tokenUrl);
- defaultTokenRequest
- .setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BEARER + authData.getAccessToken());
- defaultTokenRequest
- .setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString());
- ProxyResponse tokenResultResponse = HandlerUtil.execute(defaultTokenRequest);
-
- if (tokenResultResponse.getExecutorResponse().contains(HandlerConstants.EXECUTOR_EXCEPTION_PREFIX)) {
- log.error("Error occurred while invoking the API to get default token data.");
- HandlerUtil.handleError(resp, tokenResultResponse);
- return;
- }
- String tokenResult = tokenResultResponse.getData();
- if (tokenResult == null) {
- log.error("Invalid default token response is received.");
- HandlerUtil.handleError(resp, tokenResultResponse);
- return;
- }
-
- JsonParser jsonParser = new JsonParser();
- JsonElement jTokenResult = jsonParser.parse(tokenResult);
- if (jTokenResult.isJsonObject()) {
- JsonObject jTokenResultAsJsonObject = jTokenResult.getAsJsonObject();
- AuthData newDefaultAuthData = new AuthData();
- newDefaultAuthData.setClientId(clientId);
- newDefaultAuthData.setClientSecret(clientSecret);
-
- String defaultToken = jTokenResultAsJsonObject.get("accessToken").getAsString();
- newDefaultAuthData.setAccessToken(defaultToken);
- newDefaultAuthData.setRefreshToken(jTokenResultAsJsonObject.get("refreshToken").getAsString());
- newDefaultAuthData.setScope(jTokenResultAsJsonObject.get("scopes").getAsString());
- httpSession.setAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY, newDefaultAuthData);
-
- HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultToken));
+ oneTimePinData.setExpiryTime(DeviceManagementConstants.OTPProperties.OTP_DEFAULT_EXPIRY_SECONDS);
+ OTPManagementService otpManagementService = HandlerUtil.getOTPManagementService();
+ try {
+ oneTimePinData = otpManagementService.generateOneTimePin(oneTimePinData, true);
+ HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(oneTimePinData.getOtpToken()));
+ } catch (OTPManagementException e) {
+ log.error("Failed while generating remote session OTP for user " + userWithDomain, e);
+ HandlerUtil.handleError(resp, HttpStatus.SC_INTERNAL_SERVER_ERROR);
}
} else {
HandlerUtil.sendUnAuthorizeResponse(resp);
diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java
index 53be11141e..0061865583 100644
--- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java
+++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java
@@ -120,6 +120,7 @@ public class UserHandler extends HttpServlet {
proxyResponse.setData(
jTokenResultAsJsonObject.get("username").getAsString().replaceAll("@carbon.super", ""));
HandlerUtil.handleSuccess(resp, proxyResponse);
+ httpSession.setAttribute(HandlerConstants.USERNAME_WITH_DOMAIN, jTokenResultAsJsonObject.get("username").getAsString());
log.info("Customer login", userLogContextBuilder.setUserName(proxyResponse.getData()).setUserRegistered(true).build());
}
} catch (IOException e) {
diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java
index 27d6afaadc..a6aa8d6bff 100644
--- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java
+++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java
@@ -106,4 +106,5 @@ public class HandlerConstants {
public static final String IOT_REPORTING_WEBAPP_HOST_ENV_VAR = "iot.reporting.webapp.host";
public static final String USER_SCOPES = "userScopes";
public static final String HUBSPOT_CHAT_URL = "api.hubapi.com";
+ public static final String USERNAME_WITH_DOMAIN = "usernameWithDomain";
}
diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java
index b7376abddc..ab09718a04 100644
--- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java
+++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java
@@ -55,6 +55,8 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.w3c.dom.Document;
import io.entgra.ui.request.interceptor.beans.ProxyResponse;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.wso2.carbon.device.mgt.common.spi.OTPManagementService;
import org.xml.sax.SAXException;
import javax.servlet.http.HttpServletRequest;
@@ -79,6 +81,8 @@ public class HandlerUtil {
private static boolean isLoginCacheInitialized = false;
private static AuthData authData;
+ private static OTPManagementService otpManagementService;
+
/***
*
* @param httpRequest - httpMethod e.g:- HttpPost, HttpGet
@@ -751,4 +755,12 @@ public class HandlerUtil {
public static boolean isPropertyDefined(String property) {
return StringUtils.isEmpty(System.getProperty(property));
}
+
+ public static OTPManagementService getOTPManagementService() {
+ if (otpManagementService == null) {
+ otpManagementService = (OTPManagementService) PrivilegedCarbonContext
+ .getThreadLocalCarbonContext().getOSGiService(OTPManagementService.class, null);
+ }
+ return otpManagementService;
+ }
}
From 6c9d33a16aa28b7dd202ce633947095fe6570574 Mon Sep 17 00:00:00 2001
From: builder
Date: Wed, 21 Jun 2023 13:48:19 +0530
Subject: [PATCH 23/50] [maven-release-plugin] prepare release v5.0.26
---
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/analytics-mgt/grafana-mgt/pom.xml | 2 +-
components/analytics-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/apimgt-extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +-
components/application-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +-
components/certificate-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/device-mgt-extensions/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
components/device-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
components/heartbeat-management/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/identity-extensions/pom.xml | 2 +-
.../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +-
components/logger/pom.xml | 2 +-
.../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +-
components/operation-template-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +-
components/policy-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +-
components/subtype-mgt/pom.xml | 2 +-
components/task-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +-
components/task-mgt/task-manager/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +-
components/task-mgt/task-watcher/pom.xml | 2 +-
.../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +-
components/tenant-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
components/transport-mgt/email-sender/pom.xml | 2 +-
components/transport-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/transport-mgt/sms-handler/pom.xml | 2 +-
.../pom.xml | 2 +-
components/ui-request-interceptor/pom.xml | 2 +-
.../pom.xml | 2 +-
components/webapp-authenticator-framework/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/analytics-mgt/grafana-mgt/pom.xml | 2 +-
features/analytics-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 6 ++----
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/apimgt-extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
features/application-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/certificate-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/device-mgt-extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +-
.../pom.xml | 2 +-
features/device-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
features/heartbeat-management/pom.xml | 2 +-
.../pom.xml | 2 +-
features/jwt-client/pom.xml | 2 +-
.../pom.xml | 2 +-
features/logger/pom.xml | 2 +-
.../pom.xml | 5 ++---
features/operation-template-mgt-plugin-feature/pom.xml | 5 ++---
.../pom.xml | 2 +-
features/policy-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +-
features/subtype-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +-
features/task-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
features/tenant-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +-
features/transport-mgt/email-sender/pom.xml | 2 +-
features/transport-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/transport-mgt/sms-handler/pom.xml | 2 +-
.../pom.xml | 2 +-
features/ui-request-interceptor/pom.xml | 2 +-
.../pom.xml | 2 +-
features/webapp-authenticator-framework/pom.xml | 2 +-
pom.xml | 6 +++---
132 files changed, 137 insertions(+), 141 deletions(-)
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
index ff2374a53c..726ea76828 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
index 940ea30eae..8f2c581931 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
index abf13026a3..c2bafef7f0 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml
index 0b495a83a8..a8220d602c 100644
--- a/components/analytics-mgt/grafana-mgt/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
analytics-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml
index abf6339213..2aa9999730 100644
--- a/components/analytics-mgt/pom.xml
+++ b/components/analytics-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
index e87d65d265..52f1924c89 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
@@ -20,7 +20,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
4.0.0
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
index 8e14d9c9dc..1a79f3c0cf 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
index 50b8fb74ac..f478607114 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
index d1468e512d..68b1b170b3 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
index a6ed59e529..c52ee3f580 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
index 10e709a3d3..6d4afb5216 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
4.0.0
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
index 04646276e3..3d1bb63058 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
index 49358b6f62..8c57b509d2 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml
index 0805820e3d..a1b71ae39a 100644
--- a/components/apimgt-extensions/pom.xml
+++ b/components/apimgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
index 1662dfe3cd..a0e2d7684b 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
application-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
index 42720961d7..fb939288ac 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
application-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml
index 5a21d3725b..dbe805ed9a 100644
--- a/components/application-mgt/pom.xml
+++ b/components/application-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
index 361ef1ba3d..24ed02856c 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
index c4c9c7826c..dbf25c73f1 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
index 9d1af706e6..bc410bb32c 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
certificate-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml
index 72256c9315..b99bf393cc 100644
--- a/components/certificate-mgt/pom.xml
+++ b/components/certificate-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
index 74e8dedcf6..773fa79c09 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
index ae988a7f2d..ffdda5ac45 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
index 2b13e0f4dc..5ee7c9ba8e 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
@@ -21,7 +21,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
index 9bbbbd9e24..2f1238f2e9 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
index 623573aa5d..fb523d8289 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
index 3ee7d9db36..73b3de4b1a 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
index 5a8d0aef90..d33165ad4a 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
index 57f2b5362c..4b780865ab 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
index 5e225639b2..7853f2c785 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml
index 5e6269373b..8657a1f009 100644
--- a/components/device-mgt-extensions/pom.xml
+++ b/components/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
index 77464d6aeb..533349c637 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
index e5a723111e..6df8f2b82a 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
@@ -21,7 +21,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
index fb131ffb1a..b808efcabf 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
index 23f16f3cda..5b3baa6785 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
index ada22ece25..3e5b2658a4 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
index 212ac04caa..d4638446bd 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
@@ -23,7 +23,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml
index ea3547e7d3..f0e70e05a1 100644
--- a/components/device-mgt/pom.xml
+++ b/components/device-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
index 0d5368565b..0b81d77198 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
heartbeat-management
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml
index 819685280b..1ed1fc7ee8 100644
--- a/components/heartbeat-management/pom.xml
+++ b/components/heartbeat-management/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
index 68c5a248b7..4e2987addb 100644
--- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
+++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
identity-extensions
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
index 73c26343cc..3ca46cf2a6 100644
--- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
+++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
identity-extensions
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml
index 55ebda39ae..5d5883919f 100644
--- a/components/identity-extensions/pom.xml
+++ b/components/identity-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
index 70f5c9713c..3650a5f6cd 100644
--- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
logger
- 5.0.26-SNAPSHOT
+ 5.0.26
io.entgra.device.mgt.core.notification.logger
diff --git a/components/logger/pom.xml b/components/logger/pom.xml
index 5a98271148..873725bda8 100644
--- a/components/logger/pom.xml
+++ b/components/logger/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
index fabe229625..cbb30b8b8a 100644
--- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
+++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
operation-template-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml
index d83ea2e190..77e08cf802 100644
--- a/components/operation-template-mgt/pom.xml
+++ b/components/operation-template-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
index 2ae87ad43d..d16c65be0e 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
index ebf20ac5af..90bd6c38f8 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
index 77cc3ea075..aac354b6fb 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
index ec828e0802..0ca6c9e5fe 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml
index d23b3b2fd4..db101e1c64 100644
--- a/components/policy-mgt/pom.xml
+++ b/components/policy-mgt/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
index 4df4d9bf62..a7c8025610 100644
--- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
+++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
subtype-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml
index 0f4e0f5f5a..9ec655ddde 100644
--- a/components/subtype-mgt/pom.xml
+++ b/components/subtype-mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml
index 0913807c9c..678ecb939d 100755
--- a/components/task-mgt/pom.xml
+++ b/components/task-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
index bdeef9c25e..e874b8f27a 100755
--- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
+++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
@@ -20,7 +20,7 @@
task-manager
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
index c75481efff..d35dc4cde0 100755
--- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
+++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-manager
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml
index 9ea2215ea7..8b6639a9a4 100755
--- a/components/task-mgt/task-manager/pom.xml
+++ b/components/task-mgt/task-manager/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
index a2b498f1da..012abc71b0 100755
--- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
+++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-watcher
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml
index 456c573204..341eca5abf 100755
--- a/components/task-mgt/task-watcher/pom.xml
+++ b/components/task-mgt/task-watcher/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
index 7db50aadbf..1480d7ccbb 100644
--- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
+++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
index 94feb15285..ab5c57eb82 100644
--- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
+++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml
index ce01e21a9c..287ff5b16d 100644
--- a/components/tenant-mgt/pom.xml
+++ b/components/tenant-mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
index 4ee6e54479..aa20617229 100644
--- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
+++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
email-sender
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml
index 511e64959c..d1c2d726a4 100644
--- a/components/transport-mgt/email-sender/pom.xml
+++ b/components/transport-mgt/email-sender/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml
index a2140712f7..da419f1132 100644
--- a/components/transport-mgt/pom.xml
+++ b/components/transport-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
index 3862bbc7b5..8adf64e4ee 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
index e966a73a48..74b09026d2 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
index 895f2a48a8..21c64dea96 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml
index 6eda7374a9..a6e36e35a8 100644
--- a/components/transport-mgt/sms-handler/pom.xml
+++ b/components/transport-mgt/sms-handler/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
index 4ef7a1ed11..29240b23dd 100644
--- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
+++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
@@ -21,7 +21,7 @@
ui-request-interceptor
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
4.0.0
diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml
index 47912a8465..b046f3bde9 100644
--- a/components/ui-request-interceptor/pom.xml
+++ b/components/ui-request-interceptor/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
index 2acaaf41ed..a064a4ced1 100644
--- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
+++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
webapp-authenticator-framework
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml
index 84331a5148..51d9192a23 100644
--- a/components/webapp-authenticator-framework/pom.xml
+++ b/components/webapp-authenticator-framework/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
index e7d57bd4b7..5de76a344c 100644
--- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
index d5f9504a83..a8bb2145bd 100644
--- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml
index 2087a82870..dff8e55869 100644
--- a/features/analytics-mgt/grafana-mgt/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
analytics-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml
index 168b828243..f08e83b047 100644
--- a/features/analytics-mgt/pom.xml
+++ b/features/analytics-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
index a7c7c76fed..5ad1c03768 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
index b9f5e19141..9058b40472 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
index b0f3a595a5..da47b18dcc 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
@@ -17,14 +17,12 @@
~ under the License.
-->
-
+
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
index 9a314ebe91..a02e71be4c 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
index 0c957a9e32..e8fd8a64ac 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml
index 72acd8222b..e83d7aae65 100644
--- a/features/apimgt-extensions/pom.xml
+++ b/features/apimgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
index 25ad62b1ee..fd24445d74 100644
--- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
+++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
application-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml
index 4877de4bbe..50795abc02 100644
--- a/features/application-mgt/pom.xml
+++ b/features/application-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
index ee58bc2216..b127e5e604 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
index db7000769b..4ea3e53a40 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
index 21f88bd204..14351293f3 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml
index 8c37615ec3..9d74445601 100644
--- a/features/certificate-mgt/pom.xml
+++ b/features/certificate-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
index 7ae6077a9d..bed402f93f 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
index 572b6c3370..1e02a9bb3a 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
index ae20f1c3ec..2f50b87a65 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
index ba827a45d4..9cb9d46180 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
index dda8a1b0fd..4c24ca50e1 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
index f939074f4c..8250e9824b 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
index 1a12ddad92..46e02dd114 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
index 327860d5e9..91e2ea8f4e 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml
index cc1b9bbbb9..e42076e25a 100644
--- a/features/device-mgt-extensions/pom.xml
+++ b/features/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
index 563d5062a2..5846fd518b 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
index cecb4193cf..4aef29ca37 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
index 331022956c..50344d8b4b 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
index c94186ed7a..208ee2b53d 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
index 395079ee79..e86a75fe17 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml
index 63317d4ab8..d936f6d3dd 100644
--- a/features/device-mgt/pom.xml
+++ b/features/device-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
index d6156acad8..e679968497 100644
--- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
+++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
heart-beat-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml
index f551b3e518..cded4f70a4 100644
--- a/features/heartbeat-management/pom.xml
+++ b/features/heartbeat-management/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
index b6c99e91dc..e688f88b7f 100644
--- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
+++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
jwt-client-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml
index 4c37769faa..354a0c839c 100644
--- a/features/jwt-client/pom.xml
+++ b/features/jwt-client/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
index 35824fe858..904d6dd006 100644
--- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
+++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
logger-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/logger/pom.xml b/features/logger/pom.xml
index f4b3d3e41a..d25fa68234 100644
--- a/features/logger/pom.xml
+++ b/features/logger/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
index 7796b17368..1c84e8e622 100644
--- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
+++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
@@ -17,13 +17,12 @@
~ under the License.
-->
-
+
io.entgra.device.mgt.core
operation-template-mgt-plugin-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml
index a16c219134..a0b620e134 100644
--- a/features/operation-template-mgt-plugin-feature/pom.xml
+++ b/features/operation-template-mgt-plugin-feature/pom.xml
@@ -17,13 +17,12 @@
~ under the License.
-->
-
+
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
index 76e5e1cc64..98f91bdd88 100644
--- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
+++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
policy-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml
index d8f251bcc3..ba663fd25f 100644
--- a/features/policy-mgt/pom.xml
+++ b/features/policy-mgt/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
index 1662a6e55c..ef0666fd74 100644
--- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
+++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../../pom.xml
diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml
index f37cf1d8f3..13ce5f1747 100644
--- a/features/subtype-mgt/pom.xml
+++ b/features/subtype-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
index d0162c080c..bd7f57173d 100755
--- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
+++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../../pom.xml
diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml
index a70cbbc67a..2d6b9ce586 100755
--- a/features/task-mgt/pom.xml
+++ b/features/task-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
index 6b7d3345b4..6a41687f50 100644
--- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
+++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt-feature
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml
index a19947d332..da2cb6e32f 100644
--- a/features/tenant-mgt/pom.xml
+++ b/features/tenant-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
index c64b70b88c..75e1592caf 100644
--- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
+++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
email-sender-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml
index 41485338e8..9d609e382b 100644
--- a/features/transport-mgt/email-sender/pom.xml
+++ b/features/transport-mgt/email-sender/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml
index ee58261e6c..fc2aa0d8ba 100644
--- a/features/transport-mgt/pom.xml
+++ b/features/transport-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
index 5dcab5c654..70b0166a43 100644
--- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
+++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
index 63c732d9e5..801e30955f 100644
--- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
+++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml
index d60cefe7be..66617d8db4 100644
--- a/features/transport-mgt/sms-handler/pom.xml
+++ b/features/transport-mgt/sms-handler/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
index 90ba4c04cc..124abdc31f 100644
--- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
+++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
@@ -21,7 +21,7 @@
ui-request-interceptor-feature
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
4.0.0
diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml
index 45b132211d..97230de6c0 100644
--- a/features/ui-request-interceptor/pom.xml
+++ b/features/ui-request-interceptor/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
index b1b8e9eeb6..371d822adf 100644
--- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
+++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
webapp-authenticator-framework-feature
- 5.0.26-SNAPSHOT
+ 5.0.26
../pom.xml
diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml
index dac2640428..0e76f0a282 100644
--- a/features/webapp-authenticator-framework/pom.xml
+++ b/features/webapp-authenticator-framework/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26-SNAPSHOT
+ 5.0.26
../../pom.xml
diff --git a/pom.xml b/pom.xml
index 931f59edfa..5f43b19370 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
pom
- 5.0.26-SNAPSHOT
+ 5.0.26
WSO2 Carbon - Device Management - Parent
http://wso2.org
WSO2 Connected Device Manager Components
@@ -1879,7 +1879,7 @@
https://repository.entgra.net/community/device-mgt-core.git
scm:git:https://repository.entgra.net/community/device-mgt-core.git
scm:git:https://repository.entgra.net/community/device-mgt-core.git
- HEAD
+ v5.0.26
@@ -2091,7 +2091,7 @@
1.2.11.wso2v10
- 5.0.26-SNAPSHOT
+ 5.0.26
4.7.35
From ab2e1297e54a6adb0182b25f7fd15fa6d0ab1b67 Mon Sep 17 00:00:00 2001
From: builder
Date: Wed, 21 Jun 2023 13:48:25 +0530
Subject: [PATCH 24/50] [maven-release-plugin] prepare for next development
iteration
---
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/analytics-mgt/grafana-mgt/pom.xml | 2 +-
components/analytics-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/apimgt-extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +-
components/application-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +-
components/certificate-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/device-mgt-extensions/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
components/device-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
components/heartbeat-management/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/identity-extensions/pom.xml | 2 +-
.../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +-
components/logger/pom.xml | 2 +-
.../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +-
components/operation-template-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +-
components/policy-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +-
components/subtype-mgt/pom.xml | 2 +-
components/task-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +-
components/task-mgt/task-manager/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +-
components/task-mgt/task-watcher/pom.xml | 2 +-
.../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +-
.../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +-
components/tenant-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
components/transport-mgt/email-sender/pom.xml | 2 +-
components/transport-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
components/transport-mgt/sms-handler/pom.xml | 2 +-
.../pom.xml | 2 +-
components/ui-request-interceptor/pom.xml | 2 +-
.../pom.xml | 2 +-
components/webapp-authenticator-framework/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/analytics-mgt/grafana-mgt/pom.xml | 2 +-
features/analytics-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/apimgt-extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
features/application-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/certificate-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/device-mgt-extensions/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +-
.../pom.xml | 2 +-
features/device-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
features/heartbeat-management/pom.xml | 2 +-
.../pom.xml | 2 +-
features/jwt-client/pom.xml | 2 +-
.../pom.xml | 2 +-
features/logger/pom.xml | 2 +-
.../pom.xml | 2 +-
features/operation-template-mgt-plugin-feature/pom.xml | 2 +-
.../pom.xml | 2 +-
features/policy-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +-
features/subtype-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +-
features/task-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
features/tenant-mgt/pom.xml | 2 +-
.../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +-
features/transport-mgt/email-sender/pom.xml | 2 +-
features/transport-mgt/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
features/transport-mgt/sms-handler/pom.xml | 2 +-
.../pom.xml | 2 +-
features/ui-request-interceptor/pom.xml | 2 +-
.../pom.xml | 2 +-
features/webapp-authenticator-framework/pom.xml | 2 +-
pom.xml | 6 +++---
132 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
index 726ea76828..00d349fe8c 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
index 8f2c581931..b3756bfa14 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
index c2bafef7f0..5ccdb13257 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml
index a8220d602c..110c64f553 100644
--- a/components/analytics-mgt/grafana-mgt/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
analytics-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml
index 2aa9999730..6482bc57da 100644
--- a/components/analytics-mgt/pom.xml
+++ b/components/analytics-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
index 52f1924c89..6cc8bc074f 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml
@@ -20,7 +20,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
4.0.0
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
index 1a79f3c0cf..1566bb9350 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
index f478607114..22d092d948 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
index 68b1b170b3..87866c92a8 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
index c52ee3f580..b6a55ecce8 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
index 6d4afb5216..596890a486 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
4.0.0
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
index 3d1bb63058..16473e86bf 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
index 8c57b509d2..6b8e5d4cc6 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml
index a1b71ae39a..dc1fbb9f93 100644
--- a/components/apimgt-extensions/pom.xml
+++ b/components/apimgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
index a0e2d7684b..8c07c96b32 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
application-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
index fb939288ac..22ea770699 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
application-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml
index dbe805ed9a..1c96bb5443 100644
--- a/components/application-mgt/pom.xml
+++ b/components/application-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
index 24ed02856c..39dd733ced 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
index dbf25c73f1..55f9414ffe 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
index bc410bb32c..65734f6ffb 100644
--- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
+++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
certificate-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml
index b99bf393cc..ea2fe08c57 100644
--- a/components/certificate-mgt/pom.xml
+++ b/components/certificate-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
index 773fa79c09..f478949233 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
index ffdda5ac45..c192cd958e 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
index 5ee7c9ba8e..8cdbf53776 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml
@@ -21,7 +21,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
index 2f1238f2e9..8dd43e524a 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
index fb523d8289..412e17f8c2 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
index 73b3de4b1a..6f75e674c9 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
index d33165ad4a..efd79f733f 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
index 4b780865ab..76e937fab1 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
index 7853f2c785..e5dbc5a131 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml
index 8657a1f009..a5122df554 100644
--- a/components/device-mgt-extensions/pom.xml
+++ b/components/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
index 533349c637..c9b7c2e0bc 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
index 6df8f2b82a..c177d7ee78 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml
@@ -21,7 +21,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
index b808efcabf..d9d82dbc63 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
index 5b3baa6785..9a2cfd1802 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
index 3e5b2658a4..9118e3842d 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
@@ -22,7 +22,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
index d4638446bd..cbe6d7bcc2 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml
@@ -23,7 +23,7 @@
device-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml
index f0e70e05a1..921d771ec9 100644
--- a/components/device-mgt/pom.xml
+++ b/components/device-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
index 0b81d77198..a8b011b968 100644
--- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
+++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
heartbeat-management
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml
index 1ed1fc7ee8..7bf1a8fbdb 100644
--- a/components/heartbeat-management/pom.xml
+++ b/components/heartbeat-management/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
index 4e2987addb..42624a617f 100644
--- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
+++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
identity-extensions
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
index 3ca46cf2a6..7079c15045 100644
--- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
+++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
identity-extensions
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml
index 5d5883919f..1dbcfad35a 100644
--- a/components/identity-extensions/pom.xml
+++ b/components/identity-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
index 3650a5f6cd..bf5fbf176f 100644
--- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
+++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
logger
- 5.0.26
+ 5.0.27-SNAPSHOT
io.entgra.device.mgt.core.notification.logger
diff --git a/components/logger/pom.xml b/components/logger/pom.xml
index 873725bda8..23a989ebeb 100644
--- a/components/logger/pom.xml
+++ b/components/logger/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
index cbb30b8b8a..26624fa0d1 100644
--- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
+++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
operation-template-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml
index 77e08cf802..94c29533fe 100644
--- a/components/operation-template-mgt/pom.xml
+++ b/components/operation-template-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
index d16c65be0e..e7471d5d85 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
index 90bd6c38f8..311409587a 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
index aac354b6fb..4407436f5a 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
index 0ca6c9e5fe..4f6fca7f5c 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
policy-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml
index db101e1c64..a4a9943df1 100644
--- a/components/policy-mgt/pom.xml
+++ b/components/policy-mgt/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
index a7c8025610..666ab61c33 100644
--- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
+++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
subtype-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml
index 9ec655ddde..91d04c4c33 100644
--- a/components/subtype-mgt/pom.xml
+++ b/components/subtype-mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml
index 678ecb939d..26e51edae7 100755
--- a/components/task-mgt/pom.xml
+++ b/components/task-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
index e874b8f27a..15c0e8eea1 100755
--- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
+++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml
@@ -20,7 +20,7 @@
task-manager
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
index d35dc4cde0..b5d33d664c 100755
--- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
+++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-manager
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml
index 8b6639a9a4..f0eb908782 100755
--- a/components/task-mgt/task-manager/pom.xml
+++ b/components/task-mgt/task-manager/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
index 012abc71b0..ab2eba0b18 100755
--- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
+++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-watcher
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml
index 341eca5abf..d14ddd7d18 100755
--- a/components/task-mgt/task-watcher/pom.xml
+++ b/components/task-mgt/task-watcher/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
task-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
index 1480d7ccbb..28ecfe0b90 100644
--- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
+++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
index ab5c57eb82..ba54eee2a8 100644
--- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
+++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml
index 287ff5b16d..bdc00ce03d 100644
--- a/components/tenant-mgt/pom.xml
+++ b/components/tenant-mgt/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
index aa20617229..9c4e0f9679 100644
--- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
+++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
email-sender
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml
index d1c2d726a4..8fe1aef399 100644
--- a/components/transport-mgt/email-sender/pom.xml
+++ b/components/transport-mgt/email-sender/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml
index da419f1132..7c275e0a25 100644
--- a/components/transport-mgt/pom.xml
+++ b/components/transport-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
index 8adf64e4ee..1b07612778 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
index 74b09026d2..9f0f053843 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
index 21c64dea96..0056dec525 100644
--- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
+++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml
index a6e36e35a8..18baf3dd9d 100644
--- a/components/transport-mgt/sms-handler/pom.xml
+++ b/components/transport-mgt/sms-handler/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
index 29240b23dd..14db803388 100644
--- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
+++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml
@@ -21,7 +21,7 @@
ui-request-interceptor
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
4.0.0
diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml
index b046f3bde9..0faab0c2fa 100644
--- a/components/ui-request-interceptor/pom.xml
+++ b/components/ui-request-interceptor/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
index a064a4ced1..7e3bd80758 100644
--- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
+++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
webapp-authenticator-framework
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml
index 51d9192a23..f2b6a87bca 100644
--- a/components/webapp-authenticator-framework/pom.xml
+++ b/components/webapp-authenticator-framework/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
index 5de76a344c..c087fc0b4a 100644
--- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
index a8bb2145bd..834a46bb70 100644
--- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
grafana-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml
index dff8e55869..7dd4d6fb94 100644
--- a/features/analytics-mgt/grafana-mgt/pom.xml
+++ b/features/analytics-mgt/grafana-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
analytics-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml
index f08e83b047..2ebf097dd7 100644
--- a/features/analytics-mgt/pom.xml
+++ b/features/analytics-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
index 5ad1c03768..3d4c3038af 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml
@@ -20,7 +20,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
index 9058b40472..3722df051a 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
index da47b18dcc..98ac163d22 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
index a02e71be4c..6c0202db0e 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
index e8fd8a64ac..c01f0bcc2f 100644
--- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
+++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
apimgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml
index e83d7aae65..d95c81a79a 100644
--- a/features/apimgt-extensions/pom.xml
+++ b/features/apimgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
index fd24445d74..e80ecf4da3 100644
--- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
+++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
application-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml
index 50795abc02..499e95ba46 100644
--- a/features/application-mgt/pom.xml
+++ b/features/application-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
index b127e5e604..e8a4a4465c 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
index 4ea3e53a40..05e61d8d73 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
index 14351293f3..2a4facce46 100644
--- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
+++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
certificate-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml
index 9d74445601..5248d250ea 100644
--- a/features/certificate-mgt/pom.xml
+++ b/features/certificate-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
index bed402f93f..05593dffd1 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
index 1e02a9bb3a..687b2ab864 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
index 2f50b87a65..a9a90aa701 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
index 9cb9d46180..2283248c6e 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
index 4c24ca50e1..549f1dfd55 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
index 8250e9824b..cd6b6d32b1 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
index 46e02dd114..a5e62dc0fe 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
index 91e2ea8f4e..06cc986d05 100644
--- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
+++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-extensions-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml
index e42076e25a..cdc79c6e84 100644
--- a/features/device-mgt-extensions/pom.xml
+++ b/features/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
index 5846fd518b..0d97b9c041 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
index 4aef29ca37..19c25b738d 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
index 50344d8b4b..e2ea761dac 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
index 208ee2b53d..9ab721691f 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
index e86a75fe17..1d1e233b3c 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
device-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml
index d936f6d3dd..6570c46eb0 100644
--- a/features/device-mgt/pom.xml
+++ b/features/device-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
index e679968497..a528743788 100644
--- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
+++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
heart-beat-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml
index cded4f70a4..a2d4bed8ba 100644
--- a/features/heartbeat-management/pom.xml
+++ b/features/heartbeat-management/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
index e688f88b7f..511aee8ac8 100644
--- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
+++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
jwt-client-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml
index 354a0c839c..827addde60 100644
--- a/features/jwt-client/pom.xml
+++ b/features/jwt-client/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
index 904d6dd006..23a8a3bffd 100644
--- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
+++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
logger-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/logger/pom.xml b/features/logger/pom.xml
index d25fa68234..34a5aa4ccf 100644
--- a/features/logger/pom.xml
+++ b/features/logger/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
index 1c84e8e622..5bcdf81f74 100644
--- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
+++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
operation-template-mgt-plugin-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml
index a0b620e134..8351d50946 100644
--- a/features/operation-template-mgt-plugin-feature/pom.xml
+++ b/features/operation-template-mgt-plugin-feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
index 98f91bdd88..9ba47c2fe9 100644
--- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
+++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
policy-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml
index ba663fd25f..760c777394 100644
--- a/features/policy-mgt/pom.xml
+++ b/features/policy-mgt/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
index ef0666fd74..3383dd46b2 100644
--- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
+++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../../pom.xml
diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml
index 13ce5f1747..3cccf87ad1 100644
--- a/features/subtype-mgt/pom.xml
+++ b/features/subtype-mgt/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
index bd7f57173d..124da1ecd7 100755
--- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
+++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../../pom.xml
diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml
index 2d6b9ce586..d7e84d2782 100755
--- a/features/task-mgt/pom.xml
+++ b/features/task-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
index 6a41687f50..73ef7d79b3 100644
--- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
+++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml
@@ -20,7 +20,7 @@
tenant-mgt-feature
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml
index da2cb6e32f..8f87de9b1f 100644
--- a/features/tenant-mgt/pom.xml
+++ b/features/tenant-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
index 75e1592caf..3bd5878e26 100644
--- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
+++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
email-sender-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml
index 9d609e382b..49163d8857 100644
--- a/features/transport-mgt/email-sender/pom.xml
+++ b/features/transport-mgt/email-sender/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml
index fc2aa0d8ba..23513d7ed8 100644
--- a/features/transport-mgt/pom.xml
+++ b/features/transport-mgt/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
index 70b0166a43..b6dd0dcc5c 100644
--- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
+++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
index 801e30955f..4092c4c553 100644
--- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
+++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
sms-handler-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml
index 66617d8db4..8350d1b2d2 100644
--- a/features/transport-mgt/sms-handler/pom.xml
+++ b/features/transport-mgt/sms-handler/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
transport-mgt-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
index 124abdc31f..53903a27e5 100644
--- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
+++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml
@@ -21,7 +21,7 @@
ui-request-interceptor-feature
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
4.0.0
diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml
index 97230de6c0..a3ead6185d 100644
--- a/features/ui-request-interceptor/pom.xml
+++ b/features/ui-request-interceptor/pom.xml
@@ -21,7 +21,7 @@
io.entgra.device.mgt.core.parent
io.entgra.device.mgt.core
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
index 371d822adf..52e1f1594d 100644
--- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
+++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
webapp-authenticator-framework-feature
- 5.0.26
+ 5.0.27-SNAPSHOT
../pom.xml
diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml
index 0e76f0a282..7d035f3691 100644
--- a/features/webapp-authenticator-framework/pom.xml
+++ b/features/webapp-authenticator-framework/pom.xml
@@ -22,7 +22,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
- 5.0.26
+ 5.0.27-SNAPSHOT
../../pom.xml
diff --git a/pom.xml b/pom.xml
index 5f43b19370..ea80080466 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
io.entgra.device.mgt.core
io.entgra.device.mgt.core.parent
pom
- 5.0.26
+ 5.0.27-SNAPSHOT
WSO2 Carbon - Device Management - Parent
http://wso2.org
WSO2 Connected Device Manager Components
@@ -1879,7 +1879,7 @@
https://repository.entgra.net/community/device-mgt-core.git
scm:git:https://repository.entgra.net/community/device-mgt-core.git
scm:git:https://repository.entgra.net/community/device-mgt-core.git
- v5.0.26
+ HEAD
@@ -2091,7 +2091,7 @@
1.2.11.wso2v10
- 5.0.26
+ 5.0.27-SNAPSHOT
4.7.35
From 00bd74734a639517930f904e98c2208b9737d0c3 Mon Sep 17 00:00:00 2001
From: navodzoysa
Date: Wed, 21 Jun 2023 23:32:48 +0530
Subject: [PATCH 25/50] Remove apim_reserved_user when fetching users
---
.../jaxrs/service/impl/UserManagementServiceImpl.java | 9 +++++++++
.../mgt/core/device/mgt/api/jaxrs/util/Constants.java | 1 +
2 files changed, 10 insertions(+)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java
index d8db5e3776..29a64a9238 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java
@@ -455,6 +455,9 @@ public class UserManagementServiceImpl implements UserManagementService {
userList = new ArrayList<>(users.size());
BasicUserInfo user;
for (String username : users) {
+ if (Constants.APIM_RESERVED_USER.equals(username)) {
+ continue;
+ }
user = getBasicUserInfo(username);
userList.add(user);
}
@@ -515,6 +518,9 @@ public class UserManagementServiceImpl implements UserManagementService {
if (StringUtils.isNotEmpty(username)) {
commonUsers = getUserList(null, username);
}
+ if (commonUsers != null) {
+ commonUsers.remove(Constants.APIM_RESERVED_USER);
+ }
if (!skipSearch(commonUsers) && StringUtils.isNotEmpty(firstName)) {
tempList = getUserList(Constants.USER_CLAIM_FIRST_NAME, firstName);
@@ -689,6 +695,9 @@ public class UserManagementServiceImpl implements UserManagementService {
userList = new ArrayList<>();
UserInfo user;
for (String username : users) {
+ if (Constants.APIM_RESERVED_USER.equals(username)) {
+ continue;
+ }
user = new UserInfo();
user.setUsername(username);
user.setEmailAddress(getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS));
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
index 300e47b147..c9ad2e182e 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
@@ -30,6 +30,7 @@ public class Constants {
public static final String USER_CLAIM_MODIFIED = "http://wso2.org/claims/modified";
public static final String USER_CLAIM_DEVICES = "http://wso2.org/claims/devices";
public static final String PRIMARY_USER_STORE = "PRIMARY";
+ public static final String APIM_RESERVED_USER = "apim_reserved_user";
public static final String DEFAULT_STREAM_VERSION = "1.0.0";
public static final String SCOPE = "scope";
public static final String JDBC_USERSTOREMANAGER = "org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager";
From d862ab814393edd127439849e319b1ad2d9de2b9 Mon Sep 17 00:00:00 2001
From: navodzoysa
Date: Thu, 22 Jun 2023 19:45:11 +0530
Subject: [PATCH 26/50] Fix incorrect clear app scope
---
.../src/main/resources/conf/mdm-ui-config.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
index 46114821a2..809c856038 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
@@ -224,7 +224,7 @@
perm:admin:tenant:view
perm:admin:metadata:view
perm:admin:usage:view
- perm:android:clear-applicatio
+ perm:android:clear-application
perm:android:suspend-package
perm:android:alternate-install
From 577e3e938414a1d9fe60680104d83e1e72f75cba Mon Sep 17 00:00:00 2001
From: Pahansith
Date: Fri, 23 Jun 2023 20:39:12 +0530
Subject: [PATCH 27/50] Remove unnecessary logs
---
.../CertificateAuthenticator.java | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java
index 6bccefe7ec..031a195007 100644
--- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java
+++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java
@@ -75,31 +75,29 @@ public class CertificateAuthenticator implements WebappAuthenticator {
// When there is a load balancer terminating mutual SSL, it should pass this header along and
// as the value of this header, the client certificate subject dn should be passed.
if (request.getHeader(PROXY_MUTUAL_AUTH_HEADER) != null) {
- log.info("PROXY_MUTUAL_AUTH_HEADER " + request.getHeader(PROXY_MUTUAL_AUTH_HEADER));
+ if (log.isDebugEnabled()) {
+ log.debug("PROXY_MUTUAL_AUTH_HEADER " + request.getHeader(PROXY_MUTUAL_AUTH_HEADER));
+ }
CertificateResponse certificateResponse = AuthenticatorFrameworkDataHolder.getInstance().
getCertificateManagementService().verifySubjectDN(request.getHeader(PROXY_MUTUAL_AUTH_HEADER));
- log.info("clientCertificate" + certificateResponse.getSerialNumber());
- log.info("clientCertificate" + certificateResponse.getCommonName());
authenticationInfo = checkCertificateResponse(certificateResponse);
- log.info("username" + authenticationInfo.getUsername());
+ if (log.isDebugEnabled()) {
+ log.debug("Certificate Serial : " + certificateResponse.getSerialNumber()
+ + ", CN : " + certificateResponse.getCommonName()
+ + " , username" + authenticationInfo.getUsername());
+ }
}
else if (request.getHeader(MUTUAL_AUTH_HEADER) != null) {
- log.info("MUTUAL_AUTH_HEADER");
Object object = request.getAttribute(CLIENT_CERTIFICATE_ATTRIBUTE);
X509Certificate[] clientCertificate = null;
if (object instanceof X509Certificate[]) {
- log.info("clientCertificate");
clientCertificate = (X509Certificate[]) request.
getAttribute(CLIENT_CERTIFICATE_ATTRIBUTE);
}
if (clientCertificate != null && clientCertificate[0] != null) {
CertificateResponse certificateResponse = AuthenticatorFrameworkDataHolder.getInstance().
getCertificateManagementService().verifyPEMSignature(clientCertificate[0]);
- log.info("clientCertificate" + certificateResponse.getSerialNumber());
- log.info("clientCertificate" + certificateResponse.getCommonName());
authenticationInfo = checkCertificateResponse(certificateResponse);
- log.info("username" + authenticationInfo.getUsername());
-
} else {
authenticationInfo.setStatus(Status.FAILURE);
authenticationInfo.setMessage("No client certificate is present");
From 389eb05084034a1b2920e274dd2a27872c71ca8a Mon Sep 17 00:00:00 2001
From: prathabanKavin
Date: Sun, 25 Jun 2023 20:04:36 +0530
Subject: [PATCH 28/50] Add device enrolment log for modifyenrolment
---
.../mgt/core/service/DeviceManagementProviderServiceImpl.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
index 8dcaf1ebca..8043fbe567 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
@@ -466,6 +466,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
if (log.isDebugEnabled()) {
log.debug("Modifying enrollment for device: " + device.getId() + " of type '" + device.getType() + "'");
}
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
+ String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
DeviceManager deviceManager = this.getDeviceManager(device.getType());
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
if (deviceManager == null) {
@@ -494,6 +496,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
enrollmentDAO.updateEnrollment(device.getEnrolmentInfo(), tenantId);
DeviceManagementDAOFactory.commitTransaction();
+ log.info("Device enrolled successfully", deviceEnrolmentLogContextBuilder.setDeviceId(String.valueOf(currentDevice.getId())).setDeviceType(String.valueOf(currentDevice.getType())).setOwner(currentDevice.getEnrolmentInfo().getOwner()).setOwnership(String.valueOf(currentDevice.getEnrolmentInfo().getOwnership())).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).setUserName(userName).build());
this.removeDeviceFromCache(deviceIdentifier);
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
From 6109f58c49d420b868bf827ca809f67e6da86328 Mon Sep 17 00:00:00 2001
From: Oshani Silva
Date: Sun, 25 Jun 2023 19:14:59 +0000
Subject: [PATCH 29/50] Remove unwanted check in billing logic Co-authored-by:
Oshani Silva Co-committed-by: Oshani Silva
---
.../DeviceManagementProviderServiceImpl.java | 25 +++++++++++++------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
index 8dcaf1ebca..0d2a3fb42c 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
@@ -156,6 +156,7 @@ import java.lang.reflect.Type;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
+import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -1069,7 +1070,15 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
dateDiff = endDate.getTime() - device.getEnrolmentInfo().getDateOfEnrolment();
}
}
- long dateInDays = TimeUnit.DAYS.convert(dateDiff, TimeUnit.MILLISECONDS);
+
+ // Convert dateDiff to days as a decimal value
+ double dateDiffInDays = (double) dateDiff / (24 * 60 * 60 * 1000);
+
+ if (dateDiffInDays % 1 >= 0.9) {
+ dateDiffInDays = Math.ceil(dateDiffInDays);
+ }
+
+ long dateInDays = (long) dateDiffInDays;
double cost = (tenantCost.getCost() / 365) * dateInDays;
totalCost += cost;
device.setCost(Math.round(cost * 100.0) / 100.0);
@@ -1136,9 +1145,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
long difference_In_Days = (difference_In_Time / (1000 * 60 * 60 * 24)) % 365;
+ if (difference_In_Time % (1000 * 60 * 60 * 24) >= 0.9 * (1000 * 60 * 60 * 24)) {
+ difference_In_Days++;
+ }
+
for (int i = 1; i <= difference_In_Years; i++) {
List allDevicesPerYear = new ArrayList<>();
- LocalDateTime oneYearAfterStart = startDate.toLocalDateTime().plusYears(1);
+ LocalDateTime oneYearAfterStart = startDate.toLocalDateTime().plusYears(1).with(LocalTime.of(23, 59, 59));;
Timestamp newStartDate;
Timestamp newEndDate;
@@ -1147,14 +1160,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
remainingDaysConsidered = true;
oneYearAfterStart = startDate.toLocalDateTime();
newEndDate = endDate;
- } else if (Timestamp.valueOf(oneYearAfterStart).getTime() >= endDate.getTime()) {
- newEndDate = Timestamp.valueOf(oneYearAfterStart);
} else {
- oneYearAfterStart = startDate.toLocalDateTime().plusYears(1);
+ oneYearAfterStart = startDate.toLocalDateTime().plusYears(1).with(LocalTime.of(23, 59, 59));;
newEndDate = Timestamp.valueOf(oneYearAfterStart);
}
} else {
- oneYearAfterStart = startDate.toLocalDateTime().plusYears(1);
+ oneYearAfterStart = startDate.toLocalDateTime().plusYears(1).with(LocalTime.of(23, 59, 59));;
newEndDate = Timestamp.valueOf(oneYearAfterStart);
}
@@ -1177,7 +1188,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
allDevices.addAll(billingResponse.getDevice());
totalCost = totalCost + billingResponse.getTotalCostPerYear();
deviceCount = deviceCount + billingResponse.getDeviceCount();
- LocalDateTime nextStartDate = oneYearAfterStart.plusDays(1);
+ LocalDateTime nextStartDate = oneYearAfterStart.plusDays(1).with(LocalTime.of(00, 00, 00));
startDate = Timestamp.valueOf(nextStartDate);
}
From 4a31d80660d687f97d48a119a9340b326a28ef8b Mon Sep 17 00:00:00 2001
From: nishan
Date: Thu, 15 Jun 2023 14:12:56 +0530
Subject: [PATCH 30/50] add api for get visible roles
---
.../service/api/RoleManagementService.java | 98 +++++++++++++++++++
.../impl/RoleManagementServiceImpl.java | 93 +++++++++++++++++-
2 files changed, 190 insertions(+), 1 deletion(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java
index 07c2fe962f..8a3e4242cd 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java
@@ -187,6 +187,104 @@ public interface RoleManagementService {
defaultValue = "5")
@QueryParam("limit") int limit);
+ @GET
+ @Path("/visible/{metaKey}")
+ @ApiOperation(
+ produces = MediaType.APPLICATION_JSON,
+ httpMethod = "GET",
+ value = "Getting the List of Visible Roles",
+ notes = "WSO2 IoTS supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 IoTS.\n" +
+ "Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.",
+ tags = "Role Management",
+ extensions = {
+ @Extension(properties = {
+ @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:view")
+ })
+ }
+ )
+ @ApiResponses(value = {
+ @ApiResponse(
+ code = 200,
+ message = "OK. \n Successfully fetched the list of roles in WSO2 IoTS.",
+ response = RoleList.class,
+ responseHeaders = {
+ @ResponseHeader(
+ name = "Content-Type",
+ description = "The content type of the body"),
+ @ResponseHeader(
+ name = "ETag",
+ description = "Entity Tag of the response resource.\n" +
+ "Used by caches, or in conditional requests."),
+ @ResponseHeader(
+ name = "Last-Modified",
+ description = "Date and time the resource has been modified the last time.\n" +
+ "Used by caches, or in conditional requests."),
+ }),
+ @ApiResponse(
+ code = 304,
+ message = "Not Modified. \n Empty body because the client already has the latest version of the " +
+ "requested resource."),
+ @ApiResponse(
+ code = 404,
+ message = "Not Found. \n The specified resource does not exist.\n",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 406,
+ message = "Not Acceptable.\n The requested media type is not supported",
+ response = ErrorResponse.class),
+ @ApiResponse(
+ code = 500,
+ message = "Internal Server Error. \n Server error occurred while fetching the list of roles" +
+ " assigned to the specified user.",
+ response = ErrorResponse.class)
+ })
+ Response getVisibleRole(
+ @ApiParam(
+ name = "filter",
+ value = "Provide a character or a few characters in the role name.",
+ required = false)
+ @QueryParam("filter") String filter,
+ @ApiParam(
+ name = "user-store",
+ value = "The name of the UserStore you wish to get the list of roles.",
+ required = false)
+ @QueryParam("user-store") String userStoreName,
+ @ApiParam(
+ name = "If-Modified-Since",
+ value = "Checks if the requested variant was modified, since the specified date-time." +
+ "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
+ "Example: Mon, 05 Jan 2014 15:10:00 +0200",
+ required = false)
+ @HeaderParam("If-Modified-Since") String ifModifiedSince,
+ @ApiParam(
+ name = "offset",
+ value = "The starting pagination index for the complete list of qualified items.",
+ required = false,
+ defaultValue = "0")
+ @QueryParam("offset") int offset,
+ @ApiParam(
+ name = "limit",
+ value = "Provide how many role details you require from the starting pagination index/offset.",
+ required = false,
+ defaultValue = "5")
+ @QueryParam("limit") int limit,
+ @ApiParam(
+ name = "username",
+ value = "The username of the user.",
+ required = true,
+ defaultValue = "admin")
+ @QueryParam("username") String username,
+ @ApiParam(
+ name = "domain",
+ value = "The domain name of the user store.",
+ required = false)
+ @QueryParam("domain") String domain,
+ @ApiParam(
+ name = "metaKey",
+ value = "Key of the metadata",
+ required = true)
+ @PathParam("metaKey") String metaKey);
+
@GET
@Path("/filter/{prefix}")
@ApiOperation(
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
index 635d89afde..12b0b810da 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
@@ -17,7 +17,13 @@
*/
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
+import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
+import org.apache.axis2.databinding.types.xsd._boolean;
import org.apache.commons.logging.Log;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.base.MultitenantConstants;
@@ -97,6 +103,91 @@ public class RoleManagementServiceImpl implements RoleManagementService {
}
}
+ @GET
+ @Path("/visible/{metaKey}")
+ @Override
+ public Response getVisibleRole(
+ @QueryParam("filter") String filter,
+ @QueryParam("user-store") String userStore,
+ @HeaderParam("If-Modified-Since") String ifModifiedSince,
+ @QueryParam("offset") int offset, @QueryParam("limit") int limit,
+ @QueryParam("username") String username, @QueryParam("domain") String domain,
+ @PathParam("metaKey") String metaKey) {
+ RequestValidationUtil.validatePaginationParameters(offset, limit);
+ if (limit == 0){
+ limit = Constants.DEFAULT_PAGE_LIMIT;
+ }
+ if (domain != null && !domain.isEmpty()) {
+ username = domain + '/' + username;
+ }
+ Metadata metadata;
+ List visibleRoles;
+ RoleList visibleRoleList = new RoleList();
+ try {
+ metadata = DeviceMgtAPIUtils.getMetadataManagementService().retrieveMetadata(metaKey);
+ String metaValue = metadata.getMetaValue();
+ JSONParser parser = new JSONParser();
+ JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
+ boolean decision = (boolean) jsonObject.get("isUserAbleToViewAllRoles");
+ if (decision) {
+ if(userStore == null || "".equals(userStore)){
+ userStore = PRIMARY_USER_STORE;
+ }
+ try{
+ visibleRoles =getRolesFromUserStore(filter, userStore);
+ visibleRoleList.setList(visibleRoles);
+
+ visibleRoles = FilteringUtil.getFilteredList(getRolesFromUserStore(filter, userStore), offset, limit);
+ visibleRoleList.setList(visibleRoles);
+
+ return Response.status(Response.Status.OK).entity(visibleRoleList).build();
+ } catch (UserStoreException e) {
+ String msg = "Error occurred while retrieving roles from the underlying user stores";
+ log.error(msg, e);
+ return Response.serverError().entity(
+ new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
+ }
+ } else {
+ try{UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
+ if (!userStoreManager.isExistingUser(username)) {
+ if (log.isDebugEnabled()) {
+ log.debug("User by username: " + username + " does not exist for role retrieval.");
+ }
+ String msg = "User by username: " + username + " does not exist for role retrieval.";
+ return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
+ }
+ visibleRoleList.setList(getFilteredVisibleRoles(userStoreManager, username));
+
+ return Response.status(Response.Status.OK).entity(visibleRoleList).build();
+ }catch (UserStoreException e) {
+ String msg = "Error occurred while trying to retrieve roles of the user '" + username + "'";
+ log.error(msg, e);
+ return Response.serverError().entity(
+ new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
+ }
+ }
+ } catch (MetadataManagementException e) {
+ String msg = "Error occurred while getting the metadata entry for metaKey:" + metaKey;
+ log.error(msg, e);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private List getFilteredVisibleRoles(UserStoreManager userStoreManager, String username)
+ throws UserStoreException {
+ String[] roleListOfUser;
+ roleListOfUser = userStoreManager.getRoleListOfUser(username);
+ List filteredRoles = new ArrayList<>();
+ for (String role : roleListOfUser) {
+ if (!(role.startsWith("Internal/") || role.startsWith("Authentication/"))) {
+ filteredRoles.add(role);
+ }
+ }
+ return filteredRoles;
+ }
+
@GET
@Path("/filter/{prefix}")
@Override
@@ -597,7 +688,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
userStoreManager.updateUserListOfRole(roleName, usersToDelete, usersToAdd);
return Response.status(Response.Status.OK).entity("Role '" + roleName + "' has " +
- "successfully been updated with the user list")
+ "successfully been updated with the user list")
.build();
} catch (UserStoreException e) {
String msg = "Error occurred while updating the users of the role '" + roleName + "'";
From cd962b8d24b9f02c1475d9e9b5c2bbdfa72c5f87 Mon Sep 17 00:00:00 2001
From: nishan
Date: Mon, 26 Jun 2023 07:28:53 +0530
Subject: [PATCH 31/50] Remove the user has role validation
---
.../application/mgt/core/impl/ApplicationManagerImpl.java | 7 -------
1 file changed, 7 deletions(-)
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
index b7fd8f23b5..1b718fa9d7 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
@@ -3658,13 +3658,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.error(msg);
throw new ApplicationManagementException(msg);
}
- if (!hasUserRole(unrestrictedRoles, userName)) {
- String msg = "You are trying to restrict the visibility of the application for a role set, but "
- + "in order to perform the action at least one role should be assigned to user: "
- + userName;
- log.error(msg);
- throw new BadRequestException(msg);
- }
}
Filter filter = new Filter();
From 763cd7df25ed0b1c299a07056f3adfdb4cdfbf87 Mon Sep 17 00:00:00 2001
From: Pahansith
Date: Mon, 26 Jun 2023 13:43:13 +0530
Subject: [PATCH 32/50] Fix missing imports
---
.../api/service/impl/DeviceManagementConfigServiceImpl.java | 4 ++++
.../core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java | 1 +
2 files changed, 5 insertions(+)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java
index 556baf75e0..c7b191704e 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java
@@ -21,6 +21,10 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.otp.mgt.OTPEmailTypes;
+import io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto.OneTimePinDTO;
+import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService;
import io.entgra.device.mgt.core.device.mgt.config.api.beans.ErrorResponse;
import io.entgra.device.mgt.core.device.mgt.config.api.service.DeviceManagementConfigService;
import io.entgra.device.mgt.core.device.mgt.config.api.util.DeviceMgtAPIUtils;
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java
index 419a72549b..e5755cd999 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java
@@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl;
+import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException;
From 7073deb4619c601b52b4487df5d5560c780e818c Mon Sep 17 00:00:00 2001
From: navodzoysa
Date: Mon, 26 Jun 2023 14:15:29 +0530
Subject: [PATCH 33/50] Fix skip app release error
---
.../application/mgt/core/impl/ApplicationManagerImpl.java | 6 +++---
.../device/mgt/core/application/mgt/core/util/APIUtil.java | 3 +--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
index b7fd8f23b5..51dc57868d 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
@@ -1283,13 +1283,13 @@ public class ApplicationManagerImpl implements ApplicationManager {
this.changeLifecycleState(applicationReleaseDTO, lifecycleChanger);
}
}
+ if (applicationDTO.getType().equals("ENTERPRISE") || applicationDTO.getType().equals("PUBLIC") ) {
+ persistAppIconInfo(applicationReleaseDTO);
+ }
applicationReleaseEntities.add(applicationReleaseDTO);
}
applicationDTO.setId(appId);
applicationDTO.setApplicationReleaseDTOs(applicationReleaseEntities);
- if (applicationDTO.getType().equals("ENTERPRISE") || applicationDTO.getType().equals("PUBLIC") ) {
- persistAppIconInfo(applicationReleaseDTO);
- }
return APIUtil.appDtoToAppResponse(applicationDTO);
}
} catch (LifeCycleManagementDAOException e) {
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java
index 407b4ebcac..b33fce5bf2 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java
@@ -521,7 +521,6 @@ public class APIUtil {
public static String createAppIconPath(ApplicationReleaseDTO applicationReleaseDTO, int tenantId) throws ApplicationManagementException {
String basePath = getArtifactDownloadBaseURL() + tenantId + Constants.FORWARD_SLASH + applicationReleaseDTO
.getAppHashValue() + Constants.FORWARD_SLASH;
- String iconPath = basePath + Constants.ICON_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO.getIconName();
- return iconPath;
+ return basePath + Constants.ICON_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO.getIconName();
}
}
From d5270c720c394df20484b0f2b8936ffc49453d95 Mon Sep 17 00:00:00 2001
From: rajitha
Date: Tue, 27 Jun 2023 13:26:05 +0530
Subject: [PATCH 34/50] Update invite link
---
.../mgt/service/OTPManagementServiceImpl.java | 19 -------------------
.../email/templates/user-enrollment.vm | 2 +-
2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
index ebf75b841e..d8872be921 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java
@@ -237,9 +237,6 @@ public class OTPManagementServiceImpl implements OTPManagementService {
}
}
}
- int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
- OneTimePinDTO oneTimePinDTO;
- List oneTimePinDTOList = new ArrayList<>();
Properties props = new Properties();
props.setProperty("enrollment-steps", enrollmentSteps.toString());
try {
@@ -247,22 +244,11 @@ public class OTPManagementServiceImpl implements OTPManagementService {
for (String username : deviceEnrollmentInvitation.getUsernames()) {
String emailAddress = DeviceManagerUtil.getUserClaimValue(
username, DeviceManagementConstants.User.CLAIM_EMAIL_ADDRESS);
-
- OneTimePinDTO oneTimePinData = new OneTimePinDTO();
- oneTimePinData.setEmail(emailAddress);
- oneTimePinData.setTenantId(tenantId);
- oneTimePinData.setUsername(username);
- oneTimePinData.setEmailType(OTPEmailTypes.USER_INVITE.toString());
-
- oneTimePinDTO = generateOneTimePin(oneTimePinData, false);
- oneTimePinDTOList.add(oneTimePinDTO);
props.setProperty("first-name", DeviceManagerUtil.
getUserClaimValue(username, DeviceManagementConstants.User.CLAIM_FIRST_NAME));
props.setProperty("username", username);
- props.setProperty("otp-token", oneTimePinDTO.getOtpToken());
sendMail(props, emailAddress, DeviceManagementConstants.EmailAttributes.USER_ENROLLMENT_TEMPLATE);
}
- this.otpManagementDAO.addOTPData(oneTimePinDTOList);
ConnectionManagerUtil.commitDBTransaction();
} catch (UserStoreException e) {
String msg = "Error occurred while getting claim values to invite user";
@@ -276,11 +262,6 @@ public class OTPManagementServiceImpl implements OTPManagementService {
String msg = "SQL Error occurred when adding OPT data to send device enrollment Invitation.";
log.error(msg, e);
throw new OTPManagementException(msg, e);
- } catch (OTPManagementDAOException e) {
- ConnectionManagerUtil.rollbackDBTransaction();
- String msg = "Error occurred while saving the OTP data.";
- log.error(msg, e);
- throw new OTPManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm
index 7765bcdda2..ef5307de33 100644
--- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm
+++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/src/main/resources/email/templates/user-enrollment.vm
@@ -37,7 +37,7 @@
You have been invited to enrol your device in Entgra IoT Server.
- Click here to begin device enrolment.
+ Click here to begin device enrolment.
Enrollment Steps are as below,
From 498dc7ae340c6c864905484f6103515485c82584 Mon Sep 17 00:00:00 2001
From: Thilina Sandaruwan
Date: Tue, 27 Jun 2023 08:57:23 +0000
Subject: [PATCH 35/50] HierarchicalGrouping (#153)
Goals
Complete hierarchical grouping task
https://roadmap.entgra.net/issues/9528 and https://roadmap.entgra.net/issues/9529
Approach
Fix the encountered issues
Co-authored-by: ThilinaPremachandra
Co-authored-by: Pahansith Gunathilake
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/153
Co-authored-by: Thilina Sandaruwan
Co-committed-by: Thilina Sandaruwan
---
.../core/device/mgt/core/dao/GroupDAO.java | 13 ++++
.../core/dao/impl/AbstractGroupDAOImpl.java | 78 +++++++++++++++++--
.../GroupManagementProviderServiceImpl.java | 14 +++-
3 files changed, 97 insertions(+), 8 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
index e1639e6262..fe639e63e1 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
@@ -212,6 +212,19 @@ public interface GroupDAO {
*/
List getGroups(GroupPaginationRequest paginationRequest, int tenantId) throws GroupManagementDAOException;
+ /**
+ * Get paginated list of Device Groups in tenant with specified device group ids.
+ *
+ * @param paginationRequest to filter results.
+ * @param deviceGroupIds of groups required.
+ * @param tenantId of user's tenant.
+ * @param isWithParentPath of user's ParentPath.
+ * @return List of all Device Groups in tenant.
+ * @throws GroupManagementDAOException
+ */
+ List getGroups(GroupPaginationRequest paginationRequest, List deviceGroupIds,
+ int tenantId, boolean isWithParentPath) throws GroupManagementDAOException;
+
/**
* Get paginated list of Device Groups in tenant with specified device group ids.
*
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
index 937b975259..480bc735b0 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
@@ -108,7 +108,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
@Override
public List getGroups(GroupPaginationRequest request, List deviceGroupIds,
- int tenantId) throws GroupManagementDAOException {
+ int tenantId) throws GroupManagementDAOException {
int deviceGroupIdsCount = deviceGroupIds.size();
if (deviceGroupIdsCount == 0) {
return new ArrayList<>();
@@ -169,6 +169,73 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
throw new GroupManagementDAOException(msg, e);
}
}
+ @Override
+ public List getGroups(GroupPaginationRequest request, List deviceGroupIds,
+ int tenantId, boolean isWithParentPath) throws GroupManagementDAOException {
+ int deviceGroupIdsCount = deviceGroupIds.size();
+ if (deviceGroupIdsCount == 0) {
+ return new ArrayList<>();
+ }
+
+ try {
+ Connection conn = GroupManagementDAOFactory.getConnection();
+ String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP WHERE TENANT_ID = ?";
+ if (StringUtils.isNotBlank(request.getGroupName())) {
+ sql += " AND GROUP_NAME LIKE ?";
+ }
+ if (StringUtils.isNotBlank(request.getOwner())) {
+ sql += " AND OWNER LIKE ?";
+ }
+ if (StringUtils.isNotBlank(request.getParentPath())) {
+ if(isWithParentPath){
+ sql += " AND PARENT_PATH LIKE ?";
+ }
+ }
+ sql += " AND ID IN (";
+ for (int i = 0; i < deviceGroupIdsCount; i++) {
+ sql += (deviceGroupIdsCount - 1 != i) ? "?," : "?";
+ }
+ sql += ")";
+ if (request.getRowCount() != 0) {
+ sql += " LIMIT ? OFFSET ?";
+ }
+
+ try (PreparedStatement stmt = conn.prepareStatement(sql)) {
+ int paramIndex = 1;
+ stmt.setInt(paramIndex++, tenantId);
+ if (StringUtils.isNotBlank(request.getGroupName())) {
+ stmt.setString(paramIndex++, request.getGroupName() + "%");
+ }
+ if (StringUtils.isNotBlank(request.getOwner())) {
+ stmt.setString(paramIndex++, request.getOwner() + "%");
+ }
+ if (StringUtils.isNotBlank(request.getParentPath())) {
+ if(isWithParentPath){
+ stmt.setString(paramIndex++, request.getParentPath());
+ }
+ }
+ for (Integer deviceGroupId : deviceGroupIds) {
+ stmt.setInt(paramIndex++, deviceGroupId);
+ }
+ if (request.getRowCount() != 0) {
+ stmt.setInt(paramIndex++, request.getRowCount());
+ stmt.setInt(paramIndex, request.getStartIndex());
+ }
+ List deviceGroupList = new ArrayList<>();
+ try (ResultSet resultSet = stmt.executeQuery()) {
+ while (resultSet.next()) {
+ deviceGroupList.add(GroupManagementDAOUtil.loadGroup(resultSet));
+ }
+ }
+ return deviceGroupList;
+ }
+ } catch (SQLException e) {
+ String msg = "Error occurred while retrieving groups of groups IDs " + deviceGroupIds.toString()
+ + " in tenant: " + tenantId;
+ log.error(msg);
+ throw new GroupManagementDAOException(msg, e);
+ }
+ }
@Override
public int addGroup(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException {
@@ -376,7 +443,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
try {
Connection conn = GroupManagementDAOFactory.getConnection();
String sql = "UPDATE DM_GROUP SET DESCRIPTION = ?, GROUP_NAME = ?, OWNER = ?, STATUS = ?, "
- + "PARENT_PATH = ? WHERE ID = ? AND TENANT_ID = ?";
+ + "PARENT_PATH = ?, PARENT_GROUP_ID = ? WHERE ID = ? AND TENANT_ID = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)){
for (DeviceGroup deviceGroup : deviceGroups) {
stmt.setString(1, deviceGroup.getDescription());
@@ -384,8 +451,9 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
stmt.setString(3, deviceGroup.getOwner());
stmt.setString(4, deviceGroup.getStatus());
stmt.setString(5, deviceGroup.getParentPath());
- stmt.setInt(6, deviceGroup.getGroupId());
- stmt.setInt(7, tenantId);
+ stmt.setInt(6, deviceGroup.getParentGroupId());
+ stmt.setInt(7, deviceGroup.getGroupId());
+ stmt.setInt(8, tenantId);
stmt.addBatch();
}
stmt.executeBatch();
@@ -1201,7 +1269,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
}
- @Override
+ @Override
public List getAllDevicesOfGroup(String groupName, int tenantId) throws GroupManagementDAOException {
Connection conn;
List devices;
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index be1ad0d545..3b83d49c01 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -312,6 +312,13 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
newParentPath = DeviceGroupConstants.HierarchicalGroup.SEPERATOR;
}
childrenGroup.setParentPath(newParentPath);
+ if (!newParentPath.equals(DeviceGroupConstants.HierarchicalGroup.SEPERATOR)) {
+ String[] groupIds = newParentPath.split(DeviceGroupConstants.HierarchicalGroup.SEPERATOR);
+ int latestGroupId = Integer.parseInt(groupIds[groupIds.length - 1]);
+ childrenGroup.setParentGroupId(latestGroupId);
+ } else {
+ childrenGroup.setParentGroupId(0);
+ }
}
}
}
@@ -518,7 +525,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
@Override
public PaginationResult getGroupsWithHierarchy(String username, GroupPaginationRequest request,
- boolean requireGroupProps) throws GroupManagementException {
+ boolean requireGroupProps) throws GroupManagementException {
if (request == null) {
String msg = "Received incomplete data for retrieve groups with hierarchy";
log.error(msg);
@@ -527,6 +534,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
if (log.isDebugEnabled()) {
log.debug("Get groups with hierarchy " + request.toString());
}
+ boolean isWithParentPath = false;
DeviceManagerUtil.validateGroupListPageSize(request);
List rootGroups;
try {
@@ -538,7 +546,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} else {
List allDeviceGroupIdsOfUser = getGroupIds(username);
GroupManagementDAOFactory.openConnection();
- rootGroups = this.groupDAO.getGroups(request, allDeviceGroupIdsOfUser, tenantId);
+ rootGroups = this.groupDAO.getGroups(request, allDeviceGroupIdsOfUser, tenantId, isWithParentPath);
}
String parentPath;
List childrenGroups;
@@ -1359,7 +1367,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
* @throws GroupManagementDAOException on error during population of group properties.
*/
private void createGroupWithChildren(DeviceGroup parentGroup, List childrenGroups,
- boolean requireGroupProps, int tenantId, int depth, int counter) throws GroupManagementDAOException {
+ boolean requireGroupProps, int tenantId, int depth, int counter) throws GroupManagementDAOException {
if (childrenGroups.isEmpty() || depth == counter) {
return;
}
From 3616245ae65dbcacf762ad8f14a9a887eed3f7f9 Mon Sep 17 00:00:00 2001
From: Nishan Sangeeth
Date: Wed, 28 Jun 2023 16:00:53 +0000
Subject: [PATCH 36/50] Improve app visibility restricting functionality
Co-authored-by: Nishan Sangeeth Co-committed-by: Nishan
Sangeeth
---
.../common/services/ApplicationManager.java | 1 +
.../mgt/core/impl/ApplicationManagerImpl.java | 45 ++++++++++++++++++-
.../application/mgt/core/util/APIUtil.java | 18 ++++++++
.../application/mgt/core/util/Constants.java | 3 +-
.../impl/RoleManagementServiceImpl.java | 24 +++++-----
.../device/mgt/api/jaxrs/util/Constants.java | 1 +
6 files changed, 80 insertions(+), 12 deletions(-)
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java
index 88a6912a7d..0c75b3b284 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java
@@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.application.mgt.common.response.Category;
import io.entgra.device.mgt.core.application.mgt.common.response.Tag;
import io.entgra.device.mgt.core.device.mgt.common.Base64File;
import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO;
+import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact;
import io.entgra.device.mgt.core.application.mgt.common.LifecycleChanger;
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
index 09644ff733..3bb8ba8260 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
@@ -22,6 +22,8 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestExcept
import io.entgra.device.mgt.core.device.mgt.common.Base64File;
import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO;
import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil;
+import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringEscapeUtils;
@@ -30,6 +32,7 @@ import org.apache.commons.validator.routines.UrlValidator;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.json.JSONObject;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact;
@@ -95,6 +98,7 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
+import javax.ws.rs.core.Response;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -1713,6 +1717,31 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
}
+ /**
+ * Check whether valid metaData value or not
+ *
+ * @return true or false
+ * @throws MetadataManagementException If it is unable to load metaData
+ */
+ private boolean isUserAbleToViewAllRoles() throws MetadataManagementException {
+ List allMetadata;
+ allMetadata = APIUtil.getMetadataManagementService().retrieveAllMetadata();
+ if (allMetadata != null && !allMetadata.isEmpty()) {
+ for(Metadata metadata : allMetadata){
+ if(Constants.SHOW_ALL_ROLES.equals(metadata.getMetaKey())){
+ String metaValue = metadata.getMetaValue();
+ if (metaValue != null) {
+ JSONObject jsonObject;
+ jsonObject = new JSONObject(metaValue);
+ boolean isUserAbleToViewAllRoles = jsonObject.getBoolean(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
+ return isUserAbleToViewAllRoles;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
/**
* Get assigned role list of the given user.
*
@@ -3486,7 +3515,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
@Override
- public void validateAppCreatingRequest(T param) throws ApplicationManagementException, RequestValidatingException {
+ public void validateAppCreatingRequest(T param)
+ throws ApplicationManagementException, RequestValidatingException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
int deviceTypeId = -1;
@@ -3658,6 +3688,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.error(msg);
throw new ApplicationManagementException(msg);
}
+ if (!isUserAbleToViewAllRoles()) {
+ if (!hasUserRole(unrestrictedRoles, userName)) {
+ String msg = "You are trying to restrict the visibility of the application for a role set, but "
+ + "in order to perform the action at least one role should be assigned to user: "
+ + userName;
+ log.error(msg);
+ throw new BadRequestException(msg);
+ }
+ }
}
Filter filter = new Filter();
@@ -3709,6 +3748,10 @@ public class ApplicationManagerImpl implements ApplicationManager {
String msg = "Error occurred when validating the unrestricted roles given for the web clip";
log.error(msg, e);
throw new ApplicationManagementException(msg, e);
+ } catch (MetadataManagementException e) {
+ String msg = "Error occurred while retrieving metadata list";
+ log.error(msg, e);
+ throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java
index b33fce5bf2..955a642b6f 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java
@@ -26,6 +26,7 @@ import io.entgra.device.mgt.core.application.mgt.core.config.IdentityServiceProv
import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceProviderApplicationService;
import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException;
import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException;
+import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -71,6 +72,7 @@ public class APIUtil {
private static volatile SubscriptionManager subscriptionManager;
private static volatile ReviewManager reviewManager;
private static volatile AppmDataHandler appmDataHandler;
+ private static volatile MetadataManagementService metadataManagementService;
public static SPApplicationManager getSPApplicationManager() {
if (SPApplicationManager == null) {
@@ -523,4 +525,20 @@ public class APIUtil {
.getAppHashValue() + Constants.FORWARD_SLASH;
return basePath + Constants.ICON_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO.getIconName();
}
+
+ public static MetadataManagementService getMetadataManagementService() {
+ if (metadataManagementService == null) {
+ synchronized (APIUtil.class) {
+ if (metadataManagementService == null) {
+ PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
+ metadataManagementService = (MetadataManagementService) ctx.getOSGiService(
+ MetadataManagementService.class, null);
+ if (metadataManagementService == null) {
+ throw new IllegalStateException("Metadata Management service not initialized.");
+ }
+ }
+ }
+ }
+ return metadataManagementService;
+ }
}
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java
index 5864242acf..efd848cdb1 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java
@@ -70,7 +70,8 @@ public class Constants {
public static final String ANY = "ANY";
public static final String DEFAULT_PCK_NAME = "default.app.com";
public static final String ALL = "ALL";
-
+ public static final String SHOW_ALL_ROLES = "SHOW_ALL_ROLES";
+ public static final String IS_USER_ABLE_TO_VIEW_ALL_ROLES = "isUserAbleToViewAllRoles";
public static final String GOOGLE_PLAY_STORE_URL = "https://play.google.com/store/apps/details?id=";
public static final String APPLE_STORE_URL = "https://itunes.apple.com/country/app/app-name/id";
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
index 12b0b810da..099473ad0d 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
@@ -19,7 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
-import org.apache.axis2.databinding.types.xsd._boolean;
import org.apache.commons.logging.Log;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@@ -110,8 +109,10 @@ public class RoleManagementServiceImpl implements RoleManagementService {
@QueryParam("filter") String filter,
@QueryParam("user-store") String userStore,
@HeaderParam("If-Modified-Since") String ifModifiedSince,
- @QueryParam("offset") int offset, @QueryParam("limit") int limit,
- @QueryParam("username") String username, @QueryParam("domain") String domain,
+ @QueryParam("offset") int offset,
+ @QueryParam("limit") int limit,
+ @QueryParam("username") String username,
+ @QueryParam("domain") String domain,
@PathParam("metaKey") String metaKey) {
RequestValidationUtil.validatePaginationParameters(offset, limit);
if (limit == 0){
@@ -128,13 +129,13 @@ public class RoleManagementServiceImpl implements RoleManagementService {
String metaValue = metadata.getMetaValue();
JSONParser parser = new JSONParser();
JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
- boolean decision = (boolean) jsonObject.get("isUserAbleToViewAllRoles");
+ boolean decision = (boolean) jsonObject.get(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
if (decision) {
- if(userStore == null || "".equals(userStore)){
+ if (userStore == null || "".equals(userStore)){
userStore = PRIMARY_USER_STORE;
}
- try{
- visibleRoles =getRolesFromUserStore(filter, userStore);
+ try {
+ visibleRoles = getRolesFromUserStore(filter, userStore);
visibleRoleList.setList(visibleRoles);
visibleRoles = FilteringUtil.getFilteredList(getRolesFromUserStore(filter, userStore), offset, limit);
@@ -148,7 +149,8 @@ public class RoleManagementServiceImpl implements RoleManagementService {
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
} else {
- try{UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
+ try {
+ UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
if (!userStoreManager.isExistingUser(username)) {
if (log.isDebugEnabled()) {
log.debug("User by username: " + username + " does not exist for role retrieval.");
@@ -159,7 +161,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
visibleRoleList.setList(getFilteredVisibleRoles(userStoreManager, username));
return Response.status(Response.Status.OK).entity(visibleRoleList).build();
- }catch (UserStoreException e) {
+ } catch (UserStoreException e) {
String msg = "Error occurred while trying to retrieve roles of the user '" + username + "'";
log.error(msg, e);
return Response.serverError().entity(
@@ -171,7 +173,9 @@ public class RoleManagementServiceImpl implements RoleManagementService {
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (ParseException e) {
- throw new RuntimeException(e);
+ String msg = "Error occurred while parsing JSON metadata: " + e.getMessage();
+ log.error(msg, e);
+ return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
index c9ad2e182e..02d332baf2 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
@@ -38,6 +38,7 @@ public class Constants {
public static final int DEFAULT_PAGE_LIMIT = 50;
public static final String FORWARD_SLASH = "/";
public static final String ANDROID = "android";
+ public static final String IS_USER_ABLE_TO_VIEW_ALL_ROLES = "isUserAbleToViewAllRoles";
public static final String ANDROID_POLICY_VALIDATOR = "io.entgra.proprietary.uem.platform.android." +
"core.polcy.AndroidPolicyPayloadValidator";
public static final String IOS = "ios";
From 8d9e3c8f5140da840cd9af841f38619b4b0bbdcc Mon Sep 17 00:00:00 2001
From: navodzoysa
Date: Thu, 29 Jun 2023 00:28:34 +0530
Subject: [PATCH 37/50] Remove reserved_user when fetching users
---
.../api/jaxrs/service/impl/UserManagementServiceImpl.java | 5 +++--
.../device/mgt/core/device/mgt/api/jaxrs/util/Constants.java | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java
index 29a64a9238..71528bf32d 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java
@@ -455,7 +455,7 @@ public class UserManagementServiceImpl implements UserManagementService {
userList = new ArrayList<>(users.size());
BasicUserInfo user;
for (String username : users) {
- if (Constants.APIM_RESERVED_USER.equals(username)) {
+ if (Constants.APIM_RESERVED_USER.equals(username) || Constants.RESERVED_USER.equals(username)) {
continue;
}
user = getBasicUserInfo(username);
@@ -520,6 +520,7 @@ public class UserManagementServiceImpl implements UserManagementService {
}
if (commonUsers != null) {
commonUsers.remove(Constants.APIM_RESERVED_USER);
+ commonUsers.remove(Constants.RESERVED_USER);
}
if (!skipSearch(commonUsers) && StringUtils.isNotEmpty(firstName)) {
@@ -695,7 +696,7 @@ public class UserManagementServiceImpl implements UserManagementService {
userList = new ArrayList<>();
UserInfo user;
for (String username : users) {
- if (Constants.APIM_RESERVED_USER.equals(username)) {
+ if (Constants.APIM_RESERVED_USER.equals(username) || Constants.RESERVED_USER.equals(username)) {
continue;
}
user = new UserInfo();
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
index 02d332baf2..0a9b6efa26 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/Constants.java
@@ -31,7 +31,8 @@ public class Constants {
public static final String USER_CLAIM_DEVICES = "http://wso2.org/claims/devices";
public static final String PRIMARY_USER_STORE = "PRIMARY";
public static final String APIM_RESERVED_USER = "apim_reserved_user";
- public static final String DEFAULT_STREAM_VERSION = "1.0.0";
+ public static final String RESERVED_USER = "reserved_user";
+ public static final String DEFAULT_STREAM_VERSION = "1.0.0";
public static final String SCOPE = "scope";
public static final String JDBC_USERSTOREMANAGER = "org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager";
public static final String DEFAULT_SIMPLE_DATE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
From 87de656571a7d78284cd1e7baa837c9a2759dedf Mon Sep 17 00:00:00 2001
From: Kavin Prathaban
Date: Fri, 30 Jun 2023 06:32:38 +0000
Subject: [PATCH 38/50] Add footer config template
## Purpose
* Fixes https://roadmap.entgra.net/issues/10180
## Description
* cdm-config.xml.j2, cdm-config.xml templates are updated from hardcoded values to retrieve values from deployment.toml
* server_name, server_version and current_year are added as variables
* **Usage:** change deployment.toml values when a new version released. This will update the footer
## Related PRs
* https://repository.entgra.net/proprietary/product-uem/pulls/15
Co-authored-by: prathabanKavin
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/160
Co-authored-by: Kavin Prathaban
Co-committed-by: Kavin Prathaban
---
.../src/main/resources/conf/cdm-config.xml | 2 +-
.../templates/repository/conf/cdm-config.xml.j2 | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml
index 3ce48daefe..c40cefc413 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml
@@ -189,7 +189,7 @@
<a href='https://entgra.io' target='_blank'>
Entgra
</a>
- IoT Server 5.2.0 | © 2023
+ UEM Server 5.3.0 | © 2023
, All Rights Reserved.
Entgra
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2
index 262761caec..2152b1814f 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2
@@ -325,12 +325,16 @@
- <a href='https://entgra.io' target='_blank'>
- Entgra
- </a>
- IoT Server 5.2.0 | © 2023
- , All Rights Reserved.
-
+ <a href='https://entgra.io' target='_blank'>
+ Entgra
+ </a>
+ {% if product_conf is defined %}
+ {{product_conf.server_name}} {{product_conf.server_version}} | © {{product_conf.current_year}}
+ {% else %}
+ Entgra UEM Server
+ {% endif %}
+ , All Rights Reserved.
+
Entgra
repository/resources/whitelabel
From 39f5ee8ca391ce1bc45b909a2931c56ba213d7e7 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Sat, 1 Jul 2023 21:06:29 +0530
Subject: [PATCH 39/50] fix: sub tenants grouping issue
---
.../admin/GroupManagementAdminServiceImpl.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
index 4495a3fe9c..656eb857bc 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
@@ -32,6 +32,7 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.GroupMan
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils;
import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.apache.commons.lang.StringUtils;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
@@ -94,13 +95,22 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
@DefaultValue("5") @QueryParam("limit") int limit) {
try {
RequestValidationUtil.validatePaginationParameters(offset, limit);
+ String currentUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
GroupPaginationRequest request = new GroupPaginationRequest(offset, limit);
request.setGroupName(name);
request.setOwner(owner);
request.setStatus(status);
request.setDepth(depth);
- PaginationResult deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
- .getGroupsWithHierarchy(null, request, requireGroupProps);
+
+ PaginationResult deviceGroupsResult;
+ if (StringUtils.isBlank(currentUser)) {
+ deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
+ .getGroupsWithHierarchy(null, request, requireGroupProps);
+ } else {
+ deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
+ .getGroupsWithHierarchy(currentUser, request, requireGroupProps);
+ }
+
DeviceGroupList deviceGroupList = new DeviceGroupList();
deviceGroupList.setList(deviceGroupsResult.getData());
deviceGroupList.setCount(deviceGroupsResult.getRecordsTotal());
From aecc106f95319fb73d216c6ff0197b94f8a540b1 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Sun, 2 Jul 2023 01:23:13 +0530
Subject: [PATCH 40/50] add: super-tenant admin check
---
.../service/impl/admin/GroupManagementAdminServiceImpl.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
index 656eb857bc..3e8df2c98a 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
@@ -101,9 +101,10 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
request.setOwner(owner);
request.setStatus(status);
request.setDepth(depth);
+ boolean isAdmin = DEFAULT_ADMIN_ROLE.equals(currentUser);
PaginationResult deviceGroupsResult;
- if (StringUtils.isBlank(currentUser)) {
+ if (StringUtils.isBlank(currentUser) || isAdmin) {
deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
.getGroupsWithHierarchy(null, request, requireGroupProps);
} else {
From 6d012bc614a7a31d72d948fd0bc65325f2ece7c3 Mon Sep 17 00:00:00 2001
From: ThilinaPremachandra
Date: Mon, 3 Jul 2023 18:53:34 +0530
Subject: [PATCH 41/50] fix: group assigned role issue
---
.../impl/GroupManagementServiceImpl.java | 22 +++++++++++++++++--
.../GroupManagementAdminServiceImpl.java | 16 +++++++++++---
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
index 1c077c00a5..6c75b3fb5e 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
@@ -29,6 +29,7 @@ import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistExc
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import io.entgra.device.mgt.core.device.mgt.common.Device;
import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier;
@@ -48,6 +49,8 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestV
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils;
import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint;
import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException;
+import org.wso2.carbon.user.api.UserRealm;
+import org.wso2.carbon.user.api.UserStoreException;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
@@ -56,6 +59,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
public class GroupManagementServiceImpl implements GroupManagementService {
@@ -109,8 +113,18 @@ public class GroupManagementServiceImpl implements GroupManagementService {
request.setGroupName(name);
request.setOwner(owner);
request.setDepth(depth);
- PaginationResult deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
- .getGroupsWithHierarchy(currentUser, request, requireGroupProps);
+ int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
+ UserRealm realmService = DeviceMgtAPIUtils.getRealmService().getTenantUserRealm(tenantId);
+ String[] roles = realmService.getUserStoreManager().getRoleListOfUser(currentUser);
+ boolean hasAdminRole = Arrays.asList(roles).contains(DEFAULT_ADMIN_ROLE);
+ PaginationResult deviceGroupsResult;
+ if (hasAdminRole) {
+ deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
+ .getGroupsWithHierarchy(null, request, requireGroupProps);
+ } else{
+ deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
+ .getGroupsWithHierarchy(currentUser, request, requireGroupProps);
+ }
DeviceGroupList deviceGroupList = new DeviceGroupList();
deviceGroupList.setList(deviceGroupsResult.getData());
deviceGroupList.setCount(deviceGroupsResult.getRecordsTotal());
@@ -119,6 +133,10 @@ public class GroupManagementServiceImpl implements GroupManagementService {
String error = "Error occurred while retrieving groups with hierarchy.";
log.error(error, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
+ } catch (UserStoreException e) {
+ String msg = "Error occurred while getting user realm.";
+ log.error(msg, e);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
index 3e8df2c98a..e9277825ed 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
@@ -31,8 +31,11 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.GroupManagementAdminService;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils;
+import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.apache.commons.lang.StringUtils;
+import org.wso2.carbon.user.api.UserRealm;
+import org.wso2.carbon.user.api.UserStoreException;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
@@ -41,6 +44,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
+import java.util.Arrays;
public class GroupManagementAdminServiceImpl implements GroupManagementAdminService {
@@ -101,17 +105,19 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
request.setOwner(owner);
request.setStatus(status);
request.setDepth(depth);
+ int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
+ UserRealm realmService = DeviceMgtAPIUtils.getRealmService().getTenantUserRealm(tenantId);
+ String[] roles = realmService.getUserStoreManager().getRoleListOfUser(currentUser);
boolean isAdmin = DEFAULT_ADMIN_ROLE.equals(currentUser);
-
+ boolean hasAdminRole = Arrays.asList(roles).contains(DEFAULT_ADMIN_ROLE);
PaginationResult deviceGroupsResult;
- if (StringUtils.isBlank(currentUser) || isAdmin) {
+ if (StringUtils.isBlank(currentUser) || isAdmin || hasAdminRole) {
deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
.getGroupsWithHierarchy(null, request, requireGroupProps);
} else {
deviceGroupsResult = DeviceMgtAPIUtils.getGroupManagementProviderService()
.getGroupsWithHierarchy(currentUser, request, requireGroupProps);
}
-
DeviceGroupList deviceGroupList = new DeviceGroupList();
deviceGroupList.setList(deviceGroupsResult.getData());
deviceGroupList.setCount(deviceGroupsResult.getRecordsTotal());
@@ -120,6 +126,10 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
String error = "Error occurred while retrieving groups with hierarchy.";
log.error(error, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
+ } catch (UserStoreException e) {
+ String msg = "Error occurred while getting user realm.";
+ log.error(msg, e);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
From 5818a5eaed7123c95ab824feb25f7b1e58cc8f33 Mon Sep 17 00:00:00 2001
From: rajitha
Date: Tue, 4 Jul 2023 18:37:39 +0530
Subject: [PATCH 42/50] Fix transaction initiating issue
---
.../device/mgt/core/operation/mgt/OperationManagerImpl.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
index 51b93d5fdd..d3137c006f 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
@@ -480,6 +480,7 @@ public class OperationManagerImpl implements OperationManager {
int failAttempts = 0;
while (true) {
try {
+ OperationManagementDAOFactory.beginTransaction();
operationMappingDAO.updateOperationMapping(operation.getId(), device.getEnrolmentInfo().getId(),
io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED);
OperationManagementDAOFactory.commitTransaction();
@@ -502,6 +503,11 @@ public class OperationManagerImpl implements OperationManager {
} catch (InterruptedException ignore) {
break;
}
+ } catch (TransactionManagementException ex) {
+ log.error("Error occurred while initiating the transaction", ex);
+ break;
+ } finally {
+ OperationManagementDAOFactory.closeConnection();
}
}
} catch (Exception e) {
From 67cdcede699fa541495557db32a6cb5a6f091570 Mon Sep 17 00:00:00 2001
From: rajitha
Date: Wed, 5 Jul 2023 20:01:06 +0530
Subject: [PATCH 43/50] Fix realm service unbinding issues
---
.../APIApplicationManagerExtensionDataHolder.java | 13 +++++++------
.../publisher/internal/APIPublisherDataHolder.java | 13 +++++++------
.../internal/JWTClientExtensionDataHolder.java | 13 +++++++------
3 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java
index 8a4cf4f1a6..299184c946 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionDataHolder.java
@@ -62,17 +62,18 @@ public class APIApplicationManagerExtensionDataHolder {
public void setRealmService(RealmService realmService) {
this.realmService = realmService;
- this.setTenantManager(realmService);
+ setTenantManager(realmService != null ?
+ realmService.getTenantManager() : null);
}
- private void setTenantManager(RealmService realmService) {
- if (realmService == null) {
- throw new IllegalStateException("Realm service is not initialized properly");
- }
- this.tenantManager = realmService.getTenantManager();
+ private void setTenantManager(TenantManager tenantManager) {
+ this.tenantManager = tenantManager;
}
public TenantManager getTenantManager() {
+ if (tenantManager == null) {
+ throw new IllegalStateException("Tenant manager is not initialized properly");
+ }
return tenantManager;
}
diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java
index baff1848ed..bc7b8af32c 100644
--- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java
+++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherDataHolder.java
@@ -75,17 +75,18 @@ public class APIPublisherDataHolder {
public void setRealmService(RealmService realmService) {
this.realmService = realmService;
- this.setTenantManager(realmService);
+ setTenantManager(realmService != null ?
+ realmService.getTenantManager() : null);
}
- private void setTenantManager(RealmService realmService) {
- if (realmService == null) {
- throw new IllegalStateException("Realm service is not initialized properly");
- }
- this.tenantManager = realmService.getTenantManager();
+ private void setTenantManager(TenantManager tenantManager) {
+ this.tenantManager = tenantManager;
}
public TenantManager getTenantManager() {
+ if (tenantManager == null) {
+ throw new IllegalStateException("Tenant manager is not initialized properly");
+ }
return tenantManager;
}
diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionDataHolder.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionDataHolder.java
index 7d253b2333..cd3999c9bf 100644
--- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionDataHolder.java
+++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionDataHolder.java
@@ -74,17 +74,18 @@ public class JWTClientExtensionDataHolder {
public void setRealmService(RealmService realmService) {
this.realmService = realmService;
- this.setTenantManager(realmService);
+ setTenantManager(realmService != null ?
+ realmService.getTenantManager() : null);
}
- private void setTenantManager(RealmService realmService) {
- if (realmService == null) {
- throw new IllegalStateException("Realm service is not initialized properly");
- }
- this.tenantManager = realmService.getTenantManager();
+ private void setTenantManager(TenantManager tenantManager) {
+ this.tenantManager = tenantManager;
}
public TenantManager getTenantManager() {
+ if (tenantManager == null) {
+ throw new IllegalStateException("Tenant manager is not initialized properly");
+ }
return tenantManager;
}
}
From 38b8c8d7b18009171cd00538ccb151de1e3b1a2c Mon Sep 17 00:00:00 2001
From: Thilina Sandaruwan
Date: Mon, 10 Jul 2023 07:46:21 +0000
Subject: [PATCH 44/50] Grouping Improvements (#169)
Purpose
After deleting a role, delete relevant records from DM_ROLE_GROUP_MAP table
Related tickets: https://roadmap.entgra.net/issues/9528 and https://roadmap.entgra.net/issues/9529
Co-authored-by: ThilinaPremachandra
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/169
Co-authored-by: Thilina Sandaruwan
Co-committed-by: Thilina Sandaruwan
---
.../impl/GroupManagementServiceImpl.java | 4 +-
.../impl/RoleManagementServiceImpl.java | 13 ++++--
.../GroupManagementAdminServiceImpl.java | 4 +-
.../core/device/mgt/core/dao/GroupDAO.java | 9 ++++
.../core/dao/impl/AbstractGroupDAOImpl.java | 17 ++++++++
.../GroupManagementProviderService.java | 16 ++++++-
.../GroupManagementProviderServiceImpl.java | 42 ++++++++++++++++---
7 files changed, 91 insertions(+), 14 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
index 6c75b3fb5e..de2991e7a7 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java
@@ -475,8 +475,8 @@ public class GroupManagementServiceImpl implements GroupManagementService {
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupAlreadyExistException e) {
- String msg = "Group already exists with name : " + groups.getName() + ".";
- log.warn(msg);
+ String msg = "Group already exists with name : " + groups.getName() + " Try with another group name.";
+ log.error(msg, e);
return Response.status(Response.Status.CONFLICT).entity(msg).build();
} catch (RoleDoesNotExistException e) {
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
index 099473ad0d..077e814fe7 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
@@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
import org.apache.commons.logging.Log;
import org.json.simple.JSONObject;
@@ -637,6 +638,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
@Consumes(MediaType.WILDCARD)
@Override
public Response deleteRole(@PathParam("roleName") String roleName, @QueryParam("user-store") String userStoreName) {
+ String roleToDelete = roleName;
if (userStoreName != null && !userStoreName.isEmpty()) {
roleName = userStoreName + "/" + roleName;
}
@@ -644,6 +646,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
try {
final UserRealm userRealm = DeviceMgtAPIUtils.getUserRealm();
final UserStoreManager userStoreManager = userRealm.getUserStoreManager();
+ int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
if (!userStoreManager.isExistingRole(roleName)) {
String msg = "No role exists with the name : " + roleName ;
return Response.status(404).entity(msg).build();
@@ -653,16 +656,18 @@ public class RoleManagementServiceImpl implements RoleManagementService {
if (log.isDebugEnabled()) {
log.debug("Deleting the role in user store");
}
- userStoreManager.deleteRole(roleName);
- // Delete all authorizations for the current role before deleting
- authorizationManager.clearRoleAuthorization(roleName);
-
+ DeviceMgtAPIUtils.getGroupManagementProviderService().deleteRoleAndRoleGroupMapping(roleName, roleToDelete, tenantId, userStoreManager, authorizationManager);
return Response.status(Response.Status.OK).build();
} catch (UserStoreException e) {
String msg = "Error occurred while deleting the role '" + roleName + "'";
log.error(msg, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
+ } catch (GroupManagementException e) {
+ String msg = "Error occurred while deleting group-role mapping records";
+ log.error(msg, e);
+ return Response.serverError().entity(
+ new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
index e9277825ed..00d2e1cbaf 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java
@@ -187,8 +187,8 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupAlreadyExistException e) {
- String msg = "Group already exists with name : " + group.getName() + ".";
- log.warn(msg);
+ String msg = "Group already exists with name : " + group.getName() + " Try with another group name.";
+ log.error(msg, e);
return Response.status(Response.Status.CONFLICT).entity(msg).build();
} catch (RoleDoesNotExistException e) {
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
index fe639e63e1..e339437cb7 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java
@@ -156,6 +156,15 @@ public interface GroupDAO {
*/
void deleteGroupsMapping(List groupIds, int tenantId) throws GroupManagementDAOException;
+ /**
+ * Delete mappings of Device Groups.
+ *
+ * @param role of Device Groups.
+ * @param tenantId of the role.
+ * @throws GroupManagementDAOException on error during deletion of mappings of groups
+ */
+ void deleteGroupsMapping(String role, int tenantId) throws GroupManagementDAOException;
+
/**
* Delete existing Device Groups.
*
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
index 480bc735b0..1dddaa093c 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java
@@ -544,6 +544,23 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
}
}
+ @Override
+ public void deleteGroupsMapping(String role, int tenantId) throws GroupManagementDAOException {
+
+ try {
+ Connection conn = GroupManagementDAOFactory.getConnection();
+ String sql = "DELETE FROM DM_ROLE_GROUP_MAP WHERE ROLE = ? AND TENANT_ID = ?";
+ try (PreparedStatement stmt = conn.prepareStatement(sql)) {
+ stmt.setString(1, role);
+ stmt.setInt(2, tenantId);
+ stmt.executeUpdate();
+ }
+ } catch (SQLException e) {
+ String msg = "Error occurred while removing record from group-role mapping.";
+ log.error(msg);
+ throw new GroupManagementDAOException(msg, e);
+ }
+ }
@Override
public void deleteGroups(List groupIds, int tenantId) throws GroupManagementDAOException {
try {
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
index 153b97b5bf..20d9bbd386 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java
@@ -30,6 +30,8 @@ import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistEx
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException;
+import org.wso2.carbon.user.api.AuthorizationManager;
+import org.wso2.carbon.user.api.UserStoreManager;
import java.util.List;
@@ -57,7 +59,7 @@ public interface GroupManagementProviderService {
* @param defaultPermissions of the default role
* @throws GroupManagementException
*/
- void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException, GroupAlreadyExistException, RoleDoesNotExistException;
+ void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupAlreadyExistException,GroupManagementException, RoleDoesNotExistException;
/**
* Update existing device group.
@@ -79,6 +81,18 @@ public interface GroupManagementProviderService {
*/
boolean deleteGroup(int groupId, boolean isDeleteChildren) throws GroupManagementException;
+ /**
+ * Delete existing device group.
+ *
+ * @param role to be deleted with the userStore name.
+ * @param roleToDelete to delete the role.
+ * @param tenantId to belongs to roles.
+ * @param userStoreManager with details.
+ * @param authorizationManager with details.
+ * @throws GroupManagementException
+ */
+ void deleteRoleAndRoleGroupMapping(String role, String roleToDelete, int tenantId, UserStoreManager userStoreManager, AuthorizationManager authorizationManager) throws GroupManagementException;
+
/**
* Get the device group provided the device group id.
*
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index 3b83d49c01..ee489dedc3 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -35,7 +35,6 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.netbeans.lib.cvsclient.commandLine.command.status;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
@@ -46,14 +45,13 @@ import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementEx
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException;
import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest;
import io.entgra.device.mgt.core.device.mgt.common.PaginationResult;
-import io.entgra.device.mgt.core.device.mgt.common.exceptions.TrackerAlreadyExistException;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException;
import io.entgra.device.mgt.core.device.mgt.core.event.config.GroupAssignmentEventOperationExecutor;
import io.entgra.device.mgt.core.device.mgt.core.geo.task.GeoFenceEventOperationManager;
import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder;
import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationMgtConstants;
import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil;
-import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil;
+import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager;
@@ -148,7 +146,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
}
- public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupManagementException {
+ public void createGroupWithRoles(DeviceGroupRoleWrapper groups, String defaultRole, String[] defaultPermissions) throws GroupAlreadyExistException, GroupManagementException {
if (groups == null) {
String msg = "Received incomplete data for createGroup";
log.error(msg);
@@ -181,7 +179,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
GroupManagementDAOFactory.commitTransaction();
} else {
- throw new GroupManagementException("Group exist with name " + groups.getName());
+ throw new GroupAlreadyExistException("Group already exists with name : " + groups.getName() + " Try with another group name.");
}
} catch (GroupManagementDAOException e) {
GroupManagementDAOFactory.rollbackTransaction();
@@ -359,6 +357,40 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void deleteRoleAndRoleGroupMapping(String roleName, String roleToDelete, int tenantId, UserStoreManager userStoreManager, AuthorizationManager authorizationManager) throws GroupManagementException {
+ if (log.isDebugEnabled()) {
+ log.debug("Delete roles");
+ }
+ try {
+ GroupManagementDAOFactory.beginTransaction();
+ groupDAO.deleteGroupsMapping(roleToDelete, tenantId);
+ userStoreManager.deleteRole(roleName);
+ // Delete all authorizations for the current role before deleting
+ authorizationManager.clearRoleAuthorization(roleName);
+ GroupManagementDAOFactory.commitTransaction();
+ } catch (UserStoreException e) {
+ GroupManagementDAOFactory.rollbackTransaction();
+ String msg = "Error occurred while deleting the role '" + roleName + "'";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } catch (TransactionManagementException e) {
+ String msg = "Error occurred while initiating transaction.";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } catch (GroupManagementDAOException e) {
+ GroupManagementDAOFactory.rollbackTransaction();
+ String msg = "Error occurred while deleting the role";
+ log.error(msg, e);
+ throw new GroupManagementException(msg, e);
+ } finally {
+ GroupManagementDAOFactory.closeConnection();
+ }
+ }
+
/**
* {@inheritDoc}
*/
From 11efc83b06d1fed400c8104373f2f9f5295e09df Mon Sep 17 00:00:00 2001
From: Dharmakeerthi Lasantha
Date: Tue, 11 Jul 2023 11:43:26 +0530
Subject: [PATCH 45/50] Fix dependency importing issue
---
.../pom.xml | 4 ++++
.../jaxrs/service/api/GroupManagementService.java | 15 ++++++++-------
.../pom.xml | 4 ++++
.../mgt/core/mgt/impl/PolicyManagerImpl.java | 1 +
4 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
index f9931aae6c..fde1c89087 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml
@@ -411,6 +411,10 @@
org.wso2.carbon.ntask.core
provided
+
+ io.entgra.device.mgt.core
+ io.entgra.device.mgt.core.notification.logger
+
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
index 17ac84779a..1240e86437 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java
@@ -28,6 +28,7 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList;
import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants;
import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup;
+import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupRoleWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -1302,11 +1303,11 @@ public interface GroupManagementService {
"Server error occurred while creating the group or adding devices or sharing the group.",
response = ErrorResponse.class)
})
- Response createGroupWithRoles(@ApiParam(
- name = "group",
- value = "Define the group object with data.",
- required = true)
- @Valid DeviceGroupRoleWrapper group
- );
-
+ Response createGroupWithRoles(
+ @ApiParam(
+ name = "group",
+ value = "Define the group object with data.",
+ required = true)
+ @Valid DeviceGroupRoleWrapper group
+ );
}
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
index cd75cd10c5..f93f462924 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml
@@ -283,6 +283,10 @@
org.wso2.orbit.javax.xml.bind
jaxb-api
+
+ io.entgra.device.mgt.core
+ io.entgra.device.mgt.core.notification.logger
+
diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java
index 3e6aa49292..6b710b259b 100644
--- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java
+++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java
@@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl;
+import com.google.gson.Gson;
import io.entgra.device.mgt.core.device.mgt.common.Device;
import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier;
import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest;
From 78aee58c1a3dafaffa7310c6cf9d35c27b3947b2 Mon Sep 17 00:00:00 2001
From: Dharmakeerthi Lasantha
Date: Tue, 11 Jul 2023 12:13:53 +0530
Subject: [PATCH 46/50] Fix build failure
---
.../device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +-
.../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
index 27617e89ae..0c2e5663fe 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml
@@ -364,7 +364,7 @@
org.powermock
- powermock-api-mockito
+ powermock-api-mockito2
test
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
index b97dba2a91..26f6603912 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml
@@ -473,7 +473,7 @@
org.powermock
- powermock-api-mockito
+ powermock-api-mockito2
org.wso2.carbon.multitenancy
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
index 585aeafeaa..c12f494f37 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml
@@ -78,7 +78,7 @@
org.powermock
- powermock-api-mockito
+ powermock-api-mockito2
test
From a0d6c2bd213b5e49d1714a3136d448acb8b7f74c Mon Sep 17 00:00:00 2001
From: prathabanKavin
Date: Tue, 11 Jul 2023 15:53:09 +0530
Subject: [PATCH 47/50] Add missing ios scopes in mdm-ui-config
---
.../src/main/resources/conf/mdm-ui-config.xml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
index 809c856038..b16935562d 100644
--- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
+++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
@@ -227,6 +227,19 @@
perm:android:clear-application
perm:android:suspend-package
perm:android:alternate-install
+ perm:ios:lock
+ perm:ios:location
+ perm:ios:ring
+ perm:ios:clear-passcode
+ perm:ios:enterprise-wipe
+ perm:ios:notification
+ perm:ios:wipe-data
+ perm:ios:boolean-setting
+ perm:ios:wallpaper
+ perm:ios:app-attributes
+ perm:ios:app-configurations
+ perm:mac-os:restart
+ perm:mac-os:shut-down
device-mgt
From 90741dc502a0c02f3a31346ca1003a0f968bfe50 Mon Sep 17 00:00:00 2001
From: navodzoysa
Date: Tue, 11 Jul 2023 23:08:33 +0530
Subject: [PATCH 48/50] Fix class not found error in analytics component
---
.../api/impl/GrafanaAPIProxyServiceImpl.java | 6 +--
.../api/impl/util/GrafanaMgtAPIUtils.java | 52 +++++++++++++++++++
.../pom.xml | 2 +-
.../GrafanaManagementServiceComponent.java | 1 -
4 files changed, 56 insertions(+), 5 deletions(-)
create mode 100644 components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaMgtAPIUtils.java
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java
index 9c91a23e2b..8ed6fe1ca1 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java
@@ -22,11 +22,11 @@ import com.google.gson.JsonObject;
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.GrafanaAPIProxyService;
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.bean.ErrorResponse;
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.exception.RefererNotValid;
+import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.impl.util.GrafanaMgtAPIUtils;
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.impl.util.GrafanaRequestHandlerUtil;
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.exception.GrafanaManagementException;
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.bean.GrafanaPanelIdentifier;
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.exception.MaliciousQueryAttempt;
-import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.internal.GrafanaMgtDataHolder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException;
@@ -57,8 +57,8 @@ public class GrafanaAPIProxyServiceImpl implements GrafanaAPIProxyService {
public Response queryDatasource(JsonObject body, @Context HttpHeaders headers, @Context UriInfo requestUriInfo) {
try {
GrafanaPanelIdentifier panelIdentifier = GrafanaRequestHandlerUtil.getPanelIdentifier(headers);
- GrafanaMgtDataHolder.getInstance().getGrafanaQueryService().
- buildSafeQuery(body, panelIdentifier.getDashboardId(), panelIdentifier.getPanelId(), requestUriInfo.getRequestUri());
+ GrafanaMgtAPIUtils.getGrafanaQueryService().buildSafeQuery(body, panelIdentifier.getDashboardId(),
+ panelIdentifier.getPanelId(), requestUriInfo.getRequestUri());
return GrafanaRequestHandlerUtil.proxyPassPostRequest(body, requestUriInfo, panelIdentifier.getOrgId());
} catch (MaliciousQueryAttempt e) {
return Response.status(Response.Status.BAD_REQUEST).entity(
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaMgtAPIUtils.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaMgtAPIUtils.java
new file mode 100644
index 0000000000..07a4293b49
--- /dev/null
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaMgtAPIUtils.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018 - 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.device.mgt.core.analytics.mgt.grafana.proxy.api.impl.util;
+
+import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.service.GrafanaQueryService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
+
+public class GrafanaMgtAPIUtils {
+
+ private static final Log log = LogFactory.getLog(GrafanaMgtAPIUtils.class);
+ private static volatile GrafanaQueryService grafanaQueryService;
+
+ /**
+ * Accessing GrafanaQueryService from OSGI service context
+ * @return GrafanaQueryService instance
+ */
+ public static GrafanaQueryService getGrafanaQueryService() {
+ if (grafanaQueryService == null) {
+ synchronized (GrafanaMgtAPIUtils.class) {
+ if (grafanaQueryService == null) {
+ PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
+ grafanaQueryService =
+ (GrafanaQueryService) ctx.getOSGiService(GrafanaQueryService.class, null);
+ if (grafanaQueryService == null) {
+ String msg = "Grafana Query service has not initialized.";
+ log.error(msg);
+ throw new IllegalStateException(msg);
+ }
+ }
+ }
+ }
+ return grafanaQueryService;
+ }
+}
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
index 5ccdb13257..24f5dbdcab 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml
@@ -88,7 +88,7 @@
io.entgra.device.mgt.core.application.mgt.core.*
- !io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal,
+ !io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.internal,
io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.*
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java
index 8438c61156..cc4ab33920 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java
@@ -26,7 +26,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.context.PrivilegedCarbonContext;
/**
* @scr.component name="io.entgra.analytics.mgt.grafana.proxy.grafanamanagementservicecomponent" immediate="true"
From 3bf6f7dd75d98fc708e3184632daca2729f453e0 Mon Sep 17 00:00:00 2001
From: Dharmakeerthi Lasantha
Date: Wed, 12 Jul 2023 00:05:02 +0530
Subject: [PATCH 49/50] Improve functionality and fix formatting issues
---
.../mgt/core/impl/ApplicationManagerImpl.java | 6 +++---
.../mgt/core/impl/SubscriptionManagerImpl.java | 12 +++++++++++-
.../core/application/mgt/core/util/Constants.java | 3 +++
.../service/impl/RoleManagementServiceImpl.java | 7 +++++--
.../mgt/core/operation/mgt/OperationManagerImpl.java | 9 ++++++++-
.../service/DeviceManagementProviderServiceImpl.java | 10 +++++++++-
.../service/GroupManagementProviderServiceImpl.java | 2 +-
7 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
index b214f7d3bb..ddbf68b2e7 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java
@@ -1286,7 +1286,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
this.changeLifecycleState(applicationReleaseDTO, lifecycleChanger);
}
}
- if (applicationDTO.getType().equals("ENTERPRISE") || applicationDTO.getType().equals("PUBLIC") ) {
+ if (Constants.ENTERPRISE_APP_TYPE.equals(applicationDTO.getType()) || Constants.PUBLIC_APP_TYPE.equals(applicationDTO.getType())) {
persistAppIconInfo(applicationReleaseDTO);
}
applicationReleaseEntities.add(applicationReleaseDTO);
@@ -1726,8 +1726,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
List allMetadata;
allMetadata = APIUtil.getMetadataManagementService().retrieveAllMetadata();
if (allMetadata != null && !allMetadata.isEmpty()) {
- for(Metadata metadata : allMetadata){
- if(Constants.SHOW_ALL_ROLES.equals(metadata.getMetaKey())){
+ for (Metadata metadata : allMetadata) {
+ if (Constants.SHOW_ALL_ROLES.equals(metadata.getMetaKey())) {
String metaValue = metadata.getMetaValue();
if (metaValue != null) {
JSONObject jsonObject;
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
index 3bc5bcb013..f928793bda 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
@@ -713,7 +713,17 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
Activity activity = addAppOperationOnDevices(applicationDTO, deviceIdentifiers, deviceType, action, properties);
activityList.add(activity);
for (DeviceIdentifier identifier : deviceIdentifiers) {
- log.info(String.format("App %s triggered", action), appInstallLogContextBuilder.setAppId(String.valueOf(applicationDTO.getId())).setAppName(applicationDTO.getName()).setAppType(applicationDTO.getType()).setSubType(subType).setTenantId(tenantId).setTenantDomain(tenantDomain).setDevice(String.valueOf(identifier)).setUserName(username).setAction(action).build());
+ log.info(String.format("App %s triggered", action), appInstallLogContextBuilder
+ .setAppId(String.valueOf(applicationDTO.getId()))
+ .setAppName(applicationDTO.getName())
+ .setAppType(applicationDTO.getType())
+ .setSubType(subType)
+ .setTenantId(tenantId)
+ .setTenantDomain(tenantDomain)
+ .setDevice(String.valueOf(identifier))
+ .setUserName(username)
+ .setAction(action)
+ .build());
}
}
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java
index efd848cdb1..c3e7c49160 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java
@@ -94,6 +94,9 @@ public class Constants {
public static final String MSI = "MSI";
public static final String APPX = "APPX";
+ public static final String ENTERPRISE_APP_TYPE = "ENTERPRISE";
+ public static final String PUBLIC_APP_TYPE = "ENTERPRISE";
+
private static final Map AGENT_DATA = new HashMap<>();
static {
AGENT_DATA.put("android", "android-agent.apk");
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
index 0d54346c5c..1c28dc33e1 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java
@@ -17,6 +17,7 @@
*/
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
+import com.google.common.base.Strings;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
@@ -34,6 +35,7 @@ import org.apache.commons.logging.LogFactory;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
+import org.springframework.util.StringUtils;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.CarbonContext;
@@ -72,6 +74,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import static io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants.PRIMARY_USER_STORE;
@@ -136,7 +139,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
if (limit == 0){
limit = Constants.DEFAULT_PAGE_LIMIT;
}
- if (domain != null && !domain.isEmpty()) {
+ if (!Strings.isNullOrEmpty(domain)) {
username = domain + '/' + username;
}
Metadata metadata;
@@ -149,7 +152,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
boolean decision = (boolean) jsonObject.get(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
if (decision) {
- if (userStore == null || "".equals(userStore)){
+ if (Strings.isNullOrEmpty(userStore)){
userStore = PRIMARY_USER_STORE;
}
try {
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
index ad437f445a..db2ac921aa 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java
@@ -719,7 +719,14 @@ public class OperationManagerImpl implements OperationManager {
DeviceCacheManagerImpl.getInstance().removeDeviceFromCache(deviceId, tenantId);
break;
}
- log.info("Device Connected", deviceConnectivityLogContextBuilder.setDeviceId(deviceId.getId()).setDeviceType(deviceId.getType()).setActionTag("PENDING_OPERATION").setTenantDomain(tenantDomain).setTenantId(String.valueOf(tenantId)).setUserName(userName).build());
+ log.info("Device Connected", deviceConnectivityLogContextBuilder
+ .setDeviceId(deviceId.getId())
+ .setDeviceType(deviceId.getType())
+ .setActionTag("PENDING_OPERATION")
+ .setTenantDomain(tenantDomain)
+ .setTenantId(String.valueOf(tenantId))
+ .setUserName(userName)
+ .build());
return getOperations(deviceId, Operation.Status.PENDING, enrolmentId);
}
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
index acdd7976da..0a526d0283 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
@@ -344,7 +344,15 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
device.getType() + " upon the user '" + device.getEnrolmentInfo().getOwner() +
"'");
}
- log.info("Device enrolled successfully", deviceEnrolmentLogContextBuilder.setDeviceId(String.valueOf(existingDevice.getId())).setDeviceType(String.valueOf(existingDevice.getType())).setOwner(newEnrolmentInfo.getOwner()).setOwnership(String.valueOf(newEnrolmentInfo.getOwnership())).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).setUserName(userName).build());
+ log.info("Device enrolled successfully", deviceEnrolmentLogContextBuilder
+ .setDeviceId(String.valueOf(existingDevice.getId()))
+ .setDeviceType(String.valueOf(existingDevice.getType()))
+ .setOwner(newEnrolmentInfo.getOwner())
+ .setOwnership(String.valueOf(newEnrolmentInfo.getOwnership()))
+ .setTenantID(String.valueOf(tenantId))
+ .setTenantDomain(tenantDomain)
+ .setUserName(userName)
+ .build());
status = true;
} else {
log.warn("Unable to update device enrollment for device : " + device.getDeviceIdentifier() +
diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
index a9815526d6..c9bb42dcbf 100644
--- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
+++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java
@@ -298,7 +298,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
newParentPath = DeviceGroupConstants.HierarchicalGroup.SEPERATOR;
}
childrenGroup.setParentPath(newParentPath);
- if (!newParentPath.equals(DeviceGroupConstants.HierarchicalGroup.SEPERATOR)) {
+ if (!DeviceGroupConstants.HierarchicalGroup.SEPERATOR.equals(newParentPath)) {
String[] groupIds = newParentPath.split(DeviceGroupConstants.HierarchicalGroup.SEPERATOR);
int latestGroupId = Integer.parseInt(groupIds[groupIds.length - 1]);
childrenGroup.setParentGroupId(latestGroupId);
From a66d6389f921bb8232da44464bbab325a8911a2d Mon Sep 17 00:00:00 2001
From: Dharmakeerthi Lasantha
Date: Wed, 12 Jul 2023 00:39:31 +0530
Subject: [PATCH 50/50] Fix formatting issue
---
.../mgt/core/impl/SubscriptionManagerImpl.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
index f928793bda..7c3ee9694e 100644
--- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
+++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java
@@ -706,7 +706,17 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
entry.getKey(), action, properties);
activityList.add(activity);
for (DeviceIdentifier identifier : deviceIdentifiers) {
- log.info(String.format("Web app %s triggered", action), appInstallLogContextBuilder.setAppId(String.valueOf(applicationDTO.getId())).setAppName(applicationDTO.getName()).setAppType(applicationDTO.getType()).setSubType(subType).setTenantId(tenantId).setTenantDomain(tenantDomain).setDevice(String.valueOf(identifier)).setUserName(username).setAction(action).build());
+ log.info(String.format("Web app %s triggered", action), appInstallLogContextBuilder
+ .setAppId(String.valueOf(applicationDTO.getId()))
+ .setAppName(applicationDTO.getName())
+ .setAppType(applicationDTO.getType())
+ .setSubType(subType)
+ .setTenantId(tenantId)
+ .setTenantDomain(tenantDomain)
+ .setDevice(String.valueOf(identifier))
+ .setUserName(username)
+ .setAction(action)
+ .build());
}
}
} else {