diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml
index 6439eab85e..050e9089cf 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml
@@ -30,379 +30,385 @@
-
- Device Management
- /device-mgt
- /
- GET
-
-
-
- Device Management Admin
- /device-mgt/admin
- /
- GET
-
-
- Devices
- /device-mgt/admin/devices
- /
- GET
-
-
-
- List devices
- /device-mgt/admin/devices/List
- /devices
- GET
-
-
- Search devices
- /device-mgt/admin/devices/Search
- /devices/search-devices
- POST
-
-
- View device
- /device-mgt/admin/devices/View
- /devices/*/*
- GET
-
-
- View device applications
- /device-mgt/admin/devices/View-Applications
- /devices/*/*/applications
- GET
-
-
- View device effective-policy
- /device-mgt/admin/devices/View-Active-Policy
- /devices/*/*/effective-policy
- GET
-
-
- View devices feature
- /device-mgt/admin/devices/View-Features
- /devices/*/*/features
- GET
-
-
- View device operations
- /device-mgt/admin/devices/View-Operations
- /devices/*/*/operations
- GET
-
-
- View Compliance Data
- /device-mgt/admin/devices/View-Compliance-Data
- /devices/*/*/compliance-data
- GET
-
-
- List all devices
- /device-mgt/admin/devices/Admin-View
- /admin/devices
- GET
-
-
- View device types
- /device-mgt/admin/devices/Admin-DeviceType-View
- /admin/device-types
- GET
-
-
-
- Policies
- /device-mgt/admin/policies
- /
- GET
-
-
-
- List policies
- /device-mgt/admin/policies/List
- /policies
- GET
-
-
- Add Policy
- /device-mgt/admin/policies/Add
- /policies
- POST
-
-
- Activate policy
- /device-mgt/admin/policies/Activate-Policy
- /policies/activate-policy
- PUT
-
-
- Deactivate Policy
- /device-mgt/admin/policies/Deactivate-Policy
- /policies/deactivate-policy
- PUT
-
-
- Remove Policy
- /device-mgt/admin/policies/Remove
- /policies/remove-policy
- POST
-
-
- View Policy
- /device-mgt/admin/policies/View
- /policies/*
- GET
-
-
- Update Policy
- /device-mgt/admin/policies/Update
- /policies/*
- PUT
-
-
- Update Policy
- /device-mgt/admin/policies/Update
- /policies/apply-changes
- PUT
-
-
- Update Policy
- /device-mgt/admin/policies/Change-Priority
- /policies/priorities
- PUT
-
-
-
- Notifications
- /device-mgt/admin/notifications
- /
- GET
-
-
-
- View notifications
- /device-mgt/admin/notifications/View
- /notifications
- GET
-
-
- Mark checked notifications
- /device-mgt/admin/notifications/View
- /notifications/*/mark-checked
- PUT
-
-
-
- Users
- /device-mgt/admin/users
- /
- GET
-
-
-
- List users
- /device-mgt/admin/users/List
- /users
- GET
-
-
- Add user
- /device-mgt/admin/users/Add
- /users
- POST
-
-
- List users
- /device-mgt/admin/users/Search
- /users/search/usernames
- GET
-
-
- Remove user
- /device-mgt/admin/users/Remove
- /users/*
- DELETE
-
-
- View user
- /device-mgt/admin/users/View
- /users/*
- GET
-
-
- Update user
- /device-mgt/admin/users/Update
- /users/*
- PUT
-
-
- Update user credentials
- /device-mgt/admin/users/Change-Password
- /users/*/credentials
- PUT
-
-
- View assigned role
- /device-mgt/admin/roles/Assigned-Roles
- /users/*/roles
- GET
-
-
- Change any user credentials
- /device-mgt/admin/users/Change-Password-Any
- /admin/users/*/credentials
- POST
-
-
- Send invitation mail
- /device-mgt/admin/users/Send-invitations
- /users/send-invitation
- POST
-
-
-
- Roles
- /device-mgt/admin/roles
- /
- GET
-
-
-
- List roles
- /device-mgt/admin/roles/List
- /roles
- GET
-
-
- Add role
- /device-mgt/admin/roles/Add
- /roles
- POST
-
-
- Remove role
- /device-mgt/admin/roles/Remove
- /roles/*
- DELETE
-
-
- View role
- /device-mgt/admin/roles/View
- /roles/*
- GET
-
-
- Update role
- /device-mgt/admin/roles/Update
- /roles/*
- PUT
-
-
- View role permissions
- /device-mgt/admin/roles/View-Permission
- /roles/*/permissions
- GET
-
-
- Add Users to role
- /device-mgt/admin/roles/Add-Users
- /roles/*/users
- PUT
-
-
-
- Configurations
- /device-mgt/admin/general-configs
- /
- GET
-
-
-
- View configuration
- /device-mgt/admin/general-configuration/View
- /configuration
- GET
-
-
- Update configuration
- /device-mgt/admin/general-configuration/Update
- /configuration
- PUT
-
-
-
- Activities
- /device-mgt/admin/activities
- /
- GET
-
-
-
- View Activities
- /device-mgt/admin/activities/View
- /activities
- GET
-
-
- View Activity Details
- /device-mgt/admin/activities/View
- /activities/*
- GET
-
-
-
- Applications
- /device-mgt/admin/applications
- /
- GET
-
-
-
- Install Applications
- /device-mgt/admin/application/Install
- /admin/applications/install-application
- POST
-
-
- Uninstall-Applications
- /device-mgt/admin/application/Uninstall
- /admin/applications/uninstall-application
- POST
-
-
-
-
-
- Device Management User
- /device-mgt/user
- /
- GET
-
-
- User Devices
- /device-mgt/user/devices
- /
- GET
-
-
- User Policies
- /device-mgt/user/policies
- /
- GET
-
-
- User Notifications
- /device-mgt/user/notifications
- /
- GET
-
-
- User Operations
- /device-mgt/user/operations
- /
- GET
-
-
+
+ Device Management
+ /device-mgt
+ /
+ GET
+
+
+
+ Device Management Admin
+ /device-mgt/admin
+ /
+ GET
+
+
+ Devices
+ /device-mgt/admin/devices
+ /
+ GET
+
+
+
+ List devices
+ /device-mgt/admin/devices/List
+ /devices
+ GET
+
+
+ Search devices
+ /device-mgt/admin/devices/Search
+ /devices/search-devices
+ POST
+
+
+ View device
+ /device-mgt/admin/devices/View
+ /devices/*/*
+ GET
+
+
+ View device info
+ /device-mgt/admin/devices/View
+ /devices/*/*/info
+ GET
+
+
+ View device applications
+ /device-mgt/admin/devices/View-Applications
+ /devices/*/*/applications
+ GET
+
+
+ View device effective-policy
+ /device-mgt/admin/devices/View-Active-Policy
+ /devices/*/*/effective-policy
+ GET
+
+
+ View devices feature
+ /device-mgt/admin/devices/View-Features
+ /devices/*/*/features
+ GET
+
+
+ View device operations
+ /device-mgt/admin/devices/View-Operations
+ /devices/*/*/operations
+ GET
+
+
+ View Compliance Data
+ /device-mgt/admin/devices/View-Compliance-Data
+ /devices/*/*/compliance-data
+ GET
+
+
+ List all devices
+ /device-mgt/admin/devices/Admin-View
+ /admin/devices
+ GET
+
+
+ View device types
+ /device-mgt/admin/devices/Admin-DeviceType-View
+ /admin/device-types
+ GET
+
+
+
+ Policies
+ /device-mgt/admin/policies
+ /
+ GET
+
+
+
+ List policies
+ /device-mgt/admin/policies/List
+ /policies
+ GET
+
+
+ Add Policy
+ /device-mgt/admin/policies/Add
+ /policies
+ POST
+
+
+ Activate policy
+ /device-mgt/admin/policies/Activate-Policy
+ /policies/activate-policy
+ PUT
+
+
+ Deactivate Policy
+ /device-mgt/admin/policies/Deactivate-Policy
+ /policies/deactivate-policy
+ PUT
+
+
+ Remove Policy
+ /device-mgt/admin/policies/Remove
+ /policies/remove-policy
+ POST
+
+
+ View Policy
+ /device-mgt/admin/policies/View
+ /policies/*
+ GET
+
+
+ Update Policy
+ /device-mgt/admin/policies/Update
+ /policies/*
+ PUT
+
+
+ Update Policy
+ /device-mgt/admin/policies/Update
+ /policies/apply-changes
+ PUT
+
+
+ Update Policy
+ /device-mgt/admin/policies/Change-Priority
+ /policies/priorities
+ PUT
+
+
+
+ Notifications
+ /device-mgt/admin/notifications
+ /
+ GET
+
+
+
+ View notifications
+ /device-mgt/admin/notifications/View
+ /notifications
+ GET
+
+
+ Mark checked notifications
+ /device-mgt/admin/notifications/View
+ /notifications/*/mark-checked
+ PUT
+
+
+
+ Users
+ /device-mgt/admin/users
+ /
+ GET
+
+
+
+ List users
+ /device-mgt/admin/users/List
+ /users
+ GET
+
+
+ Add user
+ /device-mgt/admin/users/Add
+ /users
+ POST
+
+
+ List users
+ /device-mgt/admin/users/Search
+ /users/search/usernames
+ GET
+
+
+ Remove user
+ /device-mgt/admin/users/Remove
+ /users/*
+ DELETE
+
+
+ View user
+ /device-mgt/admin/users/View
+ /users/*
+ GET
+
+
+ Update user
+ /device-mgt/admin/users/Update
+ /users/*
+ PUT
+
+
+ Update user credentials
+ /device-mgt/admin/users/Change-Password
+ /users/*/credentials
+ PUT
+
+
+ View assigned role
+ /device-mgt/admin/roles/Assigned-Roles
+ /users/*/roles
+ GET
+
+
+ Change any user credentials
+ /device-mgt/admin/users/Change-Password-Any
+ /admin/users/*/credentials
+ POST
+
+
+ Send invitation mail
+ /device-mgt/admin/users/Send-invitations
+ /users/send-invitation
+ POST
+
+
+
+ Roles
+ /device-mgt/admin/roles
+ /
+ GET
+
+
+
+ List roles
+ /device-mgt/admin/roles/List
+ /roles
+ GET
+
+
+ Add role
+ /device-mgt/admin/roles/Add
+ /roles
+ POST
+
+
+ Remove role
+ /device-mgt/admin/roles/Remove
+ /roles/*
+ DELETE
+
+
+ View role
+ /device-mgt/admin/roles/View
+ /roles/*
+ GET
+
+
+ Update role
+ /device-mgt/admin/roles/Update
+ /roles/*
+ PUT
+
+
+ View role permissions
+ /device-mgt/admin/roles/View-Permission
+ /roles/*/permissions
+ GET
+
+
+ Add Users to role
+ /device-mgt/admin/roles/Add-Users
+ /roles/*/users
+ PUT
+
+
+
+ Configurations
+ /device-mgt/admin/general-configs
+ /
+ GET
+
+
+
+ View configuration
+ /device-mgt/admin/general-configuration/View
+ /configuration
+ GET
+
+
+ Update configuration
+ /device-mgt/admin/general-configuration/Update
+ /configuration
+ PUT
+
+
+
+ Activities
+ /device-mgt/admin/activities
+ /
+ GET
+
+
+
+ View Activities
+ /device-mgt/admin/activities/View
+ /activities
+ GET
+
+
+ View Activity Details
+ /device-mgt/admin/activities/View
+ /activities/*
+ GET
+
+
+
+ Applications
+ /device-mgt/admin/applications
+ /
+ GET
+
+
+
+ Install Applications
+ /device-mgt/admin/application/Install
+ /admin/applications/install-application
+ POST
+
+
+ Uninstall-Applications
+ /device-mgt/admin/application/Uninstall
+ /admin/applications/uninstall-application
+ POST
+
+
+
+
+
+ Device Management User
+ /device-mgt/user
+ /
+ GET
+
+
+ User Devices
+ /device-mgt/user/devices
+ /
+ GET
+
+
+ User Policies
+ /device-mgt/user/policies
+ /
+ GET
+
+
+ User Notifications
+ /device-mgt/user/notifications
+ /
+ GET
+
+
+ User Operations
+ /device-mgt/user/operations
+ /
+ GET
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java
index 20e8543cb4..d280dd643e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java
@@ -20,11 +20,13 @@ package org.wso2.carbon.device.mgt.core.notification.mgt.dao;
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.IllegalTransactionStateException;
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
+import org.wso2.carbon.device.mgt.common.UnsupportedDatabaseEngineException;
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition;
-import org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl.NotificationDAOImpl;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.impl.*;
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
import javax.sql.DataSource;
@@ -39,21 +41,48 @@ import java.util.List;
public class NotificationManagementDAOFactory {
private static DataSource dataSource;
+ private static String databaseEngine;
private static final Log log = LogFactory.getLog(NotificationManagementDAOFactory.class);
private static ThreadLocal currentConnection = new ThreadLocal();
public static NotificationDAO getNotificationDAO() {
- return new NotificationDAOImpl();
+ if (databaseEngine != null) {
+ switch (databaseEngine) {
+ case DeviceManagementConstants.DataBaseTypes.DB_TYPE_ORACLE:
+ return new OracleNotificationDAOImpl();
+ case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MSSQL:
+ return new SQLServerNotificationDAOImpl();
+ case DeviceManagementConstants.DataBaseTypes.DB_TYPE_POSTGRESQL:
+ return new PostgreSQLNotificationDAOImpl();
+ case DeviceManagementConstants.DataBaseTypes.DB_TYPE_H2:
+ case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MYSQL:
+ return new GenericNotificationDAOImpl();
+ default:
+ throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
+ }
+ }
+ throw new IllegalStateException("Database engine has not initialized properly.");
}
public static void init(DataSourceConfig config) {
dataSource = resolveDataSource(config);
+ try {
+ databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
+ } catch (SQLException e) {
+ log.error("Error occurred while retrieving config.datasource connection", e);
+ }
}
public static void init(DataSource dtSource) {
dataSource = dtSource;
+ try {
+ databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
+ } catch (SQLException e) {
+ log.error("Error occurred while retrieving config.datasource connection", e);
+ }
}
+
public static void beginTransaction() throws TransactionManagementException {
Connection conn = currentConnection.get();
if (conn != null) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/NotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java
similarity index 74%
rename from components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/NotificationDAOImpl.java
rename to components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java
index 608c5a4f2e..96c47cf0d2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/NotificationDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java
@@ -35,7 +35,7 @@ import java.util.List;
/**
* Implementation of NotificationDAO which includes the methods to do CRUD operations on notification.
*/
-public class NotificationDAOImpl implements NotificationDAO {
+public abstract class AbstractNotificationDAOImpl implements NotificationDAO {
@Override
public int addNotification(int deviceId, int tenantId,
@@ -87,7 +87,7 @@ public class NotificationDAOImpl implements NotificationDAO {
rs = stmt.executeQuery();
while (rs.next()) {
- notification = this.getNotification(rs);
+ notification = NotificationDAOUtil.getNotification(rs);
}
} catch (SQLException e) {
throw new NotificationManagementException(
@@ -165,7 +165,7 @@ public class NotificationDAOImpl implements NotificationDAO {
rs = stmt.executeQuery();
notifications = new ArrayList<>();
while (rs.next()) {
- notifications.add(this.getNotification(rs));
+ notifications.add(NotificationDAOUtil.getNotification(rs));
}
} catch (SQLException e) {
throw new NotificationManagementException(
@@ -176,45 +176,6 @@ public class NotificationDAOImpl implements NotificationDAO {
return notifications;
}
- @Override
- public List getAllNotifications(PaginationRequest request, int tenantId) throws NotificationManagementException {
- Connection conn;
- PreparedStatement stmt = null;
- ResultSet rs = null;
- List notifications = null;
- try {
- conn = NotificationManagementDAOFactory.getConnection();
- String sql =
- "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
- " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
- "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
- "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
-
- sql = sql + " LIMIT ?,?";
-
- stmt = conn.prepareStatement(sql);
- stmt.setInt(1, tenantId);
- stmt.setInt(2, tenantId);
- int paramIdx = 3;
-
- stmt.setInt(paramIdx++, request.getStartIndex());
- stmt.setInt(paramIdx, request.getRowCount());
-
- rs = stmt.executeQuery();
- notifications = new ArrayList<>();
- while (rs.next()) {
- notifications.add(this.getNotification(rs));
- }
- } catch (SQLException e) {
- throw new NotificationManagementException(
- "Error occurred while retrieving information of all notifications", e);
- } finally {
- NotificationDAOUtil.cleanupResources(stmt, rs);
- }
- return notifications;
- }
-
-
@Override
public int getNotificationCount(int tenantId) throws NotificationManagementException {
int notificationCount = 0;
@@ -277,7 +238,7 @@ public class NotificationDAOImpl implements NotificationDAO {
rs = stmt.executeQuery();
notifications = new ArrayList<>();
while (rs.next()) {
- notifications.add(this.getNotification(rs));
+ notifications.add(NotificationDAOUtil.getNotification(rs));
}
} catch (SQLException e) {
throw new NotificationManagementException(
@@ -322,59 +283,4 @@ public class NotificationDAOImpl implements NotificationDAO {
}
return notificationCountByStatus;
}
-
- @Override
- public List getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
- NotificationManagementException{
- Connection conn;
- PreparedStatement stmt = null;
- ResultSet rs = null;
- List notifications = null;
- try {
- conn = NotificationManagementDAOFactory.getConnection();
- String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
- " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
- "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
- "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
- "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
- "AND TENANT_ID = ?";
-
- sql = sql + " LIMIT ?,?";
-
- stmt = conn.prepareStatement(sql);
- stmt.setInt(1, tenantId);
- stmt.setString(2, status.toString());
- stmt.setInt(3, tenantId);
-
- int paramIdx = 4;
-
- stmt.setInt(paramIdx++, request.getStartIndex());
- stmt.setInt(paramIdx, request.getRowCount());
-
-
- rs = stmt.executeQuery();
- notifications = new ArrayList<>();
- while (rs.next()) {
- notifications.add(this.getNotification(rs));
- }
- } catch (SQLException e) {
- throw new NotificationManagementException(
- "Error occurred while retrieving information of all " +
- "notifications by status : " + status, e);
- } finally {
- NotificationDAOUtil.cleanupResources(stmt, rs);
- }
- return notifications;
-
- }
-
- private Notification getNotification(ResultSet rs) throws SQLException {
- Notification notification = new Notification();
- notification.setNotificationId(rs.getInt("NOTIFICATION_ID"));
- notification.setOperationId(rs.getInt("OPERATION_ID"));
- notification.setDescription(rs.getString("DESCRIPTION"));
- notification.setStatus(rs.getString("STATUS"));
- return notification;
- }
-
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/GenericNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/GenericNotificationDAOImpl.java
new file mode 100644
index 0000000000..0653ec3029
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/GenericNotificationDAOImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. 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.notification.mgt.dao.impl;
+
+import org.wso2.carbon.device.mgt.common.PaginationRequest;
+import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
+import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class holds the generic implementation of NotificationDAO which can be used to support ANSI db syntax.
+ */
+public class GenericNotificationDAOImpl extends AbstractNotificationDAOImpl {
+
+ @Override
+ public List getAllNotifications(PaginationRequest request, int tenantId) throws
+ NotificationManagementException {
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql =
+ "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
+ " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
+ "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
+
+ sql = sql + " LIMIT ?,?";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setInt(2, tenantId);
+ int paramIdx = 3;
+
+ stmt.setInt(paramIdx++, request.getStartIndex());
+ stmt.setInt(paramIdx, request.getRowCount());
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all notifications", e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+
+
+ @Override
+ public List getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
+ NotificationManagementException{
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
+ " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
+ "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
+ "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
+ "AND TENANT_ID = ?";
+
+ sql = sql + " LIMIT ?,?";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setString(2, status.toString());
+ stmt.setInt(3, tenantId);
+
+ int paramIdx = 4;
+
+ stmt.setInt(paramIdx++, request.getStartIndex());
+ stmt.setInt(paramIdx, request.getRowCount());
+
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all " +
+ "notifications by status : " + status, e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java
new file mode 100644
index 0000000000..829e586d79
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. 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.notification.mgt.dao.impl;
+
+import org.wso2.carbon.device.mgt.common.PaginationRequest;
+import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
+import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class holds the Oracle implementation of NotificationDAO which can be used to support Oracle db syntax.
+ */
+public class OracleNotificationDAOImpl extends AbstractNotificationDAOImpl {
+
+ @Override
+ public List getAllNotifications(PaginationRequest request, int tenantId) throws
+ NotificationManagementException {
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql =
+ "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
+ " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
+ "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
+
+ sql = sql + " WHERE OFFSET >= ? AND ROWNUM <= ?";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setInt(2, tenantId);
+ int paramIdx = 3;
+
+ stmt.setInt(paramIdx++, request.getStartIndex());
+ stmt.setInt(paramIdx, request.getRowCount());
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all notifications", e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+
+
+ @Override
+ public List getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
+ NotificationManagementException{
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
+ " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
+ "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
+ "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
+ "AND TENANT_ID = ?";
+
+ sql = sql + " OFFSET >= ? AND ROWNUM <= ?";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setString(2, status.toString());
+ stmt.setInt(3, tenantId);
+
+ int paramIdx = 4;
+
+ stmt.setInt(paramIdx++, request.getStartIndex());
+ stmt.setInt(paramIdx, request.getRowCount());
+
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all " +
+ "notifications by status : " + status, e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/PostgreSQLNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/PostgreSQLNotificationDAOImpl.java
new file mode 100644
index 0000000000..2039c04cbc
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/PostgreSQLNotificationDAOImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. 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.notification.mgt.dao.impl;
+
+import org.wso2.carbon.device.mgt.common.PaginationRequest;
+import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
+import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class holds the implementation of NotificationDAO which can be used to support PostgreSQL db syntax.
+ */
+public class PostgreSQLNotificationDAOImpl extends AbstractNotificationDAOImpl {
+
+ @Override
+ public List getAllNotifications(PaginationRequest request, int tenantId) throws
+ NotificationManagementException {
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql =
+ "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
+ " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
+ "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
+
+ sql = sql + " LIMIT ? OFFSET ?";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setInt(2, tenantId);
+ int paramIdx = 3;
+
+ stmt.setInt(paramIdx++, request.getRowCount());
+ stmt.setInt(paramIdx, request.getStartIndex());
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all notifications", e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+
+
+ @Override
+ public List getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
+ NotificationManagementException{
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
+ " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
+ "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
+ "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
+ "AND TENANT_ID = ?";
+
+ sql = sql + " LIMIT ? OFFSET ?";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setString(2, status.toString());
+ stmt.setInt(3, tenantId);
+
+ int paramIdx = 4;
+
+ stmt.setInt(paramIdx++, request.getRowCount());
+ stmt.setInt(paramIdx, request.getStartIndex());
+
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all " +
+ "notifications by status : " + status, e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/SQLServerNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/SQLServerNotificationDAOImpl.java
new file mode 100644
index 0000000000..e03a220ed1
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/SQLServerNotificationDAOImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. 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.notification.mgt.dao.impl;
+
+import org.wso2.carbon.device.mgt.common.PaginationRequest;
+import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
+import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
+import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class holds the implementation of NotificationDAO which can be used to support SQLServer db syntax.
+ */
+public class SQLServerNotificationDAOImpl extends AbstractNotificationDAOImpl {
+
+ @Override
+ public List getAllNotifications(PaginationRequest request, int tenantId) throws
+ NotificationManagementException {
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql =
+ "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," +
+ " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " +
+ "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?";
+
+ sql = sql + " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setInt(2, tenantId);
+ int paramIdx = 3;
+
+ stmt.setInt(paramIdx++, request.getStartIndex());
+ stmt.setInt(paramIdx, request.getRowCount());
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all notifications", e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+
+
+ @Override
+ public List getNotificationsByStatus(PaginationRequest request, Notification.Status status, int tenantId) throws
+ NotificationManagementException{
+ Connection conn;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ List notifications = null;
+ try {
+ conn = NotificationManagementDAOFactory.getConnection();
+ String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," +
+ " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " +
+ "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " +
+ "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " +
+ "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " +
+ "AND TENANT_ID = ?";
+
+ sql = sql + " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
+
+ stmt = conn.prepareStatement(sql);
+ stmt.setInt(1, tenantId);
+ stmt.setString(2, status.toString());
+ stmt.setInt(3, tenantId);
+
+ int paramIdx = 4;
+
+ stmt.setInt(paramIdx++, request.getStartIndex());
+ stmt.setInt(paramIdx, request.getRowCount());
+
+
+ rs = stmt.executeQuery();
+ notifications = new ArrayList<>();
+ while (rs.next()) {
+ notifications.add(NotificationDAOUtil.getNotification(rs));
+ }
+ } catch (SQLException e) {
+ throw new NotificationManagementException(
+ "Error occurred while retrieving information of all " +
+ "notifications by status : " + status, e);
+ } finally {
+ NotificationDAOUtil.cleanupResources(stmt, rs);
+ }
+ return notifications;
+ }
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java
index 5c87e1b311..36f7df6be0 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java
@@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.core.notification.mgt.dao.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
+import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.user.api.UserStoreException;
@@ -123,4 +124,13 @@ public class NotificationDAOUtil {
throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e);
}
}
+
+ public static Notification getNotification(ResultSet rs) throws SQLException {
+ Notification notification = new Notification();
+ notification.setNotificationId(rs.getInt("NOTIFICATION_ID"));
+ notification.setOperationId(rs.getInt("OPERATION_ID"));
+ notification.setDescription(rs.getString("DESCRIPTION"));
+ notification.setStatus(rs.getString("STATUS"));
+ return notification;
+ }
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java
index 0d107ead1d..c9ddcb3d91 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java
@@ -46,8 +46,8 @@ public class PostgreSQLOperationDAOImpl extends GenericOperationDAOImpl {
List operations = new ArrayList();
try {
Connection conn = OperationManagementDAOFactory.getConnection();
- String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
- "OPERATION_CODE, om.STATUS FROM DM_OPERATION o " +
+ String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " +
+ "o.OPERATION_CODE, om.STATUS FROM DM_OPERATION o " +
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ? OFFSET ?";
stmt = conn.prepareStatement(sql);
@@ -72,7 +72,7 @@ public class PostgreSQLOperationDAOImpl extends GenericOperationDAOImpl {
}
} catch (SQLException e) {
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
- "available for the device'" + enrolmentId + "' with status '", e);
+ "available for the device'" + enrolmentId, e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt, rs);
}
@@ -89,7 +89,7 @@ public class PostgreSQLOperationDAOImpl extends GenericOperationDAOImpl {
List operations = new ArrayList();
try {
Connection conn = OperationManagementDAOFactory.getConnection();
- String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " +
+ String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE " +
"FROM DM_OPERATION o " +
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " +
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/EvaluationContext.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/EvaluationContext.java
deleted file mode 100644
index fb62730082..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/EvaluationContext.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-public class EvaluationContext {
-
-
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyEvaluationException.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyEvaluationException.java
deleted file mode 100644
index 569f311aa6..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyEvaluationException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-public class PolicyEvaluationException extends Exception {
-
-
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyEvaluationStrategy.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyEvaluationStrategy.java
deleted file mode 100644
index bd4557eeb0..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyEvaluationStrategy.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-public interface PolicyEvaluationStrategy {
-
- Profile execute(EvaluationContext ctx) throws PolicyEvaluationException;
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyManagementException.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyManagementException.java
deleted file mode 100644
index a36bd28fda..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyManagementException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-public class PolicyManagementException extends Exception {
-
-
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyManager.java
deleted file mode 100644
index a69068a003..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyManager.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
-import org.wso2.carbon.device.mgt.core.policy.mgt.policy.Policy;
-
-import java.util.List;
-
-public interface PolicyManager {
-
- public enum Type {
- USER_BASED, ROLE_BASED, PLATFORM_BASED
- }
-
- boolean addPolicy(Policy policy) throws PolicyManagementException;
-
- boolean removePolicy(String policyId) throws PolicyManagementException;
-
- boolean updatePolicy(Policy policy) throws PolicyManagementException;
-
- Policy getPolicy(String policyId) throws PolicyManagementException;
-
- List getPolicies() throws PolicyManagementException;
-
- List getUserBasedPolicies(String user) throws PolicyManagementException;
-
- List getRoleBasedPolicies(String role) throws PolicyManagementException;
-
- List getPlatformBasedPolicies(String platform) throws PolicyManagementException;
-
- boolean assignRoleBasedPolicy(String policyId, String role) throws PolicyManagementException;
-
- boolean assignRoleBasedPolicy(String policyId, List roles) throws PolicyManagementException;
-
- boolean assignUserBasedPolicy(String policyId, String user) throws PolicyManagementException;
-
- boolean assignUserBasedPolicy(String policyId, List users) throws PolicyManagementException;
-
- boolean assignPlatformBasedPolicy(String policyId, String platform) throws PolicyManagementException;
-
- Profile getEffectiveProfile(DeviceIdentifier deviceId) throws PolicyManagementException;
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyRepository.java
deleted file mode 100644
index 1e16c2a58f..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/PolicyRepository.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-import org.wso2.carbon.device.mgt.core.policy.mgt.policy.Policy;
-
-public interface PolicyRepository {
-
- public enum Type {
- USER_BASED, ROLE_BASED, PLATFORM_BASED
- }
-
- void addPolicy(Policy policy) throws PolicyManagementException;
-
- void remotePolicy(Policy policy) throws PolicyManagementException;
-
- void getPolicy(String id) throws PolicyManagementException;
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/Profile.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/Profile.java
deleted file mode 100644
index 70f1b4269f..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/Profile.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-public class Profile {
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/Rule.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/Rule.java
deleted file mode 100644
index ad40cff1af..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/Rule.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-public class Rule {
-
-
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/RuleCombiningStrategy.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/RuleCombiningStrategy.java
deleted file mode 100644
index 862089c135..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/RuleCombiningStrategy.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt;
-
-public interface RuleCombiningStrategy {
-
-
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAO.java
deleted file mode 100644
index db6354b008..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAO.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt.dao;
-
-public interface PolicyDAO {
-
-
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAOFactory.java
deleted file mode 100644
index 5e5c570e62..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAOFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt.dao;
-
-public class PolicyDAOFactory {
-
- public static PolicyDAO getPolicyDAO() {
- return new PolicyDAOImpl();
- }
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAOImpl.java
deleted file mode 100644
index de2de21bd7..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/dao/PolicyDAOImpl.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt.dao;
-
-public class PolicyDAOImpl implements PolicyDAO {
-
-
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/PlatformBasedPolicy.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/PlatformBasedPolicy.java
deleted file mode 100644
index 4914a33f26..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/PlatformBasedPolicy.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt.policy;
-
-public class PlatformBasedPolicy extends Policy {
-
- private String platform;
-
- public String getPlatform() {
- return platform;
- }
-
- public void setPlatform(String platform) {
- this.platform = platform;
- }
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/Policy.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/Policy.java
deleted file mode 100644
index a528c09eed..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/Policy.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt.policy;
-
-public class Policy {
-
- private String id;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/RoleBasedPolicy.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/RoleBasedPolicy.java
deleted file mode 100644
index c08544f125..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/RoleBasedPolicy.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt.policy;
-
-public class RoleBasedPolicy extends Policy {
-
- private String role;
-
- public String getRole() {
- return role;
- }
-
- public void setRole(String role) {
- this.role = role;
- }
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/UsedBasedPolicy.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/UsedBasedPolicy.java
deleted file mode 100644
index 0eb9417826..0000000000
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/policy/mgt/policy/UsedBasedPolicy.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.policy.mgt.policy;
-
-public class UsedBasedPolicy extends Policy {
-
- private String username;
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
-}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js
index 720cbc4629..8e885cd00b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js
@@ -218,7 +218,8 @@ var userModule = function () {
}
try {
utility.startTenantFlow(carbonUser);
- var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/roles";
+ var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] +
+ "/roles?offset=0&limit=100";
var response = privateMethods.callBackend(url, constants["HTTP_GET"]);
if (response.status == "success") {
response.content = parse(response.content).roles;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js
index fa71ce1475..185f82d857 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js
@@ -92,13 +92,10 @@ var invokers = function () {
xmlHttpRequest.send();
}
- log.debug("Service Invoker-URL: " + endpoint);
- log.debug("Service Invoker-Method: " + httpMethod);
-
-// log.info("Request : " + httpMethod + " " + endpoint);
-// log.info("Request payload if any : " + stringify(requestPayload));
-// log.info("Response status : " + xmlHttpRequest.status);
-// log.info("Response payload if any : " + xmlHttpRequest.responseText);
+ log.debug("Request : " + httpMethod + " " + endpoint);
+ log.debug("Request payload if any : " + stringify(requestPayload));
+ log.debug("Response status : " + xmlHttpRequest.status);
+ log.debug("Response payload if any : " + xmlHttpRequest.responseText);
if (xmlHttpRequest.status == 401 && (xmlHttpRequest.responseText == TOKEN_EXPIRED ||
xmlHttpRequest.responseText == TOKEN_INVALID ) && count < 5) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs
index 360523ebb1..465c832195 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.create/create.hbs
@@ -2,20 +2,21 @@
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. 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
+ 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
+ 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
+ "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.
}}
-{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
+
+{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | Add Policy"}}
{{#zone "breadcrumbs"}}
@@ -24,6 +25,7 @@
+
Policies
@@ -36,5 +38,6 @@
{{/zone}}
{{#zone "content"}}
+ {{unit "cdmf.unit.device.operation-mod"}}
{{unit "cdmf.unit.policy.create"}}
{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs
index c6519777db..9d7f4445bd 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.hbs
@@ -2,20 +2,21 @@
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. 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
+ 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
+ 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
+ "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.
}}
-{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
+
+{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | Edit Policy"}}
{{#zone "breadcrumbs"}}
@@ -24,6 +25,7 @@
+
Policies
@@ -36,5 +38,6 @@
{{/zone}}
{{#zone "content"}}
- {{unit deviceTypePolicyEdit}}
+ {{unit "cdmf.unit.device.operation-mod"}}
+ {{unit "cdmf.unit.policy.edit"}}
{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js
index e39d8b9316..2bed273c68 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.js
@@ -16,8 +16,8 @@
* under the License.
*/
-function onRequest(context) {
- var utility = require("/app/modules/utility.js").utility;
- var deviceType = request.getParameter("type");
- return {"deviceTypePolicyEdit": utility.getTenantedDeviceUnitName(deviceType, "policy-edit")};
-}
+//function onRequest(context) {
+// var utility = require("/app/modules/utility.js").utility;
+// var deviceType = request.getParameter("type");
+// return {"deviceTypePolicyEdit": utility.getTenantedDeviceUnitName(deviceType, "policy-edit")};
+//}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json
index fcddd12965..f2122eb998 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.edit/edit.json
@@ -1,5 +1,5 @@
{
"version": "1.0.0",
- "uri": "/policy/edit",
+ "uri": "/policy/edit",
"layout": "cdmf.layout.default"
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs
index f3113d2069..ad8f81f82a 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs
@@ -2,20 +2,21 @@
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. 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
+ 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
+ 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
+ "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.
}}
-{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
+
+{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | View Policy"}}
{{#zone "breadcrumbs"}}
@@ -24,6 +25,7 @@
+
Policies
@@ -36,5 +38,6 @@
{{/zone}}
{{#zone "content"}}
- {{unit deviceTypePolicyView}}
+ {{unit "cdmf.unit.device.operation-mod"}}
+ {{unit "cdmf.unit.policy.view"}}
{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js
index 58829242be..af7a8e700a 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js
@@ -16,8 +16,8 @@
* under the License.
*/
-function onRequest(context) {
- var utility = require("/app/modules/utility.js").utility;
- var deviceType = request.getParameter("type");
- return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view")};
-}
+//function onRequest(context) {
+// var utility = require("/app/modules/utility.js")["utility"];
+// var deviceType = request.getParameter("type");
+// return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view")};
+//}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json
index 77ddf10eaa..a4d19525f6 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.json
@@ -1,5 +1,5 @@
{
"version": "1.0.0",
- "uri": "/policy/view",
+ "uri": "/policy/view",
"layout": "cdmf.layout.default"
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js
index 8c115f0a97..3f1219765d 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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
+ * 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
+ * "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.
*/
@@ -37,12 +37,50 @@ var operationModule = function () {
// Constants to define Android Operation Constants
var androidOperationConstants = {
"PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY",
+ "VPN_OPERATION_CODE": "VPN",
"CAMERA_OPERATION_CODE": "CAMERA",
"ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE",
"WIFI_OPERATION_CODE": "WIFI",
"WIPE_OPERATION_CODE": "WIPE_DATA",
"NOTIFICATION_OPERATION_CODE": "NOTIFICATION",
- "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE"
+ "WORK_PROFILE_CODE": "WORK_PROFILE",
+ "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE",
+ "LOCK_OPERATION_CODE": "DEVICE_LOCK",
+ "UPGRADE_FIRMWARE": "UPGRADE_FIRMWARE",
+ "DISALLOW_ADJUST_VOLUME": "DISALLOW_ADJUST_VOLUME",
+ "DISALLOW_CONFIG_BLUETOOTH" : "DISALLOW_CONFIG_BLUETOOTH",
+ "DISALLOW_CONFIG_CELL_BROADCASTS" : "DISALLOW_CONFIG_CELL_BROADCASTS",
+ "DISALLOW_CONFIG_CREDENTIALS" : "DISALLOW_CONFIG_CREDENTIALS",
+ "DISALLOW_CONFIG_MOBILE_NETWORKS" : "DISALLOW_CONFIG_MOBILE_NETWORKS",
+ "DISALLOW_CONFIG_TETHERING" : "DISALLOW_CONFIG_TETHERING",
+ "DISALLOW_CONFIG_VPN" : "DISALLOW_CONFIG_VPN",
+ "DISALLOW_CONFIG_WIFI" : "DISALLOW_CONFIG_WIFI",
+ "DISALLOW_APPS_CONTROL" : "DISALLOW_APPS_CONTROL",
+ "DISALLOW_CREATE_WINDOWS" : "DISALLOW_CREATE_WINDOWS",
+ "DISALLOW_CROSS_PROFILE_COPY_PASTE" : "DISALLOW_CROSS_PROFILE_COPY_PASTE",
+ "DISALLOW_DEBUGGING_FEATURES" : "DISALLOW_DEBUGGING_FEATURES",
+ "DISALLOW_FACTORY_RESET" : "DISALLOW_FACTORY_RESET",
+ "DISALLOW_ADD_USER" : "DISALLOW_ADD_USER",
+ "DISALLOW_INSTALL_APPS" : "DISALLOW_INSTALL_APPS",
+ "DISALLOW_INSTALL_UNKNOWN_SOURCES" : "DISALLOW_INSTALL_UNKNOWN_SOURCES",
+ "DISALLOW_MODIFY_ACCOUNTS" : "DISALLOW_MODIFY_ACCOUNTS",
+ "DISALLOW_MOUNT_PHYSICAL_MEDIA" : "DISALLOW_MOUNT_PHYSICAL_MEDIA",
+ "DISALLOW_NETWORK_RESET" : "DISALLOW_NETWORK_RESET",
+ "DISALLOW_OUTGOING_BEAM" : "DISALLOW_OUTGOING_BEAM",
+ "DISALLOW_OUTGOING_CALLS" : "DISALLOW_OUTGOING_CALLS",
+ "DISALLOW_REMOVE_USER" : "DISALLOW_REMOVE_USER",
+ "DISALLOW_SAFE_BOOT" : "DISALLOW_SAFE_BOOT",
+ "DISALLOW_SHARE_LOCATION" : "DISALLOW_SHARE_LOCATION",
+ "DISALLOW_SMS" : "DISALLOW_SMS",
+ "DISALLOW_UNINSTALL_APPS" : "DISALLOW_UNINSTALL_APPS",
+ "DISALLOW_UNMUTE_MICROPHONE" : "DISALLOW_UNMUTE_MICROPHONE",
+ "DISALLOW_USB_FILE_TRANSFER" : "DISALLOW_USB_FILE_TRANSFER",
+ "ALLOW_PARENT_PROFILE_APP_LINKING" : "ALLOW_PARENT_PROFILE_APP_LINKING",
+ "ENSURE_VERIFY_APPS" : "ENSURE_VERIFY_APPS",
+ "AUTO_TIME" : "AUTO_TIME",
+ "SET_SCREEN_CAPTURE_DISABLED" : "SET_SCREEN_CAPTURE_DISABLED",
+ "SET_STATUS_BAR_DISABLED" : "SET_STATUS_BAR_DISABLED",
+ "APPLICATION_OPERATION_CODE":"APP-RESTRICTION"
};
// Constants to define Windows Operation Constants
@@ -58,6 +96,7 @@ var operationModule = function () {
var iosOperationConstants = {
"PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY",
"RESTRICTIONS_OPERATION_CODE": "RESTRICTION",
+ "VPN_OPERATION_CODE": "VPN",
"WIFI_OPERATION_CODE": "WIFI",
"EMAIL_OPERATION_CODE": "EMAIL",
"AIRPLAY_OPERATION_CODE": "AIR_PLAY",
@@ -66,12 +105,18 @@ var operationModule = function () {
"NOTIFICATION_OPERATION_CODE": "NOTIFICATION",
"CALENDAR_SUBSCRIPTION_OPERATION_CODE": "CALENDAR_SUBSCRIPTION",
"APN_OPERATION_CODE": "APN",
- "CELLULAR_OPERATION_CODE": "CELLULAR"
+ "DOMAIN_CODE": "DOMAIN",
+ "CELLULAR_OPERATION_CODE": "CELLULAR",
+ "PER_APP_VPN_OPERATION_CODE": "PER_APP_VPN",
+ "APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE": "APP_TO_PER_APP_VPN_MAPPING"
};
publicMethods.getIOSServiceEndpoint = function (operationCode) {
var featureMap = {
"DEVICE_LOCK": "lock",
+ "VPN": "vpn",
+ "PER_APP_VPN": "perappvpn",
+ "APP_TO_PER_APP_VPN_MAPPING": "apptoperappvpnmapping",
"RING": "ring",
"LOCATION": "location",
"NOTIFICATION": "notification",
@@ -182,6 +227,76 @@ var operationModule = function () {
"restrictionsAutonomousSingleAppModePermittedAppIDs": operationPayload["autonomousSingleAppModePermittedAppIDs"]
};
break;
+ case iosOperationConstants["VPN_OPERATION_CODE"]:
+ var pptp = false;
+ var l2tp = false;
+ if (operationPayload["vpnType"] == "PPTP") {
+ pptp = true;
+ } else if (operationPayload["vpnType"] == "L2TP") {
+ l2tp = true;
+ }
+
+ payload = {
+ "userDefinedName": operationPayload["userDefinedName"],
+ "overridePrimary": operationPayload["overridePrimary"],
+ "onDemandEnabled": operationPayload["onDemandEnabled"],
+ "onDemandMatchDomainsAlways": operationPayload["onDemandMatchDomainsAlways"],
+ "onDemandMatchDomainsNever": operationPayload["onDemandMatchDomainsNever"],
+ "onDemandMatchDomainsOnRetry": operationPayload["onDemandMatchDomainsOnRetry"],
+ "onDemandRules": operationPayload["onDemandRules"],
+ "vendorConfigs": operationPayload["vendorConfigs"],
+ "vpnType": operationPayload["vpnType"],
+ "pptpAuthName": pptp ? operationPayload.ppp["authName"] : "",
+ "pptpTokenCard": pptp ? operationPayload.ppp["tokenCard"] : "",
+ "pptpAuthPassword": pptp ? operationPayload.ppp["authPassword"] : "",
+ "pptpCommRemoteAddress": pptp ? operationPayload.ppp["commRemoteAddress"] : "",
+ "pptpRSASecureID": pptp ? operationPayload.ppp["RSASecureID"] : "",
+ "pptpCCPEnabled": pptp ? operationPayload.ppp["CCPEnabled"] : "",
+ "pptpCCPMPPE40Enabled": pptp ? operationPayload.ppp["CCPMPPE40Enabled"] : "",
+ "pptpCCPMPPE128Enabled": pptp ? operationPayload.ppp["CCPMPPE128Enabled"] : "",
+ "l2tpAuthName": l2tp ? operationPayload.ppp["authName"] : "",
+ "l2tpTokenCard": l2tp ? operationPayload.ppp["tokenCard"] : "",
+ "l2tpAuthPassword": l2tp ? operationPayload.ppp["authPassword"] : "",
+ "l2tpCommRemoteAddress": l2tp ? operationPayload.ppp["commRemoteAddress"] : "",
+ "l2tpRSASecureID": l2tp ? operationPayload.ppp["RSASecureID"] : "",
+ "ipsecRemoteAddress": operationPayload.ipSec["remoteAddress"],
+ "ipsecAuthenticationMethod": operationPayload.ipSec["authenticationMethod"],
+ "ipsecLocalIdentifier": operationPayload.ipSec["localIdentifier"],
+ "ipsecSharedSecret": operationPayload.ipSec["sharedSecret"],
+ "ipsecPayloadCertificateUUID": operationPayload.ipSec["payloadCertificateUUID"],
+ "ipsecXAuthEnabled": operationPayload.ipSec["XAuthEnabled"],
+ "ipsecXAuthName": operationPayload.ipSec["XAuthName"],
+ "ipsecPromptForVPNPIN": operationPayload.ipSec["promptForVPNPIN"],
+ "ikev2RemoteAddress": operationPayload.ikEv2["remoteAddress"],
+ "ikev2LocalIdentifier": operationPayload.ikEv2["localIdentifier"],
+ "ikev2RemoteIdentifier": operationPayload.ikEv2["remoteIdentifier"],
+ "ikev2AuthenticationMethod": operationPayload.ikEv2["authenticationMethod"],
+ "ikev2SharedSecret": operationPayload.ikEv2["sharedSecret"],
+ "ikev2PayloadCertificateUUID": operationPayload.ikEv2["payloadCertificateUUID"],
+ "ikev2ExtendedAuthEnabled": operationPayload.ikEv2["extendedAuthEnabled"],
+ "ikev2AuthName": operationPayload.ikEv2["authName"],
+ "ikev2AuthPassword": operationPayload.ikEv2["authPassword"],
+ "ikev2DeadPeerDetectionInterval": operationPayload.ikEv2["deadPeerDetectionInterval"],
+ "ikev2ServerCertificateIssuerCommonName": operationPayload.ikEv2["serverCertificateIssuerCommonName"],
+ "ikev2ServerCertificateCommonName": operationPayload.ikEv2["serverCertificateCommonName"]
+ };
+ break;
+ case iosOperationConstants["PER_APP_VPN_OPERATION_CODE"]:
+ payload = {
+ "operation": {
+ "VPNUUID": operationPayload["PER-APP-VPNUUID"],
+ "safariDomains": operationPayload["safariDomains"],
+ "onDemandMatchAppEnabled": operationPayload["onDemandMatchAppEnabled"]
+ }
+ };
+ break;
+ case iosOperationConstants["APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE"]:
+ payload = {
+ "operation": {
+ "appLayerVPNMappings": operationPayload["appLayerVPNMappings"]
+ }
+ };
+ break;
case iosOperationConstants["WIFI_OPERATION_CODE"]:
payload = {
"wifiHiddenNetwork": operationPayload["hiddenNetwork"],
@@ -367,6 +482,112 @@ var operationModule = function () {
}
};
break;
+ case iosOperationConstants["VPN_OPERATION_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ var ppp = {};
+ var ipSec = {};
+ var ikev2 = {};
+ if (operationData["vpnType"] == "PPTP") {
+ ppp = {
+ "authName": operationData["pptpAuthName"],
+ "tokenCard": operationData["pptpTokenCard"],
+ "authPassword": operationData["pptpAuthPassword"],
+ "commRemoteAddress": operationData["pptpCommRemoteAddress"],
+ "RSASecureID": operationData["pptpRSASecureID"],
+ "CCPEnabled": operationData["pptpCCPEnabled"],
+ "CCPMPPE40Enabled": operationData["pptpCCPMPPE40Enabled"],
+ "CCPMPPE128Enabled": operationData["pptpCCPMPPE128Enabled"]
+ };
+ } else if (operationData["vpnType"] == "L2TP") {
+ ppp = {
+ "authName": operationData["l2tpAuthName"],
+ "tokenCard": operationData["l2tpTokenCard"],
+ "authPassword": operationData["l2tpAuthPassword"],
+ "commRemoteAddress": operationData["l2tpCommRemoteAddress"],
+ "RSASecureID": operationData["l2tpRSASecureID"]
+ };
+ } else if (operationData["vpnType"] == "IPSec") {
+ ipSec = {
+ "remoteAddress" : operationData["ipsecRemoteAddress"],
+ "authenticationMethod" : operationData["ipsecAuthenticationMethod"],
+ "localIdentifier" : operationData["ipsecLocalIdentifier"],
+ "sharedSecret" : operationData["ipsecSharedSecret"],
+ "payloadCertificateUUID" : operationData["ipsecPayloadCertificateUUID"],
+ "XAuthEnabled" : operationData["ipsecXAuthEnabled"],
+ "XAuthName" : operationData["ipsecXAuthName"],
+ "promptForVPNPIN" : operationData["ipsecPromptForVPNPIN"]
+ };
+ } else if (operationData["vpnType"] == "IKEv2") {
+ ikev2 = {
+ "remoteAddress" : operationData["ikev2RemoteAddress"],
+ "localIdentifier" : operationData["ikev2LocalIdentifier"],
+ "remoteIdentifier" : operationData["ikev2RemoteIdentifier"],
+ "authenticationMethod" : operationData["ikev2AuthenticationMethod"],
+ "sharedSecret" : operationData["ikev2SharedSecret"],
+ "payloadCertificateUUID" : operationData["ikev2PayloadCertificateUUID"],
+ "extendedAuthEnabled" : operationData["ikev2ExtendedAuthEnabled"],
+ "authName" : operationData["ikev2AuthName"],
+ "authPassword" : operationData["ikev2AuthPassword"],
+ "deadPeerDetectionInterval" : operationData["ikev2DeadPeerDetectionInterval"],
+ "serverCertificateIssuerCommonName" : operationData["ikev2ServerCertificateIssuerCommonName"],
+ "serverCertificateCommonName" : operationData["ikev2ServerCertificateCommonName"]
+ };
+ }
+
+ var domainsAlways = new Array();
+ for (var i = 0; i < operationData["onDemandMatchDomainsAlways"].length; i++) {
+ domainsAlways.push(operationData["onDemandMatchDomainsAlways"][i].domain);
+ }
+
+ var domainsNever = new Array();
+ for (var i = 0; i < operationData["onDemandMatchDomainsNever"].length; i++) {
+ domainsNever.push(operationData["onDemandMatchDomainsNever"][i].domain);
+ }
+
+ var domainsRetry = new Array();
+ for (var i = 0; i < operationData["onDemandMatchDomainsOnRetry"].length; i++) {
+ domainsRetry.push(operationData["onDemandMatchDomainsOnRetry"][i].domain);
+ }
+
+ payload = {
+ "operation": {
+ "userDefinedName": operationData["userDefinedName"],
+ "overridePrimary": operationData["overridePrimary"],
+ "onDemandEnabled": operationData["onDemandEnabled"],
+ "onDemandMatchDomainsAlways": domainsAlways,
+ "onDemandMatchDomainsNever": domainsNever,
+ "onDemandMatchDomainsOnRetry": domainsRetry,
+ "onDemandRules" : operationData["onDemandRules"],
+ "vendorConfigs" : operationData["vendorConfigs"],
+ "vpnType" : operationData["vpnType"],
+ "ppp": ppp,
+ "ipSec": ipSec,
+ "ikEv2": ikev2
+ }
+ };
+ break;
+ case iosOperationConstants["PER_APP_VPN_OPERATION_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ var domains = new Array();
+ for (var i = 0; i < operationData["safariDomains"].length; i++) {
+ domains.push(operationData["safariDomains"][i].domain);
+ }
+ payload = {
+ "operation": {
+ "VPNUUID": operationData["VPNUUID"],
+ "safariDomains": domains,
+ "onDemandMatchAppEnabled": operationData["onDemandMatchAppEnabled"]
+ }
+ };
+ break;
+ case iosOperationConstants["APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ payload = {
+ "operation": {
+ "appLayerVPNMappings": operationData["appLayerVPNMappings"]
+ }
+ };
+ break;
case iosOperationConstants["RESTRICTIONS_OPERATION_CODE"]:
operationType = operationTypeConstants["PROFILE"];
payload = {
@@ -528,6 +749,15 @@ var operationModule = function () {
}
};
break;
+ case iosOperationConstants["DOMAIN_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ payload = {
+ "operation": {
+ "emailDomains": operationData["emailDomains"],
+ "webDomains": operationData["webDomains"]
+ }
+ };
+ break;
case iosOperationConstants["CELLULAR_OPERATION_CODE"]:
operationType = operationTypeConstants["PROFILE"];
payload = {
@@ -584,9 +814,7 @@ var operationModule = function () {
};
break;
case androidOperationConstants["CAMERA_OPERATION_CODE"]:
- payload = {
- "cameraEnabled": operationPayload["enabled"]
- };
+ payload = operationPayload;
break;
case androidOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]:
payload = {
@@ -596,7 +824,29 @@ var operationModule = function () {
case androidOperationConstants["WIFI_OPERATION_CODE"]:
payload = {
"wifiSSID": operationPayload["ssid"],
- "wifiPassword": operationPayload["password"]
+ "wifiPassword": operationPayload["password"],
+ "wifiType": operationPayload["type"],
+ "wifiEAP": operationPayload["eap"],
+ "wifiPhase2": operationPayload["phase2"],
+ "wifiProvisioning": operationPayload["provisioning"],
+ "wifiIdentity": operationPayload["identity"],
+ "wifiAnoIdentity": operationPayload["anonymousIdentity"],
+ "wifiCaCert" : operationPayload["cacert"],
+ "wifiCaCertName" : operationPayload["cacertName"]
+ };
+ break;
+ case androidOperationConstants["VPN_OPERATION_CODE"]:
+ payload = {
+ "serverAddress": operationPayload["serverAddress"],
+ "serverPort": operationPayload["serverPort"],
+ "sharedSecret": operationPayload["sharedSecret"],
+ "dnsServer": operationPayload["dnsServer"]
+ };
+ break;
+ case androidOperationConstants["APPLICATION_OPERATION_CODE"]:
+ payload = {
+ "restrictionType": operationPayload["restriction-type"],
+ "restrictedApplications": operationPayload["restricted-applications"]
};
break;
}
@@ -611,7 +861,40 @@ var operationModule = function () {
operationType = operationTypeConstants["PROFILE"];
payload = {
"operation": {
- "enabled" : operationData["cameraEnabled"]
+ "CAMERA" : operationData["cameraEnabled"],
+ "DISALLOW_ADJUST_VOLUME" : operationData["disallowAdjustVolumeEnabled"],
+ "DISALLOW_CONFIG_BLUETOOTH" : operationData["disallowConfigBluetooth"],
+ "DISALLOW_CONFIG_CELL_BROADCASTS" : operationData["disallowConfigCellBroadcasts"],
+ "DISALLOW_CONFIG_CREDENTIALS" : operationData["disallowConfigCredentials"],
+ "DISALLOW_CONFIG_MOBILE_NETWORKS" : operationData["disallowConfigMobileNetworks"],
+ "DISALLOW_CONFIG_TETHERING" : operationData["disallowConfigTethering"],
+ "DISALLOW_CONFIG_VPN" : operationData["disallowConfigVpn"],
+ "DISALLOW_CONFIG_WIFI" : operationData["disallowConfigWifi"],
+ "DISALLOW_APPS_CONTROL" : operationData["disallowAppControl"],
+ "DISALLOW_CREATE_WINDOWS" : operationData["disallowCreateWindows"],
+ "DISALLOW_CROSS_PROFILE_COPY_PASTE" : operationData["disallowCrossProfileCopyPaste"],
+ "DISALLOW_DEBUGGING_FEATURES" : operationData["disallowDebugging"],
+ "DISALLOW_FACTORY_RESET" : operationData["disallowFactoryReset"],
+ "DISALLOW_ADD_USER" : operationData["disallowAddUser"],
+ "DISALLOW_INSTALL_APPS" : operationData["disallowInstallApps"],
+ "DISALLOW_INSTALL_UNKNOWN_SOURCES" : operationData["disallowInstallUnknownSources"],
+ "DISALLOW_MODIFY_ACCOUNTS" : operationData["disallowModifyAccounts"],
+ "DISALLOW_MOUNT_PHYSICAL_MEDIA" : operationData["disallowMountPhysicalMedia"],
+ "DISALLOW_NETWORK_RESET" : operationData["disallowNetworkReset"],
+ "DISALLOW_OUTGOING_BEAM" : operationData["disallowOutgoingBeam"],
+ "DISALLOW_OUTGOING_CALLS" : operationData["disallowOutgoingCalls"],
+ "DISALLOW_REMOVE_USER" : operationData["disallowRemoveUser"],
+ "DISALLOW_SAFE_BOOT" : operationData["disallowSafeBoot"],
+ "DISALLOW_SHARE_LOCATION" : operationData["disallowLocationSharing"],
+ "DISALLOW_SMS" : operationData["disallowSMS"],
+ "DISALLOW_UNINSTALL_APPS" : operationData["disallowUninstallApps"],
+ "DISALLOW_UNMUTE_MICROPHONE" : operationData["disallowUnmuteMicrophone"],
+ "DISALLOW_USB_FILE_TRANSFER" : operationData["disallowUSBFileTransfer"],
+ "ALLOW_PARENT_PROFILE_APP_LINKING" : operationData["disallowParentProfileAppLinking"],
+ "ENSURE_VERIFY_APPS" : operationData["ensureVerifyApps"],
+ "AUTO_TIME" : operationData["enableAutoTime"],
+ "SET_SCREEN_CAPTURE_DISABLED" : operationData["diableScreenCapture"],
+ "SET_STATUS_BAR_DISABLED" : operationData["disableStatusBar"]
}
};
break;
@@ -635,7 +918,18 @@ var operationModule = function () {
operationType = operationTypeConstants["PROFILE"];
payload = {
"operation": {
- "message" : operationData["message"]
+ //"message" : operationData["message"]
+ "messageText": operationData["messageText"],
+ "messageTitle": operationData["messageTitle"]
+ }
+ };
+ break;
+ case androidOperationConstants["UPGRADE_FIRMWARE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ payload = {
+ "operation": {
+ "schedule" : operationData["schedule"],
+ "server" : operationData["server"]
}
};
break;
@@ -652,7 +946,47 @@ var operationModule = function () {
payload = {
"operation": {
"ssid": operationData["wifiSSID"],
- "password": operationData["wifiPassword"]
+ "type": operationData["wifiType"],
+ "password" : operationData["wifiPassword"],
+ "eap" : operationData["wifiEAP"],
+ "phase2" : operationData["wifiPhase2"],
+ "provisioning" : operationData["wifiProvisioning"],
+ "identity" : operationData["wifiIdentity"],
+ "anonymousIdentity" : operationData["wifiAnoIdentity"],
+ "cacert" : operationData["wifiCaCert"],
+ "cacertName" : operationData["wifiCaCertName"]
+ }
+ };
+ break;
+ case androidOperationConstants["VPN_OPERATION_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ payload = {
+ "operation": {
+ "serverAddress": operationData["serverAddress"],
+ "serverPort": operationData["serverPort"],
+ "sharedSecret": operationData["sharedSecret"],
+ "dnsServer": operationData["dnsServer"]
+ }
+ };
+ break;
+ case androidOperationConstants["LOCK_OPERATION_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ payload = {
+ "operation": {
+ "message" : operationData["lock-message"],
+ "isHardLockEnabled" : operationData["hard-lock"]
+ }
+ };
+ break;
+ case androidOperationConstants["WORK_PROFILE_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ payload = {
+ "operation": {
+ "profileName": operationData["workProfilePolicyProfileName"],
+ "enableSystemApps": operationData["workProfilePolicyEnableSystemApps"],
+ "hideSystemApps": operationData["workProfilePolicyHideSystemApps"],
+ "unhideSystemApps": operationData["workProfilePolicyUnhideSystemApps"],
+ "enablePlaystoreApps": operationData["workProfilePolicyEnablePlaystoreApps"]
}
};
break;
@@ -670,6 +1004,14 @@ var operationModule = function () {
}
};
break;
+ case androidOperationConstants["APPLICATION_OPERATION_CODE"]:
+ payload = {
+ "operation": {
+ "restriction-type": operationData["restrictionType"],
+ "restricted-applications": operationData["restrictedApplications"]
+ }
+ };
+ break;
default:
// If the operation is neither of above, it is a command operation
operationType = operationTypeConstants["COMMAND"];
@@ -686,28 +1028,31 @@ var operationModule = function () {
publicMethods.getAndroidServiceEndpoint = function (operationCode) {
var featureMap = {
- "WIFI": "wifi",
- "CAMERA": "camera",
- "DEVICE_LOCK": "lock",
+ "WIFI": "configure-wifi",
+ "CAMERA": "control-camera",
+ "VPN": "configure-vpn",
+ "DEVICE_LOCK": "lock-devices",
+ "DEVICE_UNLOCK": "unlock-devices",
"DEVICE_LOCATION": "location",
"CLEAR_PASSWORD": "clear-password",
"APPLICATION_LIST": "get-application-list",
- "DEVICE_RING": "ring-device",
- "DEVICE_REBOOT": "reboot-device",
+ "DEVICE_RING": "ring",
+ "DEVICE_REBOOT": "reboot",
"UPGRADE_FIRMWARE": "upgrade-firmware",
"DEVICE_MUTE": "mute",
- "NOTIFICATION": "notification",
- "ENCRYPT_STORAGE": "encrypt",
+ "NOTIFICATION": "send-notification",
+ "ENCRYPT_STORAGE": "encrypt-storage",
"CHANGE_LOCK_CODE": "change-lock-code",
- "WEBCLIP": "webclip",
+ "WEBCLIP": "set-webclip",
"INSTALL_APPLICATION": "install-application",
"UNINSTALL_APPLICATION": "uninstall-application",
"BLACKLIST_APPLICATIONS": "blacklist-applications",
- "PASSCODE_POLICY": "password-policy",
+ "PASSCODE_POLICY": "set-password-policy",
"ENTERPRISE_WIPE": "enterprise-wipe",
- "WIPE_DATA": "wipe-data"
+ "WIPE_DATA": "wipe"
};
- return "/mdm-android-agent/operation/" + featureMap[operationCode];
+ //return "/mdm-android-agent/operation/" + featureMap[operationCode];
+ return "/api/device-mgt/android/v1.0/admin/devices/" + featureMap[operationCode];
};
/**
@@ -852,9 +1197,10 @@ var operationModule = function () {
"DEVICE_RING": "fw-dial-up",
"DEVICE_REBOOT": "fw-refresh",
"UPGRADE_FIRMWARE": "fw-up-arrow",
- "DEVICE_MUTE": "fw-incoming-call",
+ "DEVICE_MUTE": "fw-mute",
"NOTIFICATION": "fw-message",
- "CHANGE_LOCK_CODE": "fw-security"
+ "CHANGE_LOCK_CODE": "fw-security",
+ "DEVICE_UNLOCK": "fw-lock"
};
return featureMap[operationCode];
};
@@ -926,7 +1272,7 @@ var operationModule = function () {
var key = operationDataObj.data("key");
var value;
if (operationDataObj.is(":text") || operationDataObj.is("textarea") ||
- operationDataObj.is(":password")) {
+ operationDataObj.is(":password") || operationDataObj.is(":hidden")) {
value = operationDataObj.val();
} else if (operationDataObj.is(":checkbox")) {
value = operationDataObj.is(":checked");
@@ -939,7 +1285,8 @@ var operationModule = function () {
if (operationDataObj.hasClass("one-column-input-array")) {
$(".child-input", this).each(function () {
childInput = $(this);
- if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")) {
+ if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")
+ || childInput.is(":hidden")) {
childInputValue = childInput.val();
} else if (childInput.is(":checkbox")) {
childInputValue = childInput.is(":checked");
@@ -965,7 +1312,8 @@ var operationModule = function () {
var joinedInput;
$(".child-input", this).each(function () {
childInput = $(this);
- if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")) {
+ if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")
+ || childInput.is(":hidden")) {
childInputValue = childInput.val();
} else if (childInput.is(":checkbox")) {
childInputValue = childInput.is(":checked");
@@ -996,7 +1344,8 @@ var operationModule = function () {
$(".child-input", this).each(function () {
childInput = $(this);
childInputKey = childInput.data("child-key");
- if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")) {
+ if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")
+ || childInput.is(":hidden")) {
childInputValue = childInput.val();
} else if (childInput.is(":checkbox")) {
childInputValue = childInput.is(":checked");
@@ -1024,6 +1373,7 @@ var operationModule = function () {
operationData[key] = value;
}
);
+
switch (platformType) {
case platformTypeConstants["ANDROID"]:
payload = privateMethods.generateAndroidOperationPayload(operationCode, operationData, deviceList);
@@ -1087,58 +1437,17 @@ var operationModule = function () {
// var childInputValue;
if (operationDataObj.hasClass("one-column-input-array")) {
// generating input fields to populate complex value
- for (i = 0; i < value.length; ++i) {
- operationDataObj.parent().find("a").filterByData("click-event", "add-form").click();
- }
- // traversing through each child input
- $(".child-input", this).each(function () {
- childInput = $(this);
- var childInputValue = value[childInputIndex];
- // populating extracted value in the UI according to the input type
- if (childInput.is(":text") ||
- childInput.is("textarea") ||
- childInput.is(":password") ||
- childInput.is("select")) {
- childInput.val(childInputValue);
- } else if (childInput.is(":checkbox")) {
- operationDataObj.prop("checked", childInputValue);
+ if (value) {
+ for (i = 0; i < value.length; ++i) {
+ operationDataObj.parent().find("a").filterByData("click-event", "add-form").click();
}
- // incrementing childInputIndex
- childInputIndex++;
- });
- } else if (operationDataObj.hasClass("valued-check-box-array")) {
- // traversing through each child input
- $(".child-input", this).each(function () {
- childInput = $(this);
- // check if corresponding value of current checkbox exists in the array of values
- if (value.indexOf(childInput.data("value")) != -1) {
- // if YES, set checkbox as checked
- childInput.prop("checked", true);
- }
- });
- } else if (operationDataObj.hasClass("multi-column-joined-input-array")) {
- // generating input fields to populate complex value
- for (i = 0; i < value.length; ++i) {
- operationDataObj.parent().find("a").filterByData("click-event", "add-form").click();
- }
- var columnCount = operationDataObj.data("column-count");
- var multiColumnJoinedInputArrayIndex = 0;
- // handling scenarios specifically
- if (operationDataObj.attr("id") == "wifi-mcc-and-mncs") {
// traversing through each child input
$(".child-input", this).each(function () {
childInput = $(this);
- var multiColumnJoinedInput = value[multiColumnJoinedInputArrayIndex];
- var childInputValue;
- if ((childInputIndex % columnCount) == 0) {
- childInputValue = multiColumnJoinedInput.substring(3, 0)
- } else {
- childInputValue = multiColumnJoinedInput.substring(3);
- // incrementing childInputIndex
- multiColumnJoinedInputArrayIndex++;
- }
+ var childInputValue = value[childInputIndex];
// populating extracted value in the UI according to the input type
if (childInput.is(":text") ||
+ childInput.is(":hidden") ||
childInput.is("textarea") ||
childInput.is(":password") ||
childInput.is("select")) {
@@ -1150,35 +1459,87 @@ var operationModule = function () {
childInputIndex++;
});
}
- } else if (operationDataObj.hasClass("multi-column-key-value-pair-array")) {
- // generating input fields to populate complex value
- for (i = 0; i < value.length; ++i) {
- operationDataObj.parent().find("a").filterByData("click-event", "add-form").click();
- }
- columnCount = operationDataObj.data("column-count");
- var multiColumnKeyValuePairArrayIndex = 0;
+ } else if (operationDataObj.hasClass("valued-check-box-array")) {
// traversing through each child input
$(".child-input", this).each(function () {
childInput = $(this);
- var multiColumnKeyValuePair = value[multiColumnKeyValuePairArrayIndex];
- var childInputKey = childInput.data("child-key");
- var childInputValue = multiColumnKeyValuePair[childInputKey];
- // populating extracted value in the UI according to the input type
- if (childInput.is(":text") ||
- childInput.is("textarea") ||
- childInput.is(":password") ||
- childInput.is("select")) {
- childInput.val(childInputValue);
- } else if (childInput.is(":checkbox")) {
- operationDataObj.prop("checked", childInputValue);
+ // check if corresponding value of current checkbox exists in the array of values
+ if (value) {
+ if (value.indexOf(childInput.data("value")) != -1) {
+ // if YES, set checkbox as checked
+ childInput.prop("checked", true);
+ }
}
- // incrementing multiColumnKeyValuePairArrayIndex for the next row of inputs
- if ((childInputIndex % columnCount) == (columnCount - 1)) {
- multiColumnKeyValuePairArrayIndex++;
- }
- // incrementing childInputIndex
- childInputIndex++;
});
+ } else if (operationDataObj.hasClass("multi-column-joined-input-array")) {
+ // generating input fields to populate complex value
+ if (value) {
+ for (i = 0; i < value.length; ++i) {
+ operationDataObj.parent().find("a").filterByData("click-event", "add-form").click();
+ }
+ var columnCount = operationDataObj.data("column-count");
+ var multiColumnJoinedInputArrayIndex = 0;
+ // handling scenarios specifically
+ if (operationDataObj.attr("id") == "wifi-mcc-and-mncs") {
+ // traversing through each child input
+ $(".child-input", this).each(function () {
+ childInput = $(this);
+ var multiColumnJoinedInput = value[multiColumnJoinedInputArrayIndex];
+ var childInputValue;
+ if ((childInputIndex % columnCount) == 0) {
+ childInputValue = multiColumnJoinedInput.substring(3, 0)
+ } else {
+ childInputValue = multiColumnJoinedInput.substring(3);
+ // incrementing childInputIndex
+ multiColumnJoinedInputArrayIndex++;
+ }
+ // populating extracted value in the UI according to the input type
+ if (childInput.is(":text") ||
+ childInput.is(":hidden") ||
+ childInput.is("textarea") ||
+ childInput.is(":password") ||
+ childInput.is("select")) {
+ childInput.val(childInputValue);
+ } else if (childInput.is(":checkbox")) {
+ operationDataObj.prop("checked", childInputValue);
+ }
+ // incrementing childInputIndex
+ childInputIndex++;
+ });
+ }
+ }
+ } else if (operationDataObj.hasClass("multi-column-key-value-pair-array")) {
+ // generating input fields to populate complex value
+ if (value) {
+ for (i = 0; i < value.length; ++i) {
+ operationDataObj.parent().find("a").filterByData("click-event", "add-form").click();
+ }
+ columnCount = operationDataObj.data("column-count");
+ var multiColumnKeyValuePairArrayIndex = 0;
+ // traversing through each child input
+ $(".child-input", this).each(function () {
+ childInput = $(this);
+ var multiColumnKeyValuePair = value[multiColumnKeyValuePairArrayIndex];
+ var childInputKey = childInput.data("child-key");
+ var childInputValue = multiColumnKeyValuePair[childInputKey];
+ // populating extracted value in the UI according to the input type
+ if (childInput.is(":text") ||
+ childInput.is(":hidden") ||
+ childInput.is("textarea") ||
+ childInput.is(":password") ||
+ childInput.is("select")) {
+ childInput.val(childInputValue);
+ } else if (childInput.is(":checkbox")) {
+ operationDataObj.prop("checked", childInputValue);
+ }
+ // incrementing multiColumnKeyValuePairArrayIndex for the next row of inputs
+ if ((childInputIndex % columnCount) == (columnCount - 1)) {
+ multiColumnKeyValuePairArrayIndex++;
+ }
+ // incrementing childInputIndex
+ childInputIndex++;
+ });
+ }
}
}
}
@@ -1197,8 +1558,29 @@ var operationModule = function () {
for (var i = 0; i < operationCodes.length; ++i) {
var operationCode = operationCodes[i];
var payload = publicMethods.generatePayload(platformType, operationCode, null);
- generatedProfile[operationCode] = payload["operation"];
+
+ if(platformType == platformTypeConstants["ANDROID"] &&
+ operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]){
+ var operations = payload["operation"];
+ for (var key in operations){
+ operationCode = key;
+ var restriction = false;
+ if(operations[key]){
+ restriction = true;
+ }
+ var payloadResult = {
+ "operation": {
+ "enabled" : restriction
+ }
+ };
+ generatedProfile[operationCode] = payloadResult["operation"];
+ }
+
+ } else {
+ generatedProfile[operationCode] = payload["operation"];
+ }
}
+ console.log(generatedProfile);
return generatedProfile;
};
@@ -1211,14 +1593,125 @@ var operationModule = function () {
*/
publicMethods.populateProfile = function (platformType, payload) {
var i, configuredOperations = [];
+ var restrictions = {};
for (i = 0; i < payload.length; ++i) {
var configuredFeature = payload[i];
var featureCode = configuredFeature["featureCode"];
var operationPayload = configuredFeature["content"];
+ if(platformType == platformTypeConstants["ANDROID"]){
+ var restriction = JSON.parse(operationPayload);
+ if(featureCode == androidOperationConstants["CAMERA_OPERATION_CODE"]){
+ restrictions["cameraEnabled"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_ADJUST_VOLUME"]){
+ restrictions["disallowAdjustVolumeEnabled"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_BLUETOOTH"]){
+ restrictions["disallowConfigBluetooth"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CELL_BROADCASTS"]){
+ restrictions["disallowConfigCellBroadcasts"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CREDENTIALS"]){
+ restrictions["disallowConfigCredentials"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_MOBILE_NETWORKS"]){
+ restrictions["disallowConfigMobileNetworks"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_TETHERING"]){
+ restrictions["disallowConfigTethering"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_VPN"]){
+ restrictions["disallowConfigVpn"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_WIFI"]){
+ restrictions["disallowConfigWifi"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_APPS_CONTROL"]){
+ restrictions["disallowAppControl"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CREATE_WINDOWS"]){
+ restrictions["disallowCreateWindows"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_CROSS_PROFILE_COPY_PASTE"]){
+ restrictions["disallowCrossProfileCopyPaste"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_DEBUGGING_FEATURES"]){
+ restrictions["disallowDebugging"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_FACTORY_RESET"]){
+ restrictions["disallowFactoryReset"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_ADD_USER"]){
+ restrictions["disallowAddUser"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_APPS"]){
+ restrictions["disallowInstallApps"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_UNKNOWN_SOURCES"]){
+ restrictions["disallowInstallUnknownSources"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_MODIFY_ACCOUNTS"]){
+ restrictions["disallowModifyAccounts"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_MOUNT_PHYSICAL_MEDIA"]){
+ restrictions["disallowMountPhysicalMedia"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_NETWORK_RESET"]){
+ restrictions["disallowNetworkReset"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_BEAM"]){
+ restrictions["disallowOutgoingBeam"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_CALLS"]){
+ restrictions["disallowOutgoingCalls"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_REMOVE_USER"]){
+ restrictions["disallowRemoveUser"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_SAFE_BOOT"]){
+ restrictions["disallowSafeBoot"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_SHARE_LOCATION"]){
+ restrictions["disallowLocationSharing"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_SMS"]){
+ restrictions["disallowSMS"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_UNINSTALL_APPS"]){
+ restrictions["disallowUninstallApps"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_UNMUTE_MICROPHONE"]){
+ restrictions["disallowUnmuteMicrophone"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["DISALLOW_USB_FILE_TRANSFER"]){
+ restrictions["disallowUSBFileTransfer"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["ALLOW_PARENT_PROFILE_APP_LINKING"]){
+ restrictions["disallowParentProfileAppLinking"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["ENSURE_VERIFY_APPS"]){
+ restrictions["ensureVerifyApps"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["AUTO_TIME"]){
+ restrictions["enableAutoTime"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["SET_SCREEN_CAPTURE_DISABLED"]){
+ restrictions["diableScreenCapture"] = restriction["enabled"];
+ continue;
+ } else if (featureCode == androidOperationConstants["SET_STATUS_BAR_DISABLED"]){
+ restrictions["disableStatusBar"] = restriction["enabled"];
+ continue;
+ }
+ }
//push the feature-code to the configuration array
configuredOperations.push(featureCode);
publicMethods.populateUI(platformType, featureCode, operationPayload);
}
+ if (typeof restrictions.cameraEnabled !== 'undefined') {
+ configuredOperations.push(androidOperationConstants["CAMERA_OPERATION_CODE"]);
+ publicMethods.populateUI(platformType, androidOperationConstants["CAMERA_OPERATION_CODE"], JSON.stringify(restrictions));
+ }
return configuredOperations;
};
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs
index 5ea81961f6..3e59c7fe39 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs
@@ -1,83 +1,306 @@
-{{!
- Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-
- WSO2 Inc. 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.
-}}
-
+{{#zone "content"}}
+
-
-
-
ADD POLICY
-
-
-
-
-
1
-
Select a platform
-
-
+
+
+
+
+
1
+
Select a platform
+
+
+
+
+
+
2
+
Configure profile
+
+
+
+
+
+
3
+
Assign to groups
+
+
+
+
+
+
4
+
Publish to devices
+
+
+
+
+
+
+
+
Policy creation is successful.
+ Please click "Add Another Policy", if you wish to add another policy or click
+ "View policy list" to complete the process and go back to the policy list.
+
+
+
+
+
+
+
+ Add another policy
+
+
+ This configuration can be used to set a passcode policy to an Android Device.
+ Once this configuration profile is installed on a device, corresponding users will not be
+ able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Restrictions
+
+
+
+ This configurations can be used to restrict certain settings on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be
+ able
+ to modify these settings on their devices.
+
+ This configuration can be used to encrypt data on an Android device, when the device is
+ locked and
+ make it readable when the passcode is entered. Once this configuration profile is installed
+ on a device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you do not need the device to be encrypted.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Wi-Fi Settings
+
+
+
+ This configurations can be used to configure Wi-Fi access on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be
+ able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Application Restriction Settings
+
+
+
+ This configuration can be used to create a black list or white list of applications.
+
+ This configurations can be used to configure VPN settings on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be
+ able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+ The configurations below can be applied to the devices where the agent is running in Android
+ Work-Profile.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/templates/hidden-operations-ios.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/templates/hidden-operations-ios.hbs
new file mode 100644
index 0000000000..ef6f2d3683
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/templates/hidden-operations-ios.hbs
@@ -0,0 +1,4832 @@
+
+ This configuration can be used to set a passcode policy to an iOS Device.
+ Once this configuration profile is installed on a device, corresponding users
+ will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VPN Settings
+
+
+
+ This configurations can be used to configure VPN settings on an iOS device.
+ Once this configuration profile is installed on a device, corresponding users will not
+ be able
+ to modify these settings on their devices.
+
+
+
+
+Please note that * sign represents required fields of data.
+
+
+
+
+ This configuration can be used to configure add-on VPN software (per-app VPN),
+ and it works only on VPN services of
+ type 'VPN'. Once this configuration profile is installed on a device,
+ corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+
+ This configuration can be used to configure app-to-per-app VPN mappings.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+
+ These configurations can be used to set how devices connect to your wireless network(s),
+ including the necessary authentication
+ information. Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ For Manual Proxy Setup :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+For WEP, WPA or ANY Encryption Security Type :
+
+
+
+
+ These configurations can be used to define settings for connecting
+ to your POP or IMAP email accounts.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Incoming Mail Settings :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Outgoing Mail Settings :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AirPlay Settings
+
+
+
+ This configuration can be used to define settings for connecting to AirPlay
+ destinations.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
(This feature is supported only on iOS 7.0 and later.)
+
+ This configuration can be used to define settings for connecting to LDAP
+ servers.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+ This configuration can be used to define settings for connecting to CalDAV
+ servers.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Calendar Subscription
+
+
+
+ This configuration can be used to define settings for calendar subscriptions.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Access Point Names ( APN )
+
+
+
+ These configurations can be used to specify Access Point Names ( APN ).
+ Once this configuration profile is installed on an iOS device, corresponding
+ users will not
+ be able to modify these settings on their devices.
+
(This feature is not supported on iOS 7.0 and later.)
+
+ These configurations can be used to specify Cellular Network Settings on an iOS
+ device.
+ Cellular settings cannot be installed if an APN setting is already installed and
+ upon successful installation, corresponding users will not be able to modify
+ these
+ settings on their devices.
+
(This feature is supported only on iOS 7.0 and later.)
+
+ These configurations can be used to restrict apps, device features and
+ media content available on an iOS device. Once this configuration profile is installed
+ on a device, corresponding users will not be able to modify these settings on their
+ devices.
+
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/templates/hidden-operations-windows.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/templates/hidden-operations-windows.hbs
new file mode 100644
index 0000000000..2547a69cec
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/templates/hidden-operations-windows.hbs
@@ -0,0 +1,566 @@
+
+ This configuration can be used to set a passcode policy to an Windows Device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Restrictions on Camera
+
+
+
+ This configuration can be used to restrict the usage of camera on an Windows device together with all the applications using the camera.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you need to disable camera.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encryption Settings
+
+
+
+ This configuration can be used to encrypt data on an Windows device, when the device is locked and
+ make it readable when the passcode is entered. Once this configuration profile is installed on a device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you need to disable storage-encryption.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Application Restriction Settings
+
+
+
+ This configuration can be used to create a black list or white list of applications.
+
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs
new file mode 100644
index 0000000000..fbeb8f8eb3
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs
@@ -0,0 +1,233 @@
+{{#zone "content"}}
+
+
+
+
+
+
1
Edit current profile
+
+
+
+
2
Edit assignment groups
+
+
+
+
3
Republish to devices
+
+
+
+
+
+
+
Policy is successfully re-configured.
+ Please click "Add Another Policy", if you wish to add another policy or click
+ "View policy list" to complete the process and go back to the policy list.
+
+
+
+
+
+
+
+ Add another policy
+
+
+ This configuration can be used to set a passcode policy to an Android Device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Restrictions
+
+
+
+ This configurations can be used to restrict certain settings on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Below restrictions will be applied on devices with Android version 5.0 Lollipop onwards only
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bellow restrictions will be applied on devices with Android version 6.0 Marshmallow onwards only.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encryption Settings
+
+
+
+ This configuration can be used to encrypt data on an Android device, when the device is locked and
+ make it readable when the passcode is entered. Once this configuration profile is installed on a device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you do not need the device to be encrypted.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Wi-Fi Settings
+
+
+
+ This configurations can be used to configure Wi-Fi access on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+ This configurations can be used to configure VPN settings on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+ This configuration can be used to set a passcode policy to an iOS Device.
+ Once this configuration profile is installed on a device, corresponding users
+ will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VPN Settings
+
+
+
+ This configurations can be used to configure VPN settings on an iOS device.
+ Once this configuration profile is installed on a device, corresponding users will not
+ be able
+ to modify these settings on their devices.
+
+
+
+
+Please note that * sign represents required fields of data.
+
+
+
+
+ This configuration can be used to configure add-on VPN software (per-app VPN),
+ and it works only on VPN services of
+ type 'VPN'. Once this configuration profile is installed on a device,
+ corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+
+ This configuration can be used to configure app-to-per-app VPN mappings.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+
+ These configurations can be used to set how devices connect to your wireless network(s),
+ including the necessary authentication
+ information. Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ For Manual Proxy Setup :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+For WEP, WPA or ANY Encryption Security Type :
+
+
+
+
+ These configurations can be used to define settings for connecting
+ to your POP or IMAP email accounts.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Incoming Mail Settings :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Outgoing Mail Settings :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AirPlay Settings
+
+
+
+ This configuration can be used to define settings for connecting to AirPlay
+ destinations.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
(This feature is supported only on iOS 7.0 and later.)
+
+ This configuration can be used to define settings for connecting to LDAP
+ servers.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+ This configuration can be used to define settings for connecting to CalDAV
+ servers.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Calendar Subscription
+
+
+
+ This configuration can be used to define settings for calendar subscriptions.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Access Point Names ( APN )
+
+
+
+ These configurations can be used to specify Access Point Names ( APN ).
+ Once this configuration profile is installed on an iOS device, corresponding
+ users will not
+ be able to modify these settings on their devices.
+
(This feature is not supported on iOS 7.0 and later.)
+
+ These configurations can be used to specify Cellular Network Settings on an iOS
+ device.
+ Cellular settings cannot be installed if an APN setting is already installed and
+ upon successful installation, corresponding users will not be able to modify
+ these
+ settings on their devices.
+
(This feature is supported only on iOS 7.0 and later.)
+
+ These configurations can be used to restrict apps, device features and
+ media content available on an iOS device. Once this configuration profile is installed
+ on a device, corresponding users will not be able to modify these settings on their
+ devices.
+
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/templates/hidden-operations-windows.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/templates/hidden-operations-windows.hbs
new file mode 100644
index 0000000000..7c689586c9
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/templates/hidden-operations-windows.hbs
@@ -0,0 +1,568 @@
+
+ This configuration can be used to set a passcode policy to an Windows Device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Restrictions on Camera
+
+
+
+ This configuration can be used to restrict the usage of camera on an Windows device together with all the applications using the camera.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you need to disable camera.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encryption Settings
+
+
+
+ This configuration can be used to encrypt data on an Windows device, when the device is locked and
+ make it readable when the passcode is entered. Once this configuration profile is installed on a device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you need to disable storage-encryption.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Application Restriction Settings
+
+
+
+ This configuration can be used to create a black list or white list of applications.
+
+ This configuration can be used to set a passcode policy to an Android Device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Restrictions
+
+
+
+ This configurations can be used to restrict certain settings on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bellow restrictions will be applied on devices with Android version 5.0 Lollipop onwards only
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bellow restrictions will be applied on devices with Android version 6.0 Marshmallow onwards only.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encryption Settings
+
+
+
+ This configuration can be used to encrypt data on an Android device, when the device is locked and
+ make it readable when the passcode is entered. Once this configuration profile is installed on a device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you do not need the device to be encrypted.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Wi-Fi Settings
+
+
+
+ This configurations can be used to configure Wi-Fi access on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+ This configurations can be used to configure VPN settings on an Android device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+ This configuration can be used to set a passcode policy to an iOS Device.
+ Once this configuration profile is installed on a device, corresponding users
+ will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VPN Settings
+
+
+
+ This configurations can be used to configure VPN settings on an iOS device.
+ Once this configuration profile is installed on a device, corresponding users will not
+ be able
+ to modify these settings on their devices.
+
+
+
+
+Please note that * sign represents required fields of data.
+
+
+
+
+ This configuration can be used to configure add-on VPN software (per-app VPN),
+ and it works only on VPN services of
+ type 'VPN'. Once this configuration profile is installed on a device,
+ corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+
+ This configuration can be used to configure app-to-per-app VPN mappings.
+ Once this configuration profile is installed on a device, corresponding users will
+ not be able
+ to modify these settings on their devices.
+
+
+
+
+ Please note that * sign represents required fields of data.
+
+
+
+
+ These configurations can be used to set how devices connect to your wireless network(s),
+ including the necessary authentication
+ information. Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ For Manual Proxy Setup :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+For WEP, WPA or ANY Encryption Security Type :
+
+
+
+
+ These configurations can be used to define settings for connecting
+ to your POP or IMAP email accounts.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Incoming Mail Settings :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Outgoing Mail Settings :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AirPlay Settings
+
+
+
+ This configuration can be used to define settings for connecting to AirPlay
+ destinations.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
(This feature is supported only on iOS 7.0 and later.)
+
+ This configuration can be used to define settings for connecting to LDAP
+ servers.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+ This configuration can be used to define settings for connecting to CalDAV
+ servers.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Calendar Subscription
+
+
+
+ This configuration can be used to define settings for calendar subscriptions.
+ Once this configuration profile is installed on an iOS device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Access Point Names ( APN )
+
+
+
+ These configurations can be used to specify Access Point Names ( APN ).
+ Once this configuration profile is installed on an iOS device, corresponding
+ users will not
+ be able to modify these settings on their devices.
+
(This feature is not supported on iOS 7.0 and later.)
+
+ These configurations can be used to specify Cellular Network Settings on an iOS
+ device.
+ Cellular settings cannot be installed if an APN setting is already installed and
+ upon successful installation, corresponding users will not be able to modify
+ these
+ settings on their devices.
+
(This feature is supported only on iOS 7.0 and later.)
+
+ These configurations can be used to restrict apps, device features and
+ media content available on an iOS device. Once this configuration profile is installed
+ on a device, corresponding users will not be able to modify these settings on their
+ devices.
+
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/templates/hidden-operations-windows.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/templates/hidden-operations-windows.hbs
new file mode 100644
index 0000000000..0c0359d8c0
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/templates/hidden-operations-windows.hbs
@@ -0,0 +1,568 @@
+
+ This configuration can be used to set a passcode policy to an Windows Device.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Restrictions on Camera
+
+
+
+ This configuration can be used to restrict the usage of camera on an Windows device together with all the applications using the camera.
+ Once this configuration profile is installed on a device, corresponding users will not be able
+ to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you need to disable camera.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encryption Settings
+
+
+
+ This configuration can be used to encrypt data on an Windows device, when the device is locked and
+ make it readable when the passcode is entered. Once this configuration profile is installed on a device,
+ corresponding users will not be able to modify these settings on their devices.
+
+
+
+
+
+
+
+ Un-check following checkbox in case you need to disable storage-encryption.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Application Restriction Settings
+
+
+
+ This configuration can be used to create a black list or white list of applications.
+
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs
new file mode 100644
index 0000000000..b7f2adf56d
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs
@@ -0,0 +1,88 @@
+{{#zone "content"}}
+ {{#defineZone "policy-profile-top"}}
+
+
+
+
+
+ {{/defineZone}}
+
+
+
+
+
+
+
+ Policy Overview
+
+ {{#defineZone "policy-detail-properties"}}
+
+
+
+
Platform
+
+
+
+
Ownership
+
+
+
+
Action upon non-compliance
+
+
+
+
Status
+
+
+
+
Assigned Users
+
+
+
+
Assigned Roles
+
+
+
+
+ {{/defineZone}}
+
Description
+
+
+
+
+
+ Profile Information
+
+
+
+
+
+
+
+
+
+ Loading platform features . . .
+
+
+
+
+
+
+
+
+
+{{/zone}}
+{{#zone "bottomJs"}}
+
+
+
+
+
+
+ {{js "js/view.js"}}
+{{/zone}}
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js
new file mode 100644
index 0000000000..2d2a438263
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.js
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. 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.
+ */
+
+function onRequest(context) {
+// var log = new Log("policy-view-edit-unit backend js");
+
+// var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
+// context.roles = userModule.getRoles();
+ return context;
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.json
new file mode 100644
index 0000000000..f706ffceea
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.json
@@ -0,0 +1,3 @@
+{
+ "version" : "1.0.0"
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.title/title.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.title/title.hbs
index 1d82a81154..5fbe77d385 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.title/title.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.title/title.hbs
@@ -2,17 +2,20 @@
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. 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
+ 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
+ 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
+ "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.
}}
-{{#zone "title"}}{{@unit.params.pageTitle}} | {{@app.conf.appName}}{{/zone}}
\ No newline at end of file
+
+{{#zone "title"}}
+ {{@unit.params.pageTitle}} | {{@app.conf.appName}}
+{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.breadcrumbs/breadcrumbs.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.breadcrumbs/breadcrumbs.hbs
index af6cd3218f..fca8b278a2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.breadcrumbs/breadcrumbs.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar.breadcrumbs/breadcrumbs.hbs
@@ -2,21 +2,24 @@
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. 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
+ 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
+ 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
+ "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.
}}
+
{{#zone "navbarHeader"}}
-
+
{{defineZone "breadcrumbs"}}
{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar/navbar.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar/navbar.hbs
index 3d8a2363ff..e151b8a534 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar/navbar.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.navbar/navbar.hbs
@@ -2,19 +2,20 @@
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. 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
+ 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
+ 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
+ "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.
}}
+
{{#zone "navbars"}}
-
+
{{defineZone "navbarCollapsableLeftItems"}}
diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/src/main/resources/dbscripts/cdm/certs/mssql.sql b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/src/main/resources/dbscripts/cdm/certs/mssql.sql
index 888ee030c8..0e7f76e5eb 100644
--- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/src/main/resources/dbscripts/cdm/certs/mssql.sql
+++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/src/main/resources/dbscripts/cdm/certs/mssql.sql
@@ -1,8 +1,8 @@
CREATE TABLE DM_DEVICE_CERTIFICATE (
- ID INTEGER IDENTITY NOT NULL,
- SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
- CERTIFICATE VARBINARY(max) DEFAULT NULL,
- TENANT_ID INTEGER DEFAULT 0,
- USERNAME VARCHAR(500) DEFAULT NULL,
- PRIMARY KEY (ID)
-);
+ ID INTEGER IDENTITY NOT NULL,
+ SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
+ CERTIFICATE VARBINARY(max) DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ USERNAME VARCHAR(500) DEFAULT NULL,
+PRIMARY KEY (ID)
+);
\ No newline at end of file
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql
index 385ac2a135..85cf0b078b 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql
@@ -1,183 +1,165 @@
-CREATE TABLE DM_DEVICE_TYPE (
- ID INTEGER IDENTITY NOT NULL,
- NAME VARCHAR(300) DEFAULT NULL,
- PROVIDER_TENANT_ID INTEGER DEFAULT 0,
- SHARED_WITH_ALL_TENANTS INTEGER NOT NULL DEFAULT 0,
- PRIMARY KEY (ID)
-);
-CREATE TABLE DM_GROUP (
- ID INTEGER IDENTITY NOT NULL,
- GROUP_NAME VARCHAR(100) DEFAULT NULL,
- DESCRIPTION VARCHAR(max) DEFAULT NULL,
- DATE_OF_CREATE BIGINT DEFAULT NULL,
- DATE_OF_LAST_UPDATE BIGINT DEFAULT NULL,
- OWNER VARCHAR(45) DEFAULT NULL,
- TENANT_ID INTEGER DEFAULT 0,
- PRIMARY KEY (ID)
-);
-CREATE TABLE DM_DEVICE (
- ID INTEGER identity NOT NULL,
- DESCRIPTION VARCHAR(max) DEFAULT NULL,
+CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
+ ID INT AUTO_INCREMENT NOT NULL,
+ NAME VARCHAR(300) DEFAULT NULL,
+ PROVIDER_TENANT_ID INTEGER DEFAULT 0,
+ SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
+ PRIMARY KEY (ID)
+)ENGINE = InnoDB;
+CREATE INDEX device_type_name ON DM_DEVICE_TYPE (NAME);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DESCRIPTION TEXT DEFAULT NULL,
NAME VARCHAR(100) DEFAULT NULL,
- DEVICE_TYPE_ID INTEGER DEFAULT NULL,
+ DEVICE_TYPE_ID INT(11) DEFAULT NULL,
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID),
- CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
- REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+ CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID)
+ REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT uk_DM_DEVICE UNIQUE (NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, TENANT_ID)
+)ENGINE = InnoDB;
-CREATE TABLE DM_DEVICE_GROUP_MAP (
- ID INTEGER IDENTITY NOT NULL,
- DEVICE_ID INTEGER DEFAULT NULL,
- GROUP_ID INTEGER DEFAULT NULL,
- TENANT_ID INTEGER DEFAULT 0,
- PRIMARY KEY (ID),
- CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
- REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
- CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
- REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
-CREATE TABLE DM_OPERATION (
- ID INTEGER IDENTITY NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_OPERATION (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
TYPE VARCHAR(50) NOT NULL,
- CREATED_TIMESTAMP DATETIME2(0) NOT NULL,
- RECEIVED_TIMESTAMP DATETIME2(0) NULL,
+ CREATED_TIMESTAMP TIMESTAMP NOT NULL,
+ RECEIVED_TIMESTAMP TIMESTAMP NULL,
OPERATION_CODE VARCHAR(1000) NOT NULL,
PRIMARY KEY (ID)
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_CONFIG_OPERATION (
+
+CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
OPERATION_ID INTEGER NOT NULL,
- OPERATION_CONFIG VARBINARY(max) DEFAULT NULL,
+ OPERATION_CONFIG BLOB DEFAULT NULL,
PRIMARY KEY (OPERATION_ID),
- CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES
+ CONSTRAINT FK_DM_OPERATION_CONFIG FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_COMMAND_OPERATION (
+
+CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION (
OPERATION_ID INTEGER NOT NULL,
- ENABLED BIT NOT NULL DEFAULT 'FALSE',
+ ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (OPERATION_ID),
- CONSTRAINT fk_dm_operation_command FOREIGN KEY (OPERATION_ID) REFERENCES
+ CONSTRAINT FK_DM_OPERATION_COMMAND FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_POLICY_OPERATION (
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION (
OPERATION_ID INTEGER NOT NULL,
ENABLED INTEGER NOT NULL DEFAULT 0,
- OPERATION_DETAILS VARBINARY(max) DEFAULT NULL,
+ OPERATION_DETAILS BLOB DEFAULT NULL,
PRIMARY KEY (OPERATION_ID),
- CONSTRAINT fk_dm_operation_policy FOREIGN KEY (OPERATION_ID) REFERENCES
+ CONSTRAINT FK_DM_OPERATION_POLICY FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_PROFILE_OPERATION (
+
+CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION (
OPERATION_ID INTEGER NOT NULL,
ENABLED INTEGER NOT NULL DEFAULT 0,
- OPERATION_DETAILS VARBINARY(max) DEFAULT NULL,
+ OPERATION_DETAILS BLOB DEFAULT NULL,
PRIMARY KEY (OPERATION_ID),
- CONSTRAINT fk_dm_operation_profile FOREIGN KEY (OPERATION_ID) REFERENCES
+ CONSTRAINT FK_DM_OPERATION_PROFILE FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_ENROLMENT (
- ID INTEGER IDENTITY NOT NULL,
+
+CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL,
OWNER VARCHAR(50) NOT NULL,
OWNERSHIP VARCHAR(45) DEFAULT NULL,
STATUS VARCHAR(50) NULL,
- DATE_OF_ENROLMENT DATETIME2(0) DEFAULT NULL,
- DATE_OF_LAST_UPDATE DATETIME2(0) DEFAULT NULL,
- TENANT_ID INTEGER NOT NULL,
+ DATE_OF_ENROLMENT TIMESTAMP NULL DEFAULT NULL,
+ DATE_OF_LAST_UPDATE TIMESTAMP NULL DEFAULT NULL,
+ TENANT_ID INT NOT NULL,
PRIMARY KEY (ID),
- CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
- DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+ CONSTRAINT FK_DM_DEVICE_ENROLMENT FOREIGN KEY (DEVICE_ID) REFERENCES
+ DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT uk_dm_device_enrolment UNIQUE (DEVICE_ID, OWNER, OWNERSHIP, TENANT_ID)
+)ENGINE = InnoDB;
-CREATE TABLE DM_ENROLMENT_OP_MAPPING (
- ID INTEGER IDENTITY NOT NULL,
+
+CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
ENROLMENT_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL,
STATUS VARCHAR(50) NULL,
- CREATED_TIMESTAMP INTEGER NOT NULL,
- UPDATED_TIMESTAMP INTEGER NOT NULL,
+ CREATED_TIMESTAMP INT NOT NULL,
+ UPDATED_TIMESTAMP INT NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_device_operation_mapping_operation FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
- ID INTEGER IDENTITY NOT NULL,
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
ENROLMENT_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL,
- OPERATION_RESPONSE VARBINARY(max) DEFAULT NULL,
- RECEIVED_TIMESTAMP DATETIME2(0) NULL,
+ OPERATION_RESPONSE BLOB DEFAULT NULL,
+ RECEIVED_TIMESTAMP TIMESTAMP NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_device_operation_response_operation FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-- POLICY RELATED TABLES --
-
-
-
-CREATE TABLE DM_PROFILE (
- ID INTEGER NOT NULL IDENTITY ,
+CREATE TABLE IF NOT EXISTS DM_PROFILE (
+ ID INT NOT NULL AUTO_INCREMENT ,
PROFILE_NAME VARCHAR(45) NOT NULL ,
- TENANT_ID INTEGER NOT NULL ,
+ TENANT_ID INT NOT NULL ,
DEVICE_TYPE VARCHAR(300) NOT NULL ,
- CREATED_TIME DATETIME2(0) NOT NULL ,
- UPDATED_TIME DATETIME2(0) NOT NULL ,
+ CREATED_TIME DATETIME NOT NULL ,
+ UPDATED_TIME DATETIME NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE)
- REFERENCES DM_DEVICE_TYPE (NAME )
+ REFERENCES DM_DEVICE_TYPE (NAME)
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-
-
-
-CREATE TABLE DM_POLICY (
- ID INTEGER NOT NULL IDENTITY ,
+CREATE TABLE IF NOT EXISTS DM_POLICY (
+ ID INT(11) NOT NULL AUTO_INCREMENT ,
NAME VARCHAR(45) DEFAULT NULL ,
DESCRIPTION VARCHAR(1000) NULL,
- TENANT_ID INTEGER NOT NULL ,
- PROFILE_ID INTEGER NOT NULL ,
+ TENANT_ID INT(11) NOT NULL ,
+ PROFILE_ID INT(11) NOT NULL ,
OWNERSHIP_TYPE VARCHAR(45) NULL,
COMPLIANCE VARCHAR(100) NULL,
- PRIORITY INTEGER NOT NULL,
- ACTIVE INTEGER NOT NULL,
- UPDATED INTEGER NULL,
+ PRIORITY INT NOT NULL,
+ ACTIVE INT(2) NOT NULL,
+ UPDATED INT(1) NULL,
PRIMARY KEY (ID) ,
CONSTRAINT FK_DM_PROFILE_DM_POLICY
FOREIGN KEY (PROFILE_ID )
REFERENCES DM_PROFILE (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-
-
-CREATE TABLE DM_DEVICE_POLICY (
- ID INTEGER NOT NULL IDENTITY ,
- DEVICE_ID INTEGER NOT NULL ,
- ENROLMENT_ID INTEGER NOT NULL,
- DEVICE VARBINARY(max) NOT NULL,
- POLICY_ID INTEGER NOT NULL ,
+CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
+ ID INT(11) NOT NULL AUTO_INCREMENT ,
+ DEVICE_ID INT(11) NOT NULL ,
+ ENROLMENT_ID INT(11) NOT NULL,
+ DEVICE BLOB NOT NULL,
+ POLICY_ID INT(11) NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT FK_POLICY_DEVICE_POLICY
FOREIGN KEY (POLICY_ID )
@@ -189,15 +171,13 @@ CREATE TABLE DM_DEVICE_POLICY (
REFERENCES DM_DEVICE (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-
-
-CREATE TABLE DM_DEVICE_TYPE_POLICY (
- ID INTEGER NOT NULL ,
+CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
+ ID INT(11) NOT NULL ,
DEVICE_TYPE VARCHAR(300) NOT NULL ,
- POLICY_ID INTEGER NOT NULL ,
+ POLICY_ID INT(11) NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT FK_DEVICE_TYPE_POLICY
FOREIGN KEY (POLICY_ID )
@@ -205,52 +185,45 @@ CREATE TABLE DM_DEVICE_TYPE_POLICY (
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
- FOREIGN KEY (DEVICE_TYPE)
- REFERENCES DM_DEVICE_TYPE (NAME )
+ FOREIGN KEY (DEVICE_TYPE )
+ REFERENCES DM_DEVICE_TYPE (NAME)
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-
-
-
-CREATE TABLE DM_PROFILE_FEATURES (
- ID INTEGER NOT NULL IDENTITY,
- PROFILE_ID INTEGER NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
+ ID INT(11) NOT NULL AUTO_INCREMENT,
+ PROFILE_ID INT(11) NOT NULL,
FEATURE_CODE VARCHAR(100) NOT NULL,
- DEVICE_TYPE VARCHAR(300) NOT NULL ,
- TENANT_ID INTEGER NOT NULL ,
- CONTENT VARBINARY(max) NULL DEFAULT NULL,
+ DEVICE_TYPE VARCHAR(300) NOT NULL,
+ TENANT_ID INT(11) NOT NULL ,
+ CONTENT BLOB NULL DEFAULT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
FOREIGN KEY (PROFILE_ID)
REFERENCES DM_PROFILE (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-
-
-CREATE TABLE DM_ROLE_POLICY (
- ID INTEGER NOT NULL IDENTITY ,
+CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
+ ID INT(11) NOT NULL AUTO_INCREMENT ,
ROLE_NAME VARCHAR(45) NOT NULL ,
- POLICY_ID INTEGER NOT NULL ,
+ POLICY_ID INT(11) NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT FK_ROLE_POLICY_POLICY
FOREIGN KEY (POLICY_ID )
REFERENCES DM_POLICY (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-
-
-CREATE TABLE DM_USER_POLICY (
- ID INTEGER NOT NULL IDENTITY ,
- POLICY_ID INTEGER NOT NULL ,
+CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
+ ID INT NOT NULL AUTO_INCREMENT ,
+ POLICY_ID INT NOT NULL ,
USERNAME VARCHAR(45) NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT DM_POLICY_USER_POLICY
@@ -258,43 +231,41 @@ CREATE TABLE DM_USER_POLICY (
REFERENCES DM_POLICY (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
- CREATE TABLE DM_DEVICE_POLICY_APPLIED (
- ID INTEGER NOT NULL IDENTITY ,
- DEVICE_ID INTEGER NOT NULL ,
- ENROLMENT_ID INTEGER NOT NULL,
- POLICY_ID INTEGER NOT NULL ,
- POLICY_CONTENT VARBINARY(max) NULL ,
- TENANT_ID INTEGER NOT NULL,
- APPLIED SMALLINT NULL ,
- CREATED_TIME DATETIME2(0) NULL ,
- UPDATED_TIME DATETIME2(0) NULL ,
- APPLIED_TIME DATETIME2(0) NULL ,
+ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
+ ID INT NOT NULL AUTO_INCREMENT ,
+ DEVICE_ID INT NOT NULL ,
+ ENROLMENT_ID INT(11) NOT NULL,
+ POLICY_ID INT NOT NULL ,
+ POLICY_CONTENT BLOB NULL ,
+ TENANT_ID INT NOT NULL,
+ APPLIED TINYINT(1) NULL ,
+ CREATED_TIME TIMESTAMP NULL ,
+ UPDATED_TIME TIMESTAMP NULL ,
+ APPLIED_TIME TIMESTAMP NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT FK_DM_POLICY_DEVCIE_APPLIED
FOREIGN KEY (DEVICE_ID )
REFERENCES DM_DEVICE (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-
-CREATE TABLE DM_CRITERIA (
- ID INTEGER NOT NULL IDENTITY,
- TENANT_ID INTEGER NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_CRITERIA (
+ ID INT NOT NULL AUTO_INCREMENT,
+ TENANT_ID INT NOT NULL,
NAME VARCHAR(50) NULL,
PRIMARY KEY (ID)
-);
+)ENGINE = InnoDB;
-
-CREATE TABLE DM_POLICY_CRITERIA (
- ID INTEGER NOT NULL IDENTITY,
- CRITERIA_ID INTEGER NOT NULL,
- POLICY_ID INTEGER NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
+ ID INT NOT NULL AUTO_INCREMENT,
+ CRITERIA_ID INT NOT NULL,
+ POLICY_ID INT NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_CRITERIA_POLICY_CRITERIA
FOREIGN KEY (CRITERIA_ID)
@@ -306,80 +277,80 @@ CREATE TABLE DM_POLICY_CRITERIA (
REFERENCES DM_POLICY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_POLICY_CRITERIA_PROPERTIES (
- ID INTEGER NOT NULL IDENTITY,
- POLICY_CRITERION_ID INTEGER NOT NULL,
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
+ ID INT NOT NULL AUTO_INCREMENT,
+ POLICY_CRITERION_ID INT NOT NULL,
PROP_KEY VARCHAR(45) NULL,
PROP_VALUE VARCHAR(100) NULL,
- CONTENT VARBINARY(max) NULL ,
+ CONTENT BLOB NULL COMMENT 'This is used to ',
PRIMARY KEY (ID),
CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES
FOREIGN KEY (POLICY_CRITERION_ID)
REFERENCES DM_POLICY_CRITERIA (ID)
ON DELETE CASCADE
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
- ID INTEGER NOT NULL IDENTITY,
- DEVICE_ID INTEGER NOT NULL,
- ENROLMENT_ID INTEGER NOT NULL,
- POLICY_ID INTEGER NOT NULL,
- TENANT_ID INTEGER NOT NULL,
- STATUS INTEGER NULL,
- LAST_SUCCESS_TIME DATETIME2(0) NULL,
- LAST_REQUESTED_TIME DATETIME2(0) NULL,
- LAST_FAILED_TIME DATETIME2(0) NULL,
- ATTEMPTS INTEGER NULL,
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
+ ID INT NOT NULL AUTO_INCREMENT,
+ DEVICE_ID INT NOT NULL,
+ ENROLMENT_ID INT(11) NOT NULL,
+ POLICY_ID INT NOT NULL,
+ TENANT_ID INT NOT NULL,
+ STATUS INT NULL,
+ LAST_SUCCESS_TIME TIMESTAMP NULL,
+ LAST_REQUESTED_TIME TIMESTAMP NULL,
+ LAST_FAILED_TIME TIMESTAMP NULL,
+ ATTEMPTS INT NULL,
PRIMARY KEY (ID)
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_POLICY_CHANGE_MGT (
- ID INTEGER NOT NULL IDENTITY,
- POLICY_ID INTEGER NOT NULL,
- DEVICE_TYPE VARCHAR(300) NOT NULL,
- TENANT_ID INTEGER NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
+ ID INT NOT NULL AUTO_INCREMENT,
+ POLICY_ID INT NOT NULL,
+ DEVICE_TYPE VARCHAR(300) NOT NULL ,
+ TENANT_ID INT(11) NOT NULL,
PRIMARY KEY (ID)
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_POLICY_COMPLIANCE_FEATURES (
- ID INTEGER NOT NULL IDENTITY,
- COMPLIANCE_STATUS_ID INTEGER NOT NULL,
- TENANT_ID INTEGER NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
+ ID INT NOT NULL AUTO_INCREMENT,
+ COMPLIANCE_STATUS_ID INT NOT NULL,
+ TENANT_ID INT NOT NULL,
FEATURE_CODE VARCHAR(100) NOT NULL,
- STATUS INTEGER NULL,
+ STATUS INT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_COMPLIANCE_FEATURES_STATUS
FOREIGN KEY (COMPLIANCE_STATUS_ID)
REFERENCES DM_POLICY_COMPLIANCE_STATUS (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_DEVICE_GROUP_POLICY (
- ID INTEGER NOT NULL IDENTITY,
- DEVICE_GROUP_ID INTEGER NOT NULL,
- POLICY_ID INTEGER NOT NULL,
- TENANT_ID INTEGER NOT NULL,
- PRIMARY KEY (ID),
- CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
- FOREIGN KEY (DEVICE_GROUP_ID)
- REFERENCES DM_GROUP (ID)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION,
- CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
- FOREIGN KEY (POLICY_ID)
- REFERENCES DM_POLICY (ID)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
-);
-CREATE TABLE DM_APPLICATION (
- ID INTEGER IDENTITY NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INTEGER NOT NULL,
+ OWNER VARCHAR(50) NOT NULL,
+ OWNERSHIP VARCHAR(45) DEFAULT NULL,
+ STATUS VARCHAR(50) NULL,
+ DATE_OF_ENROLMENT TIMESTAMP NULL DEFAULT NULL,
+ DATE_OF_LAST_UPDATE TIMESTAMP NULL DEFAULT NULL,
+ TENANT_ID INT NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
+ DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+)ENGINE = InnoDB;
+
+
+CREATE TABLE IF NOT EXISTS DM_APPLICATION (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
NAME VARCHAR(150) NOT NULL,
APP_IDENTIFIER VARCHAR(150) NOT NULL,
PLATFORM VARCHAR(50) DEFAULT NULL,
@@ -388,15 +359,16 @@ CREATE TABLE DM_APPLICATION (
TYPE VARCHAR(50) NULL,
LOCATION_URL VARCHAR(100) DEFAULT NULL,
IMAGE_URL VARCHAR(100) DEFAULT NULL,
- APP_PROPERTIES VARBINARY(max) NULL,
- MEMORY_USAGE INTEGER NULL,
- IS_ACTIVE BIT NOT NULL DEFAULT 'FALSE',
+ APP_PROPERTIES BLOB NULL,
+ MEMORY_USAGE INTEGER(10) NULL,
+ IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
-);
+)ENGINE = InnoDB;
-CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
- ID INTEGER IDENTITY NOT NULL,
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
@@ -405,13 +377,44 @@ CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
+)ENGINE = InnoDB;
-- POLICY RELATED TABLES FINISHED --
--- NOTIFICATION TABLE --
-CREATE TABLE DM_NOTIFICATION (
- NOTIFICATION_ID INTEGER IDENTITY NOT NULL,
+-- DEVICE GROUP TABLES --
+
+CREATE TABLE IF NOT EXISTS DM_GROUP (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ GROUP_NAME VARCHAR(100) DEFAULT NULL,
+ DESCRIPTION TEXT DEFAULT NULL,
+ DATE_OF_CREATE BIGINT DEFAULT NULL,
+ DATE_OF_LAST_UPDATE BIGINT DEFAULT NULL,
+ OWNER VARCHAR(45) DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID)
+)ENGINE = InnoDB;
+
+
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INTEGER DEFAULT NULL,
+ GROUP_ID INTEGER DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
+ REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+)ENGINE = InnoDB;
+
+-- END OF DEVICE GROUP TABLES --
+
+
+-- NOTIFICATION TABLES --
+
+CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
+ NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
@@ -422,58 +425,59 @@ CREATE TABLE DM_NOTIFICATION (
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
-);
--- NOTIFICATION TABLE END --
+)ENGINE = InnoDB;
-IF EXISTS (SELECT * FROM sys.objects WHERE name = 'DM_DEVICE_INFO' and type = 'u')
- DROP TABLE DM_DEVICE_INFO;
+-- END NOTIFICATION TABLES --
-CREATE TABLE DM_DEVICE_INFO (
- ID INTEGER IDENTITY NOT NULL,
- DEVICE_ID INTEGER NULL,
+
+DROP TABLE IF EXISTS DM_DEVICE_INFO;
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INT NULL,
KEY_FIELD VARCHAR(45) NULL,
VALUE_FIELD VARCHAR(100) NULL,
PRIMARY KEY (ID),
+ INDEX DM_DEVICE_INFO_DEVICE_idx (DEVICE_ID ASC),
CONSTRAINT DM_DEVICE_INFO_DEVICE
FOREIGN KEY (DEVICE_ID)
REFERENCES DM_DEVICE (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)
+ENGINE = InnoDB;
-CREATE INDEX DM_DEVICE_INFO_DEVICE_idx ON DM_DEVICE_INFO (DEVICE_ID ASC);
-IF EXISTS (SELECT * FROM sys.objects WHERE name = 'DM_DEVICE_LOCATION' and type = 'u')
- DROP TABLE DM_DEVICE_LOCATION;
-CREATE TABLE DM_DEVICE_LOCATION (
- ID INTEGER IDENTITY NOT NULL,
- DEVICE_ID INTEGER NULL,
- LATITUDE FLOAT NULL,
- LONGITUDE FLOAT NULL,
+DROP TABLE IF EXISTS DM_DEVICE_LOCATION;
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INT NULL,
+ LATITUDE DOUBLE NULL,
+ LONGITUDE DOUBLE NULL,
STREET1 VARCHAR(45) NULL,
STREET2 VARCHAR(45) NULL,
CITY VARCHAR(45) NULL,
ZIP VARCHAR(10) NULL,
STATE VARCHAR(45) NULL,
COUNTRY VARCHAR(45) NULL,
- UPDATE_TIMESTAMP BIGINT NOT NULL,
+ UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
PRIMARY KEY (ID),
+ INDEX DM_DEVICE_LOCATION_DEVICE_idx (DEVICE_ID ASC),
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
FOREIGN KEY (DEVICE_ID)
REFERENCES DM_DEVICE (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
-);
+)
+ENGINE = InnoDB;
-CREATE INDEX DM_DEVICE_LOCATION_DEVICE_idx ON DM_DEVICE_LOCATION (DEVICE_ID ASC);
+DROP TABLE IF EXISTS DM_DEVICE_DETAIL ;
-IF EXISTS (SELECT * FROM sys.objects WHERE name = 'DM_DEVICE_DETAIL' and type = 'u')
- DROP TABLE DM_DEVICE_DETAIL;
-
-CREATE TABLE DM_DEVICE_DETAIL (
- ID INTEGER NOT NULL IDENTITY,
- DEVICE_ID INTEGER NOT NULL,
+CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
+ ID INT NOT NULL AUTO_INCREMENT,
+ DEVICE_ID INT NOT NULL,
DEVICE_MODEL VARCHAR(45) NULL,
VENDOR VARCHAR(45) NULL,
OS_VERSION VARCHAR(45) NULL,
@@ -488,33 +492,43 @@ CREATE TABLE DM_DEVICE_DETAIL (
CPU_USAGE DECIMAL(5) NULL,
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
- PLUGGED_IN INTEGER NULL,
- UPDATE_TIMESTAMP BIGINT NOT NULL,
+ PLUGGED_IN INT(1) NULL,
+ UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
PRIMARY KEY (ID),
+ INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx (DEVICE_ID ASC),
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
FOREIGN KEY (DEVICE_ID)
REFERENCES DM_DEVICE (ID)
ON DELETE NO ACTION
- ON UPDATE NO ACTION
-);
+ ON UPDATE NO ACTION)
+ENGINE = InnoDB;
-CREATE INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx ON DM_DEVICE_DETAIL (DEVICE_ID ASC);
+-- POLICY AND DEVICE GROUP MAPPING --
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
+ ID INT NOT NULL AUTO_INCREMENT,
+ DEVICE_GROUP_ID INT NOT NULL,
+ POLICY_ID INT NOT NULL,
+ TENANT_ID INT NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
+ FOREIGN KEY (DEVICE_GROUP_ID)
+ REFERENCES DM_GROUP (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
+ CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
+ FOREIGN KEY (POLICY_ID)
+ REFERENCES DM_POLICY (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+)ENGINE = InnoDB;
+
+-- END OF POLICY AND DEVICE GROUP MAPPING --
-- DASHBOARD RELATED VIEWS --
-CREATE VIEW POLICY_COMPLIANCE_INFO AS
-SELECT TOP 100 PERCENT
-DEVICE_INFO.DEVICE_ID,
-DEVICE_INFO.DEVICE_IDENTIFICATION,
-DEVICE_INFO.PLATFORM,
-DEVICE_INFO.OWNERSHIP,
-DEVICE_INFO.CONNECTIVITY_STATUS,
-ISNULL(DEVICE_WITH_POLICY_INFO.POLICY_ID, -1) AS POLICY_ID,
-ISNULL(DEVICE_WITH_POLICY_INFO.IS_COMPLIANT, -1) AS
-IS_COMPLIANT,
-DEVICE_INFO.TENANT_ID
-FROM
-(SELECT
+CREATE VIEW DEVICE_INFO_VIEW AS
+SELECT
DM_DEVICE.ID AS DEVICE_ID,
DM_DEVICE.DEVICE_IDENTIFICATION,
DM_DEVICE_TYPE.NAME AS PLATFORM,
@@ -522,20 +536,34 @@ DM_ENROLMENT.OWNERSHIP,
DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
DM_DEVICE.TENANT_ID
FROM DM_DEVICE, DM_DEVICE_TYPE, DM_ENROLMENT
-WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID) DEVICE_INFO
-LEFT JOIN
-(SELECT
+WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID;
+
+CREATE VIEW DEVICE_WITH_POLICY_INFO_VIEW AS
+SELECT
DEVICE_ID,
POLICY_ID,
STATUS AS IS_COMPLIANT
+FROM DM_POLICY_COMPLIANCE_STATUS;
+
+CREATE VIEW POLICY_COMPLIANCE_INFO AS
+SELECT
+DEVICE_INFO_VIEW.DEVICE_ID,
+DEVICE_INFO_VIEW.DEVICE_IDENTIFICATION,
+DEVICE_INFO_VIEW.PLATFORM,
+DEVICE_INFO_VIEW.OWNERSHIP,
+DEVICE_INFO_VIEW.CONNECTIVITY_STATUS,
+IFNULL(DEVICE_WITH_POLICY_INFO_VIEW.POLICY_ID, -1) AS POLICY_ID,
+IFNULL(DEVICE_WITH_POLICY_INFO_VIEW.IS_COMPLIANT, -1) AS IS_COMPLIANT,
+DEVICE_INFO_VIEW.TENANT_ID
FROM
-DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO
-ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID
-ORDER BY DEVICE_INFO.DEVICE_ID;
-GO
+DEVICE_INFO_VIEW
+LEFT JOIN
+DEVICE_WITH_POLICY_INFO_VIEW
+ON DEVICE_INFO_VIEW.DEVICE_ID = DEVICE_WITH_POLICY_INFO_VIEW.DEVICE_ID
+ORDER BY DEVICE_INFO_VIEW.DEVICE_ID;
CREATE VIEW FEATURE_NON_COMPLIANCE_INFO AS
-SELECT TOP 100 PERCENT
+SELECT
DM_DEVICE.ID AS DEVICE_ID,
DM_DEVICE.DEVICE_IDENTIFICATION,
DM_DEVICE_DETAIL.DEVICE_MODEL,
@@ -545,8 +573,7 @@ DM_ENROLMENT.OWNERSHIP,
DM_ENROLMENT.OWNER,
DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
DM_POLICY_COMPLIANCE_STATUS.POLICY_ID,
-DM_DEVICE_TYPE.NAME
-AS PLATFORM,
+DM_DEVICE_TYPE.NAME AS PLATFORM,
DM_POLICY_COMPLIANCE_FEATURES.FEATURE_CODE,
DM_POLICY_COMPLIANCE_FEATURES.STATUS AS IS_COMPLAINT,
DM_DEVICE.TENANT_ID
@@ -554,13 +581,11 @@ FROM
DM_POLICY_COMPLIANCE_FEATURES, DM_POLICY_COMPLIANCE_STATUS, DM_ENROLMENT, DM_DEVICE, DM_DEVICE_TYPE, DM_DEVICE_DETAIL
WHERE
DM_POLICY_COMPLIANCE_FEATURES.COMPLIANCE_STATUS_ID = DM_POLICY_COMPLIANCE_STATUS.ID AND
-DM_POLICY_COMPLIANCE_STATUS.ENROLMENT_ID =
-DM_ENROLMENT.ID AND
+DM_POLICY_COMPLIANCE_STATUS.ENROLMENT_ID = DM_ENROLMENT.ID AND
DM_POLICY_COMPLIANCE_STATUS.DEVICE_ID = DM_DEVICE.ID AND
DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND
DM_DEVICE.ID = DM_DEVICE_DETAIL.DEVICE_ID
ORDER BY TENANT_ID, DEVICE_ID;
-GO
-- END OF DASHBOARD RELATED VIEWS --
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql
index 098ebc5d98..8d1ddb215d 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql
@@ -585,3 +585,16 @@ ORDER BY TENANT_ID, DEVICE_ID;
-- END OF DASHBOARD RELATED VIEWS --
+-- CERTIFICATES TABLES --
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
+ ID INTEGER auto_increment NOT NULL,
+ SERIAL_NUMBER VARCHAR(500) DEFAULT NULL,
+ CERTIFICATE BLOB DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ USERNAME VARCHAR(500) DEFAULT NULL,
+ PRIMARY KEY (ID)
+)ENGINE = InnoDB;
+
+-- END CERTIFICATES TABLES --
+
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql
index dc3c6229f2..52083e9d8c 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql
@@ -2,7 +2,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
ID BIGSERIAL PRIMARY KEY,
NAME VARCHAR(300) DEFAULT NULL,
PROVIDER_TENANT_ID INTEGER DEFAULT 0,
- SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE
+ SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
+ UNIQUE(NAME)
);
CREATE TABLE IF NOT EXISTS DM_DEVICE (
@@ -272,7 +273,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
ID BIGSERIAL NOT NULL PRIMARY KEY,
POLICY_ID INTEGER NOT NULL,
- DEVICE_TYPE VARCHAR(300) NOT NULL,
+ DEVICE_TYPE VARCHAR(300) NOT NULL,
TENANT_ID INTEGER NOT NULL
);
@@ -289,18 +290,11 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
ON UPDATE NO ACTION
);
-
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
ID BIGSERIAL NOT NULL PRIMARY KEY,
DEVICE_GROUP_ID INT NOT NULL,
POLICY_ID INT NOT NULL,
TENANT_ID INT NOT NULL,
- PRIMARY KEY (ID),
- CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
- FOREIGN KEY (DEVICE_GROUP_ID)
- REFERENCES DM_GROUP (ID)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION,
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)
@@ -350,6 +344,52 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
-- POLICY RELATED TABLES FINISHED --
+-- DEVICE GROUP TABLES --
+
+CREATE TABLE IF NOT EXISTS DM_GROUP (
+ ID BIGSERIAL NOT NULL PRIMARY KEY,
+ GROUP_NAME VARCHAR(100) DEFAULT NULL,
+ DESCRIPTION BYTEA DEFAULT NULL,
+ DATE_OF_CREATE INTEGER DEFAULT NULL,
+ DATE_OF_LAST_UPDATE INTEGER DEFAULT NULL,
+ OWNER VARCHAR(45) DEFAULT NULL,
+ TENANT_ID INTEGER NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
+ ID BIGSERIAL NOT NULL PRIMARY KEY,
+ DEVICE_ID INTEGER DEFAULT NULL,
+ GROUP_ID INTEGER DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
+ REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+-- END OF DEVICE GROUP TABLES --
+
+-- POLICY AND DEVICE GROUP MAPPING --
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
+ ID BIGSERIAL NOT NULL PRIMARY KEY,
+ DEVICE_GROUP_ID INTEGER NOT NULL,
+ POLICY_ID INTEGER NOT NULL,
+ TENANT_ID INTEGER NOT NULL,
+ CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
+ FOREIGN KEY (DEVICE_GROUP_ID)
+ REFERENCES DM_GROUP (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
+ CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
+ FOREIGN KEY (POLICY_ID)
+ REFERENCES DM_POLICY (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+-- END OF POLICY AND DEVICE GROUP MAPPING --
+
-- NOTIFICATION TABLE --
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
NOTIFICATION_ID BIGSERIAL NOT NULL PRIMARY KEY,
@@ -420,7 +460,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
CPU_USAGE DECIMAL(5) NULL,
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
- PLUGGED_IN INT NULL,
+ PLUGGED_IN BOOLEAN NOT NULL DEFAULT FALSE,
UPDATE_TIMESTAMP BIGINT NOT NULL,
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
FOREIGN KEY (DEVICE_ID)