revert-70aa11f8
charitha 8 years ago
commit de6f2558c5

@ -78,7 +78,7 @@ public class GCMNotificationStrategy implements NotificationStrategy {
HttpURLConnection conn = null; HttpURLConnection conn = null;
try { try {
conn = (HttpURLConnection) (new URL(config.getProperty(GCM_ENDPOINT)).openConnection()); conn = (HttpURLConnection) new URL(GCM_ENDPOINT).openConnection();
conn.setDoOutput(true); conn.setDoOutput(true);
conn.setUseCaches(false); conn.setUseCaches(false);
conn.setFixedLengthStreamingMode(bytes.length); conn.setFixedLengthStreamingMode(bytes.length);

@ -374,7 +374,7 @@ public interface PolicyManagementService {
required = true) required = true)
List<Integer> policyIds); List<Integer> policyIds);
@PUT @POST
@Path("/deactivate-policy") @Path("/deactivate-policy")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,

@ -254,7 +254,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
} }
} }
@PUT @POST
@Path("/activate-policy") @Path("/activate-policy")
@Override @Override
public Response activatePolicies(List<Integer> policyIds) { public Response activatePolicies(List<Integer> policyIds) {
@ -286,7 +286,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
} }
} }
@PUT @POST
@Path("/deactivate-policy") @Path("/deactivate-policy")
@Override @Override
public Response deactivatePolicies(List<Integer> policyIds) { public Response deactivatePolicies(List<Integer> policyIds) {

@ -415,31 +415,24 @@ public class OperationManagerImpl implements OperationManager {
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO. org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getNextOperation(
getNextOperation( enrolmentId);
enrolmentId);
if (dtoOperation != null) { if (dtoOperation != null) {
if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND. if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND.equals(dtoOperation.getType()
equals(dtoOperation )) {
.getType())) {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
commandOperation = commandOperation =
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. (org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
getOperation( getOperation(dtoOperation.getId());
dtoOperation
.getId());
dtoOperation.setEnabled(commandOperation.isEnabled()); dtoOperation.setEnabled(commandOperation.isEnabled());
} else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG. } else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG.equals(dtoOperation.
equals(dtoOperation getType())) {
.getType())) {
dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = configOperationDAO.getOperation(dtoOperation.getId());
} else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE. } else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE.equals(dtoOperation.
equals(dtoOperation getType())) {
.getType())) {
dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId());
} else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY. } else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY.equals(dtoOperation.
equals(dtoOperation getType())) {
.getType())) {
dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId());
} }
operation = OperationDAOUtil.convertOperation(dtoOperation); operation = OperationDAOUtil.convertOperation(dtoOperation);

@ -181,7 +181,7 @@ public interface DeviceManagementProviderService {
* @return true if the user owns the device else will return false. * @return true if the user owns the device else will return false.
* @throws DeviceManagementException If some unusual behaviour is observed while fetching the device. * @throws DeviceManagementException If some unusual behaviour is observed while fetching the device.
*/ */
public boolean isEnrolled(DeviceIdentifier deviceId, String user) throws DeviceManagementException; boolean isEnrolled(DeviceIdentifier deviceId, String user) throws DeviceManagementException;
License getLicense(String deviceType, String languageCode) throws DeviceManagementException; License getLicense(String deviceType, String languageCode) throws DeviceManagementException;

@ -28,13 +28,15 @@
<baseDirectory>${basedir}/src</baseDirectory> <baseDirectory>${basedir}/src</baseDirectory>
<fileSets> <fileSets>
<fileSet> <fileSet>
<!-- CDMF base app -->
<directory>${basedir}/src/main/resources/jaggeryapps/devicemgt</directory> <directory>${basedir}/src/main/resources/jaggeryapps/devicemgt</directory>
<outputDirectory>/jaggeryapps/devicemgt-cdmf/</outputDirectory> <outputDirectory>/jaggeryapps/devicemgt-cdmf/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes> <useDefaultExcludes>true</useDefaultExcludes>
</fileSet> </fileSet>
<fileSet> <fileSet>
<!-- UUF framework app -->
<directory>${basedir}/src/main/resources/jaggeryapps/uuf-template-app</directory> <directory>${basedir}/src/main/resources/jaggeryapps/uuf-template-app</directory>
<outputDirectory>/jaggeryapps/devicemgt-cdmf/</outputDirectory> <outputDirectory>/jaggeryapps/uuf-template-app/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes> <useDefaultExcludes>true</useDefaultExcludes>
</fileSet> </fileSet>
<fileSet> <fileSet>

@ -30,21 +30,22 @@ under the License. --}}
</head> </head>
<body> <body>
<!--modal--> <!--modal-->
<div class="wr-modalpopup"> <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modalDemo">
<div class="modalpopup-container"> <div class="modal-dialog" role="document">
<div class="modalpopup-close-btn" onclick="hidePopup();"> <div class="modal-content clearfix">
<span class="fw-stack"> <div class="modal-header">
<i class="fw fw-ring fw-stack-2x"></i> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<i class="fw fw-left-arrow fw-stack-1x"></i> </div>
</span> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
GO BACK
</div> </div>
<div class="modalpopup-content"> <div class="modal-footer">
<!-- dynamic content --> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div> </div>
</div> </div>
<div class="modalpopup-bg"></div>
</div> </div>
<!--modal--> <!--modal-->
{{defineZone "header"}} {{defineZone "header"}}

@ -45,7 +45,12 @@ policyModule = function () {
policyObjectToView["priorityId"] = policyObjectFromRestEndpoint["priorityId"]; policyObjectToView["priorityId"] = policyObjectFromRestEndpoint["priorityId"];
policyObjectToView["name"] = policyObjectFromRestEndpoint["policyName"]; policyObjectToView["name"] = policyObjectFromRestEndpoint["policyName"];
policyObjectToView["platform"] = policyObjectFromRestEndpoint["profile"]["deviceType"]; policyObjectToView["platform"] = policyObjectFromRestEndpoint["profile"]["deviceType"];
policyObjectToView["icon"] = utility.getDeviceThumb(policyObjectToView["platform"]); if (policyObjectToView["platform"] == "ios") {
policyObjectToView["deviceTypeIcon"] = "apple";
} else {
policyObjectToView["deviceTypeIcon"] = policyObjectToView["platform"];
}
//policyObjectToView["icon"] = utility.getDeviceThumb(policyObjectToView["platform"]);
policyObjectToView["ownershipType"] = policyObjectFromRestEndpoint["ownershipType"]; policyObjectToView["ownershipType"] = policyObjectFromRestEndpoint["ownershipType"];
var assignedRoleCount = policyObjectFromRestEndpoint["roles"].length; var assignedRoleCount = policyObjectFromRestEndpoint["roles"].length;

@ -308,7 +308,9 @@ var userModule = function () {
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] +
"/roles/" + encodeURIComponent(roleName); "/roles/" + encodeURIComponent(roleName);
var response = privateMethods.callBackend(url, constants["HTTP_GET"]); var response = privateMethods.callBackend(url, constants["HTTP_GET"]);
response.content = parse(response.content); if (response.status == "success") {
response.content = parse(response.content);
}
return response; return response;
} catch (e) { } catch (e) {
throw e; throw e;

@ -12,9 +12,9 @@ $(function () {
$(sortableElem).disableSelection(); $(sortableElem).disableSelection();
}); });
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modalpopup-container"; var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-content";
var body = "body"; var body = "body";
var isInit = true; var isInit = true;
@ -34,8 +34,8 @@ function setPopupMaxHeight() {
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); //setPopupMaxHeight();
} }
/* /*
@ -43,7 +43,9 @@ function showPopup() {
*/ */
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
} }
/** /**

@ -438,9 +438,9 @@ $(document).ready(function () {
}); });
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modalpopup-container"; var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-content";
var body = "body"; var body = "body";
/* /*
@ -455,8 +455,8 @@ function setPopupMaxHeight() {
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); //setPopupMaxHeight();
} }
/* /*
@ -464,7 +464,9 @@ function showPopup() {
*/ */
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
} }
/** /**

@ -251,9 +251,9 @@ $(document).ready(function () {
}); });
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modalpopup-container"; var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-content";
var body = "body"; var body = "body";
/* /*
@ -268,8 +268,8 @@ function setPopupMaxHeight() {
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); //setPopupMaxHeight();
} }
/* /*
@ -277,7 +277,9 @@ function showPopup() {
*/ */
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
} }
/** /**

@ -61,9 +61,9 @@ var sortElements = function () {
* Modal related stuff are as follows. * Modal related stuff are as follows.
*/ */
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modalpopup-container"; var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-content";
var body = "body"; var body = "body";
/* /*
@ -81,8 +81,8 @@ function setPopupMaxHeight() {
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); //setPopupMaxHeight();
} }
/* /*
@ -90,7 +90,9 @@ function showPopup() {
*/ */
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
} }
/* /*

@ -24,17 +24,117 @@
</a> </a>
</li> </li>
<li> <li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles"> <a href="{{@app.context}}/roles">
Roles Roles
</a> </a>
</li> </li>
<li> <li>
<a href="{{@app.context}}/roles/add-role"> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/role/add">
Add Add
</a> </a>
</li> </li>
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{unit "cdmf.unit.role.create"}} <!-- content/body -->
<div class="row">
<div class="col-md-12">
<!-- content -->
<div id="role-create-form" class="container col-centered wr-content">
<div class="wr-form">
<p class="page-sub-title">Add Role</p>
<hr />
<div class="row">
<div class="col-lg-8">
<div class="wr-steps">
<div class="col-md-6 col-xs-6">
<div class="itm-wiz itm-wiz-current" data-step="policy-platform">
<div class="wiz-no">1</div>
<div class="wiz-lbl hidden-xs"><span>Add a role</span></div>
</div>
</div>
<div class="col-md-6 col-xs-6">
<div class="itm-wiz" data-step="policy-profile">
<div class="wiz-no">2</div>
<div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div>
</div>
</div>
<br class="c-both" />
</div>
<br /><br />
<hr />
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<label class="wr-input-label">User Store Domain</label>
<div class="wr-input-control">
<!--suppress HtmlFormInputWithoutLabel -->
<select id="domain" class="form-control select">
<option>PRIMARY</option>
{{#each userStores}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
<label class="wr-input-label">
Role Name *
</label>
<br>
<label class="wr-input-label">
( {{roleNameHelpText}} )
</label>
<div id="roleNameField" class="form-group wr-input-control">
<!--suppress HtmlFormInputWithoutLabel -->
<input type="text" id="roleName" data-regex="{{roleNameJSRegEx}}"
data-error-msg="{{roleNameRegExViolationErrorMsg}}" class="form-control" />
<span class="roleNameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error roleNameEmpty hidden" for="summary">
Role name is required, should be in minimum 3 characters long and not include any whitespaces.
</label>
</div>
<label class="wr-input-label">
User list
</label>
<div class="wr-input-control">
<!--suppress HtmlFormInputWithoutLabel -->
<select id="users" class="form-control select2" multiple="multiple"></select>
</div>
</div>
</div>
<br>
<button id="add-role-btn" class="wr-btn">Add Role</button>
</div>
</div>
<div id="role-created-msg" class="container col-centered wr-content hidden">
<div class="wr-form">
<p class="page-sub-title">Role was added successfully.</p>
<br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click
<b>"View Role List"</b> to complete the process and go back to the role list.
<hr />
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
View Role List
</button>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/role/add" class="cu-btn-inner">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add Another Role
</a>
</div>
</div>
<!-- /content -->
<div id="app-context" data-app-context="{{@app.context}}" class="hidden"></div>
</div>
</div>
<!-- /content/body -->
{{/zone}}
{{#zone "bottomJs"}}
{{js "js/bottomJs.js"}}
{{/zone}} {{/zone}}

@ -25,14 +25,11 @@
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var response = userModule.getRoles();
if (response["status"] == "success") { context["userStores"] = userModule.getSecondaryUserStores();
context["roles"] = response["content"]; context["roleNameJSRegEx"] = deviceMgtProps["roleValidationConfig"]["roleNameJSRegEx"];
} context["roleNameHelpText"] = deviceMgtProps["roleValidationConfig"]["roleNameHelpMsg"];
var userStores = userModule.getSecondaryUserStores(); context["roleNameRegExViolationErrorMsg"] = deviceMgtProps["roleValidationConfig"]["roleNameRegExViolationErrorMsg"];
context["userStores"] = userStores;
context["roleNameJSRegEx"] = deviceMgtProps.roleValidationConfig.rolenameJSRegEx;
context["roleNameHelpText"] = deviceMgtProps.roleValidationConfig.rolenameHelpMsg;
context["roleNameRegExViolationErrorMsg"] = deviceMgtProps.roleValidationConfig.rolenameRegExViolationErrorMsg;
return context; return context;
} }

@ -1,5 +1,5 @@
{ {
"version": "1.0.0", "version": "1.0.0",
"uri": "/roles/add-role", "uri": "/role/add",
"layout": "cdmf.layout.default" "layout": "cdmf.layout.default"
} }

@ -73,19 +73,19 @@ var disableInlineError = function (inputField, errorMsg, errorSign) {
*clear inline validation messages. *clear inline validation messages.
*/ */
clearInline["role-name"] = function () { clearInline["role-name"] = function () {
disableInlineError("roleNameField", "rolenameEmpty", "rolenameError"); disableInlineError("roleNameField", "roleNameEmpty", "roleNameError");
}; };
/** /**
* Validate if provided rolename is valid against RegEx configures. * Validate if provided role-name is valid against RegEx configures.
*/ */
validateInline["role-name"] = function () { validateInline["role-name"] = function () {
var rolenameinput = $("input#rolename"); var roleNameInput = $("input#roleName");
if (inputIsValid( rolenameinput.data("regex"), rolenameinput.val())) { if (inputIsValid( roleNameInput.data("regex"), roleNameInput.val())) {
disableInlineError("roleNameField", "rolenameEmpty", "rolenameError"); disableInlineError("roleNameField", "roleNameEmpty", "roleNameError");
} else { } else {
enableInlineError("roleNameField", "rolenameEmpty", "rolenameError"); enableInlineError("roleNameField", "roleNameEmpty", "roleNameError");
} }
}; };
@ -97,16 +97,16 @@ function formatRepo (user) {
return; return;
} }
var markup = '<div class="clearfix">' + var markup = '<div class="clearfix">' +
'<div clas="col-sm-8">' + '<div class="col-sm-8">' +
'<div class="clearfix">' + '<div class="clearfix">' +
'<div class="col-sm-3">' + user.username + '</div>'; '<div class="col-sm-3">User : ' + user.username + '</div>';
if (user.firstname) { if (user.name) {
markup += '<div class="col-sm-3"><i class="fa fa-code-fork"></i> ' + user.firstname + '</div>'; markup += '<div class="col-sm-3"> ' + user.name + '</div>';
} }
if (user.emailAddress) { if (user.emailAddress) {
markup += '<div class="col-sm-2"><i class="fa fa-star"></i> ' + user.emailAddress + '</div></div>'; markup += '<div class="col-sm-3"> ' + user.emailAddress + '</div>';
} }
markup += '</div></div>'; markup += '</div></div></div>';
return markup; return markup;
} }
@ -129,17 +129,19 @@ $(document).ready(function () {
}, },
data: function (params) { data: function (params) {
var postData = {}; var postData = {};
postData.actionMethod = "GET"; postData.requestMethod = "GET";
postData.actionUrl = apiBasePath + "/users/search/usernames?filter=" + params.term; postData.requestURL = "/api/device-mgt/v1.0/users/search/usernames?filter=" + params.term;
postData.actionPayload = null; postData.requestPayload = null;
return JSON.stringify(postData); return JSON.stringify(postData);
}, },
processResults: function (data, page) { processResults: function (data) {
var newData = []; var newData = [];
$.each(data, function (index, value) { $.each(data, function (index, value) {
var user = {}; var user = {};
user.username = value.username;
user.id = value.username; user.id = value.username;
user.username = value.username;
user.name = value.firstname + " " + value.lastname;
user.emailAddress = value.emailAddress;
newData.push(user); newData.push(user);
}); });
return { return {
@ -159,10 +161,10 @@ $(document).ready(function () {
* when a user clicks on "Add Role" button * when a user clicks on "Add Role" button
* on Add Role page in WSO2 MDM Console. * on Add Role page in WSO2 MDM Console.
*/ */
$("button#add-role-btn").click(function() { $("button#add-role-btn").click(function () {
var rolenameInput = $("input#rolename");
var roleName = rolenameInput.val();
var domain = $("#domain").val(); var domain = $("#domain").val();
var roleNameInput = $("input#roleName");
var roleName = roleNameInput.val();
var users = $("#users").val(); var users = $("#users").val();
var errorMsgWrapper = "#role-create-error-msg"; var errorMsgWrapper = "#role-create-error-msg";
@ -170,8 +172,8 @@ $(document).ready(function () {
if (!roleName) { if (!roleName) {
$(errorMsg).text("Role name is a required field. It cannot be empty."); $(errorMsg).text("Role name is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden"); $(errorMsgWrapper).removeClass("hidden");
} else if (!inputIsValid(rolenameInput.data("regex"), roleName)) { } else if (!inputIsValid(roleNameInput.data("regex"), roleName)) {
$(errorMsg).text(rolenameInput.data("errormsg")); $(errorMsg).text(roleNameInput.data("error-msg"));
$(errorMsgWrapper).removeClass("hidden"); $(errorMsgWrapper).removeClass("hidden");
} else if (!domain) { } else if (!domain) {
$(errorMsg).text("Domain is a required field. It cannot be empty."); $(errorMsg).text("Domain is a required field. It cannot be empty.");
@ -181,13 +183,11 @@ $(document).ready(function () {
$(errorMsgWrapper).removeClass("hidden"); $(errorMsgWrapper).removeClass("hidden");
} else { } else {
var addRoleFormData = {}; var addRoleFormData = {};
addRoleFormData.roleName = roleName; addRoleFormData.roleName = roleName;
if (domain != "PRIMARY"){ if (domain != "PRIMARY"){
addRoleFormData.roleName = domain + "/" + roleName; addRoleFormData.roleName = domain + "/" + roleName;
} }
if (users == null){ if (users == null) {
users = []; users = [];
} }
addRoleFormData.users = users; addRoleFormData.users = users;
@ -197,37 +197,31 @@ $(document).ready(function () {
invokerUtil.post( invokerUtil.post(
addRoleAPI, addRoleAPI,
addRoleFormData, addRoleFormData,
function (data) { function (data, textStatus, jqXHR) {
data = JSON.parse(data); if (jqXHR.status == 201) {
if (data.errorMessage) {
$(errorMsg).text("Selected user store prompted an error : " + data.errorMessage);
$(errorMsgWrapper).removeClass("hidden");
} else {
// Clearing user input fields. // Clearing user input fields.
//$("input#rolename").val(""); $("input#roleName").val("");
//$("#domain").val(""); $("#domain").val("PRIMARY");
//// Refreshing with success message $("#users").val("");
//$("#role-create-form").addClass("hidden"); window.location.href = appContext + "/role/edit-permission/" + roleName;
//$("#role-created-msg").removeClass("hidden");
window.location.href = appContext + '/role/edit-permission/' + roleName;
} }
}, function (data) { },
if (JSON.parse(data).errorMessage.indexOf("RoleExisting") > -1) { function (jqXHR) {
$(errorMsg).text("Role name : " + roleName + " already exists. Pick another role name."); if (jqXHR.status == 500) {
} else { $(errorMsg).text("Either role already exists or unexpected error.");
$(errorMsg).text(JSON.parse(data.responseText).errorMessage); $(errorMsgWrapper).removeClass("hidden");
} }
$(errorMsgWrapper).removeClass("hidden");
} }
); );
} }
}); });
$("#rolename").focus(function() { var roleNameInputElement = "#roleName";
$(roleNameInputElement).focus(function() {
clearInline["role-name"](); clearInline["role-name"]();
}); });
$("#rolename").blur(function() { $(roleNameInputElement).blur(function() {
validateInline["role-name"](); validateInline["role-name"]();
}); });
}); });

@ -26,6 +26,7 @@
</a> </a>
</li> </li>
<li> <li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles"> <a href="{{@app.context}}/roles">
Roles Roles
</a> </a>

@ -0,0 +1,222 @@
/*
* 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.
*/
var loadRoleBasedActionURL = function (action, rolename) {
var href = $("#ast-container").data("app-context") + "role/" + action + "/" + rolename;
$(location).attr('href', href);
};
$(function () {
var sortableElem = '.wr-sortable';
$(sortableElem).sortable({
beforeStop: function () {
$(this).sortable('toArray');
}
});
$(sortableElem).disableSelection();
});
var apiBasePath = "/api/device-mgt/v1.0";
var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modal-content";
var body = "body";
var isInit = true;
$(".icon .text").res_text(0.2);
/*
* set popup maximum height function.
*/
function setPopupMaxHeight() {
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));
$(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2)));
}
/*
* show popup function.
*/
function showPopup() {
$(modalPopup).modal('show');
//setPopupMaxHeight();
}
/*
* hide popup function.
*/
function hidePopup() {
$(modalPopupContent).html('');
$(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
}
/**
* Following function would execute
* when a user clicks on the list item
* initial mode and with out select mode.
*/
function InitiateViewOption() {
$(location).attr('href', $(this).data("url"));
}
function loadRoles() {
var loadingContent = $("#loading-content");
loadingContent.show();
var dataFilter = function (data) {
data = JSON.parse(data);
var objects = [];
$(data.roles).each(function( index ) {
objects.push(
{
name: data.roles[index],
DT_RowId: "role-" + data.roles[index]
}
)
});
var json = {
"recordsTotal": data.count,
"recordsFiltered": data.count,
"data": objects
};
return JSON.stringify(json);
};
//noinspection JSUnusedLocalSymbols
var fnCreatedRow = function (nRow, aData, iDataIndex) {
$(nRow).attr('data-type', 'selectable');
};
//noinspection JSUnusedLocalSymbols
var columns = [
{
class: "remove-padding icon-only content-fill",
data: null,
defaultContent: "<div class='thumbnail icon'>" +
"<i class='square-element text fw fw-bookmark' style='font-size: 30px;'></i>" +
"</div>"
},
{
class: "fade-edge",
data: "name",
render: function (name, type, row, meta) {
return '<h4>&nbsp;&nbsp;' + name + '&nbsp;role</h4>';
}
},
{
class: "text-right content-fill text-left-on-grid-view no-wrap",
data: null,
render: function (data, type, row, meta) {
return '&nbsp;' +
'<a onclick="javascript:loadRoleBasedActionURL(\'edit\', \'' + data.name + '\')" ' +
'data-role="' + data.name + '" ' +
'data-click-event="edit-form" ' +
'class="btn padding-reduce-on-grid-view edit-role-link">' +
'<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-bookmark fw-stack-1x"></i>' +
'<span class="fw-stack fw-move-right fw-move-bottom">' +
'<i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i>' +
'<i class="fw fw-circle fw-stack-2x"></i><i class="fw fw-edit fw-stack-1x fw-inverse"></i>' +
'</span>' +
'</span>' +
'<span class="hidden-xs hidden-on-grid-view">&nbsp;&nbsp;Edit</span>' +
'</a>' +
'&nbsp;<a onclick="javascript:loadRoleBasedActionURL(\'edit-permission\', \'' + data.name + '\')" ' +
'data-role="' + data.name + '" ' +
'data-click-event="edit-form" ' +
'class="btn padding-reduce-on-grid-view edit-permission-link">' +
'<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-security-policy fw-stack-1x"></i>' +
'<span class="fw-stack fw-move-right fw-move-bottom">' +
'<i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i>' +
'<i class="fw fw-circle fw-stack-2x"></i><i class="fw fw-edit fw-stack-1x fw-inverse"></i>' +
'</span>' +
'</span>' +
'<span class="hidden-xs hidden-on-grid-view">&nbsp;&nbsp;Edit Permission</span>' +
'</a>' +
'&nbsp;<a data-role="' + data.name + '" ' +
'data-click-event="remove-form" ' +
'class="btn padding-reduce-on-grid-view remove-role-link">' +
'<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-delete fw-stack-1x"></i>' +
'</span>' +
'<span class="hidden-xs hidden-on-grid-view">&nbsp;&nbsp;Remove</span>' +
'</a>';
}
}
];
var options = {
"placeholder": "Search By Role Name",
"searchKey" : "filter"
};
$('#role-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/roles', dataFilter, columns, fnCreatedRow, null, options);
loadingContent.hide();
}
/**
* Following click function would execute
* when a user clicks on "Remove" link
* on Role Listing page in WSO2 Devicemgt Console.
*/
$("#role-grid").on("click", ".remove-role-link", function () {
var role = $(this).data("role");
var removeRoleAPI = apiBasePath + "/roles/" + role;
$(modalPopupContent).html($('#remove-role-modal-content').html());
showPopup();
$("a#remove-role-yes-link").click(function () {
invokerUtil.delete(
removeRoleAPI,
function () {
$("#role-" + role).remove();
$(modalPopupContent).html($('#remove-role-success-content').html());
$("a#remove-role-success-link").click(function () {
hidePopup();
});
},
function () {
$(modalPopupContent).html($('#remove-role-error-content').html());
$("a#remove-role-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#remove-role-cancel-link").click(function () {
hidePopup();
});
});
$(document).ready(function () {
loadRoles();
});

@ -15,8 +15,8 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
}} }}
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}
@ -26,6 +26,7 @@
</a> </a>
</li> </li>
<li> <li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles"> <a href="{{@app.context}}/roles">
Roles Roles
</a> </a>
@ -34,7 +35,8 @@
{{#zone "navbarActions"}} {{#zone "navbarActions"}}
<li> <li>
<a href="{{@app.context}}/roles/add-role" class="cu-btn"> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/role/add" class="cu-btn">
<span class="icon fw-stack"> <span class="icon fw-stack">
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
@ -45,5 +47,114 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{unit "cdmf.unit.role.listing"}} {{!
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.
}}
<div id="loading-content" class="col-centered">
{{#if removePermitted}}
<input type="hidden" id="can-remove" value="true" />
{{/if}}
{{#if editPermitted}}
<input type="hidden" id="can-edit" value="true" />
{{/if}}
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading roles . . .
<br>
</div>
<div id="role-table" data-role={{adminRole}}>
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view" id="role-grid">
<thead>
<tr class="sort-row">
<th>By Role Name</th>
</tr>
<tr class="bulk-action-row">
<th colspan="3"></th>
</tr>
</thead>
<tbody id="ast-container" data-app-context="{{appContext}}"></tbody>
</table>
</div>
<div id="content-filter-types" style="display: none">
<div class="sort-title">Sort By</div>
<div class="sort-options">
<!--suppress HtmlUnknownTag -->
<th>By Role name</th>
</div>
</div>
<div id="remove-role-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Do you really want to remove this role ?</h3>
<div class="buttons">
<a href="#" id="remove-role-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-role-cancel-link" class="btn-operations">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-role-success-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Done. Role was successfully removed.</h3>
<div class="buttons">
<a href="#" id="remove-role-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-role-error-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>An unexpected error occurred. Please try again later.</h3>
<div class="buttons">
<a href="#" id="remove-role-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget -->
<script id="role-listing" data-current-user="{{currentUser.username}}"
src="{{@page.publicUri}}/templates/role-listing.hbs" type="text/x-handlebars-template"></script>
{{js "js/role-listing.js"}}
{{/zone}} {{/zone}}

@ -18,8 +18,8 @@
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var response = userModule.getUsers(); var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var users = {};
context["permissions"] = userModule.getUIPermissions(); context["permissions"] = userModule.getUIPermissions();
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/delete")) { if (userModule.isAuthorized("/permission/admin/device-mgt/roles/delete")) {
context["removePermitted"] = true; context["removePermitted"] = true;
@ -30,8 +30,9 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) { if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) {
context["removePermitted"] = true; context["removePermitted"] = true;
} }
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
context["appContext"] = deviceMgtProps.appContext; context["appContext"] = deviceMgtProps["appContext"];
context["adminRole"] = deviceMgtProps.adminRole; context["adminRole"] = deviceMgtProps["adminRole"];
return context; return context;
} }

@ -32,18 +32,17 @@ $(function () {
var sortableElem = '.wr-sortable'; var sortableElem = '.wr-sortable';
$(sortableElem).sortable({ $(sortableElem).sortable({
beforeStop: function () { beforeStop: function () {
var sortedIDs = $(this).sortable('toArray'); $(this).sortable('toArray');
} }
}); });
$(sortableElem).disableSelection(); $(sortableElem).disableSelection();
}); });
var apiBasePath = "/api/device-mgt/v1.0"; var apiBasePath = "/api/device-mgt/v1.0";
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modalpopup-container"; var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-body";
var body = "body"; var body = "body";
var isInit = true;
$(".icon .text").res_text(0.2); $(".icon .text").res_text(0.2);
/* /*
@ -58,7 +57,7 @@ function setPopupMaxHeight() {
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); setPopupMaxHeight();
} }
@ -67,19 +66,7 @@ function showPopup() {
*/ */
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
}
/*
* Function to get selected usernames.
*/
function getSelectedUsernames() {
var usernameList = [];
var userList = $("#user-grid").find('tr.DTTT_selected');
userList.each(function () {
usernameList.push($(this).data('username'));
});
return usernameList;
} }
/** /**
@ -87,7 +74,7 @@ function getSelectedUsernames() {
* when a user clicks on "Invite" link * when a user clicks on "Invite" link
* on User Management page in WSO2 MDM Console. * on User Management page in WSO2 MDM Console.
*/ */
$("a.invite-user-link").click(function () { $("a#invite-user-link").click(function () {
var usernameList = getSelectedUsernames(); var usernameList = getSelectedUsernames();
var inviteUserAPI = apiBasePath + "/users/send-invitation"; var inviteUserAPI = apiBasePath + "/users/send-invitation";
@ -123,44 +110,16 @@ $("a.invite-user-link").click(function () {
}); });
}); });
/** /*
* Following click function would execute * Function to get selected usernames.
* when a user clicks on "Remove" link
* on User Listing page in WSO2 MDM Console.
*/ */
function removeUser(uname) { function getSelectedUsernames() {
var username = uname; var usernameList = [];
var removeUserAPI = apiBasePath + "/users/" + username; var userList = $("#user-grid").find("tr.DTTT_selected");
$(modalPopupContent).html($('#remove-user-modal-content').html()); userList.each(function () {
showPopup(); usernameList.push($(this).data('username'));
$("a#remove-user-yes-link").click(function () {
invokerUtil.delete(
removeUserAPI,
function () {
$("#role-" + username).remove();
// get new user-list-count
var newUserListCount = $(".user-list > span").length;
// update user-listing-status-msg with new user-count
$("#user-listing-status-msg").text("Total number of Users found : " + newUserListCount);
// update modal-content with success message
$(modalPopupContent).html($('#remove-user-success-content').html());
$("a#remove-user-success-link").click(function () {
hidePopup();
});
},
function () {
$(modalPopupContent).html($('#remove-user-error-content').html());
$("a#remove-user-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#remove-user-cancel-link").click(function () {
hidePopup();
}); });
return usernameList;
} }
/** /**
@ -168,15 +127,13 @@ function removeUser(uname) {
* when a user clicks on "Reset Password" link * when a user clicks on "Reset Password" link
* on User Listing page in WSO2 MDM Console. * on User Listing page in WSO2 MDM Console.
*/ */
function resetPassword(uname) { function resetPassword(username) {
$(modalPopupContent).html($('#reset-password-window').html()); $(modalPopupContent).html($('#reset-password-window').html());
showPopup(); showPopup();
$("a#reset-password-yes-link").click(function () { $("a#reset-password-yes-link").click(function () {
var newPassword = $("#new-password").val(); var newPassword = $("#new-password").val();
var confirmedPassword = $("#confirmed-password").val(); var confirmedPassword = $("#confirmed-password").val();
var user = uname;
var errorMsgWrapper = "#notification-error-msg"; var errorMsgWrapper = "#notification-error-msg";
var errorMsg = "#notification-error-msg span"; var errorMsg = "#notification-error-msg span";
@ -194,22 +151,24 @@ function resetPassword(uname) {
$(errorMsgWrapper).removeClass("hidden"); $(errorMsgWrapper).removeClass("hidden");
} else { } else {
var resetPasswordFormData = {}; var resetPasswordFormData = {};
//resetPasswordFormData.username = user;
resetPasswordFormData.newPassword = unescape(confirmedPassword); resetPasswordFormData.newPassword = unescape(confirmedPassword);
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ user +"/credentials"; var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ username +"/credentials";
invokerUtil.post( invokerUtil.post(
resetPasswordServiceURL, resetPasswordServiceURL,
resetPasswordFormData, resetPasswordFormData,
function (data, textStatus, jqXHR) { // The success callback // The success callback
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) { if (jqXHR.status == 200) {
$(modalPopupContent).html($('#reset-password-success-content').html()); $(modalPopupContent).html($('#reset-password-success-content').html());
$("a#reset-password-success-link").click(function () { $("a#reset-password-success-link").click(function () {
hidePopup(); hidePopup();
}); });
} }
}, function (jqXHR) { // The error callback },
// The error callback
function (jqXHR) {
var payload = JSON.parse(jqXHR.responseText); var payload = JSON.parse(jqXHR.responseText);
$(errorMsg).text(payload.message); $(errorMsg).text(payload.message);
$(errorMsgWrapper).removeClass("hidden"); $(errorMsgWrapper).removeClass("hidden");
@ -224,15 +183,41 @@ function resetPassword(uname) {
} }
/** /**
* Following on click function would execute * Following click function would execute
* when a user type on the search field on User Listing page in * when a user clicks on "Remove" link
* WSO2 MDM Console then click on the search button. * on User Listing page in WSO2 MDM Console.
*/ */
$("#search-btn").click(function () { function removeUser(username) {
var searchQuery = $("#search-by-username").val(); var removeUserAPI = apiBasePath + "/users/" + username;
$("#ast-container").empty(); $(modalPopupContent).html($('#remove-user-modal-content').html());
loadUsers(searchQuery); showPopup();
});
$("a#remove-user-yes-link").click(function () {
invokerUtil.delete(
removeUserAPI,
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) {
$("#user-" + username).remove();
// update modal-content with success message
$(modalPopupContent).html($('#remove-user-success-content').html());
$("a#remove-user-success-link").click(function () {
hidePopup();
});
}
},
function () {
$(modalPopupContent).html($('#remove-user-error-content').html());
$("a#remove-user-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#remove-user-cancel-link").click(function () {
hidePopup();
});
}
/** /**
* Following function would execute * Following function would execute
@ -248,169 +233,132 @@ function InitiateViewOption() {
} }
} }
function loadUsers(searchParam) { function loadUsers() {
var loadingContentView = "#loading-content";
$(loadingContentView).show();
$("#loading-content").show();
var dataFilter = function (data) {
var dataFilter = function(data){
data = JSON.parse(data); data = JSON.parse(data);
var objects = []; var objects = [];
$(data.users).each(function( index ) { $(data.users).each( function (index) {
objects.push({ objects.push({
filter: data.users[index].username, filter: data.users[index].username,
firstname: data.users[index].firstname ? data.users[index].firstname: '' , firstname: data.users[index].firstname ? data.users[index].firstname : "" ,
lastname: data.users[index].lastname ? data.users[index].lastname : '', lastname: data.users[index].lastname ? data.users[index].lastname : "",
emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '', emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : "",
DT_RowId : "role-" + data.users[index].username}) DT_RowId : "user-" + data.users[index].username})
}); });
json = { var json = {
"recordsTotal": data.count, "recordsTotal": data.count,
"recordsFiltered": data.count, "recordsFiltered": data.count,
"data": objects "data": objects
}; };
return JSON.stringify( json ); return JSON.stringify(json);
} };
var fnCreatedRow = function( nRow, aData, iDataIndex ) { //noinspection JSUnusedLocalSymbols
var fnCreatedRow = function (nRow, aData, iDataIndex) {
$(nRow).attr('data-type', 'selectable'); $(nRow).attr('data-type', 'selectable');
$(nRow).attr('data-username', aData["filter"]); $(nRow).attr('data-username', aData["filter"]);
} };
//noinspection JSUnusedLocalSymbols
var columns = [ var columns = [
{ {
class: "remove-padding icon-only content-fill", class: "remove-padding icon-only content-fill",
data: null, data: null,
defaultContent: '<div class="thumbnail icon"> <i class="square-element text fw fw-user" style="font-size: 30px;"></i> </div>' defaultContent: '<div class="thumbnail icon">' +
'<i class="square-element text fw fw-user" style="font-size: 30px;"></i>' +
'</div>'
}, },
{ {
class: "fade-edge", class: "fade-edge",
data: null, data: null,
render: function ( data, type, row, meta ) { render: function (data, type, row, meta) {
return '<h4>' + data.firstname + ' ' + data.lastname + '</h4>'; if (!data.firstname && !data.lastname) {
return "";
} else if (data.firstname && data.lastname) {
return "<h4>&nbsp;&nbsp;" + data.firstname + " " + data.lastname + "</h4>";
}
} }
}, },
{ {
class: "fade-edge remove-padding-top", class: "fade-edge remove-padding-top",
data: 'filter', data: 'filter',
render: function ( filter, type, row, meta ) { render: function (filter, type, row, meta) {
return '<i class="fw-user"></i> ' + filter; return '&nbsp;&nbsp;<i class="fw-user"></i>&nbsp;&nbsp;' + filter;
} }
}, },
{ {
class: "fade-edge remove-padding-top", class: "fade-edge remove-padding-top",
data: null, data: null,
render: function ( data, type, row, meta ) { render: function (data, type, row, meta) {
return '<a href="mailto:' + data.emailAddress + ' " class="wr-list-email"> <i class="fw-mail"></i> ' + data.emailAddress + ' </a>'; if (!data.emailAddress) {
return "";
} else {
return "&nbsp;&nbsp;<a href='mailto:" + data.emailAddress + "' ><i class='fw-mail'></i>&nbsp;&nbsp;" + data.emailAddress + "</a>";
}
} }
}, },
{ {
class: "text-right content-fill text-left-on-grid-view no-wrap", class: "text-right content-fill text-left-on-grid-view no-wrap",
data: null, data: null,
render: function ( data, type, row, meta ) { render: function (data, type, row, meta) {
return '<a href="/emm/user/edit?username=' + data.filter + '" data-username="' + data.filter + return '&nbsp;<a href="/emm/user/edit?username=' + data.filter + '" data-username="' + data.filter + '" ' +
'" data-click-event="edit-form" class="btn padding-reduce-on-grid-view edit-user-link"> ' + 'data-click-event="edit-form" ' +
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-edit fw-stack-1x"></i>' + 'class="btn padding-reduce-on-grid-view edit-user-link"> ' +
' </span> <span class="hidden-xs hidden-on-grid-view">Edit</span> </a>' + '<span class="fw-stack"> ' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<a href="#" data-username="' + data.filter + '" data-userid=' + data.filter + '<i class="fw fw-edit fw-stack-1x"></i>' +
' data-click-event="remove-form" onclick="javascript:removeUser(\'' + data.filter + '\')" ' + '</span>' +
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Edit' +
'</span>' +
'</a>' +
'<a href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="edit-form" ' +
'onclick="javascript:resetPassword(\'' + data.filter + '\')" ' +
'class="btn padding-reduce-on-grid-view remove-user-link">' + 'class="btn padding-reduce-on-grid-view remove-user-link">' +
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-delete fw-stack-1x">' + '<span class="fw-stack">' +
'</i> </span> <span class="hidden-xs hidden-on-grid-view">Remove</span> </a>' + '<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-key fw-stack-1x"></i>' +
'<a href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '</span>' +
'" data-click-event="edit-form" onclick="javascript:resetPassword(\'' + data.filter + '<span class="hidden-xs hidden-on-grid-view">' +
'\')" class="btn padding-reduce-on-grid-view remove-user-link"> <span class="fw-stack"> <i class="fw fw-ring fw-stack-2x">' + '&nbsp;&nbsp;Reset Password' +
'</i> <i class="fw fw-key fw-stack-1x"></i> <span class="fw-stack fw-move-right fw-move-bottom"> <i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"><' + '</span>' +
'/i> <i class="fw fw-circle fw-stack-2x"></i> <i class="fw fw-refresh fw-stack-1x fw-inverse">' + '</a>' +
'</i> </span> </span> <span class="hidden-xs hidden-on-grid-view">Reset</span> </a>' '<a href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="remove-form" ' +
'onclick="javascript:removeUser(\'' + data.filter + '\')" ' +
'class="btn padding-reduce-on-grid-view remove-user-link">' +
'<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-delete fw-stack-1x"></i>' +
'</span>' +
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Remove' +
'</span>' +
'</a>';
} }
} }
]; ];
var options = { var options = {
"placeholder": "Search By Username", "placeholder": "Search By Username",
"searchKey" : "filter" "searchKey" : "filter"
}; };
$('#user-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options); $('#user-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options);
$(loadingContentView).hide();
$("#loading-content").hide();
// $("#loading-content").show();
// var userListing = $("#user-listing");
// var userListingSrc = userListing.attr("src");
// $.template("user-listing", userListingSrc, function (template) {
// var serviceURL = apiBasePath + "/users";
// if (searchParam) {
// serviceURL = serviceURL + "?filter=" + searchParam;
// }
// var successCallback = function (data) {
// if (!data) {
// $('#ast-container').addClass('hidden');
// $('#user-listing-status-msg').text('No users are available to be displayed.');
// return;
// }
// var canRemove = $("#can-remove").val();
// var canEdit = $("#can-edit").val();
// var canResetPassword = $("#can-reset-password").val();
// data = JSON.parse(data);
// var viewModel = {};
// viewModel.users = data.users;
// for (var i = 0; i < viewModel.users.length; i++) {
// viewModel.users[i].userid = viewModel.users[i].username.replace(/[^\w\s]/gi, '');
// if (canRemove) {
// viewModel.users[i].canRemove = true;
// }
// if (canEdit) {
// viewModel.users[i].canEdit = true;
// }
// if (canResetPassword) {
// viewModel.users[i].canResetPassword = true;
// }
// viewModel.users[i].adminUser = $("#user-table").data("user");
// }
// if (data.count > 0) {
// $('#ast-container').removeClass('hidden');
// $('#user-listing-status-msg').text("");
// var content = template(viewModel);
// $("#ast-container").html(content);
// } else {
// $('#ast-container').addClass('hidden');
// $('#user-listing-status-msg').text('No users are available to be displayed.');
// }
// $("#loading-content").hide();
// if (isInit) {
// $('#user-grid').datatables_extended();
// isInit = false;
// }
// $(".icon .text").res_text(0.2);
// };
// invokerUtil.get(serviceURL,
// successCallback,
// function (message) {
// $('#ast-container').addClass('hidden');
// $('#user-listing-status-msg').
// text('Invalid search query. Try again with a valid search query');
// }
// );
// });
} }
$(document).ready(function () { $(document).ready(function () {
loadUsers(); loadUsers();
$(".viewEnabledIcon").click(function () { $(".viewEnabledIcon").click(function () {
InitiateViewOption(); InitiateViewOption();
}); });

@ -15,8 +15,8 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
}} }}
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}
@ -26,6 +26,7 @@
</a> </a>
</li> </li>
<li> <li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/users"> <a href="{{@app.context}}/users">
USERS USERS
</a> </a>
@ -34,6 +35,7 @@
{{#zone "navbarActions"}} {{#zone "navbarActions"}}
<li> <li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/user/add"> <a href="{{@app.context}}/user/add">
<span class="icon fw-stack"> <span class="icon fw-stack">
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
@ -64,84 +66,25 @@
<input type="hidden" id="can-reset-password" value="true"/> <input type="hidden" id="can-reset-password" value="true"/>
{{/if}} {{/if}}
<i class="fw fw-settings fw-spin fw-2x"></i> <i class="fw fw-settings fw-spin fw-2x"></i>
Loading users . . . Loading users . . .
<br> <br>
</div> </div>
<div id="user-listing-status" class="raw hidden">
<ul style="list-style-type: none;">
<li class="message message-info">
<h4>
<i class="icon fw fw-info"></i>
<a id="user-listing-status-msg"></a>
</h4>
</li>
</ul>
</div>
<div id="user-table" data-user={{adminUser}}> <div id="user-table" data-user={{adminUser}}>
<!--<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view"-->
<!--id="user-grid">-->
<!--<thead>-->
<!--<tr class="sort-row">-->
<!--<th class="no-sort"></th>-->
<!--<th class="no-sort"></th>-->
<!--<th>By Username</th>-->
<!--<th class="no-sort"></th>-->
<!--<th class="no-sort"></th>-->
<!--</tr>-->
<!--<tr class="filter-row filter-box">-->
<!--<th colspan="4">-->
<!--<label class="wr-input-label" for="search-by-username">-->
<!--By Username-->
<!--</label>-->
<!--<input id="search-by-username" type="text" class="form-control"-->
<!--placeholder="Search By Username">-->
<!--</th>-->
<!--<th style="vertical-align:bottom;">-->
<!--<button id="search-btn" class="wr-btn">-->
<!--Search-->
<!--</button>-->
<!--</th>-->
<!--</tr>-->
<!--<tr class="bulk-action-row" id="invite-user-button">-->
<!--<th colspan="5">-->
<!--<ul class="tiles">-->
<!--<li class="square">-->
<!--<a href="#" data-click-event="remove-form" class="btn square-element invite-user-link"-->
<!--data-toggle="modal" data-target="#modalDemo">-->
<!--<span class="icon fw-stack">-->
<!--<i class="fw fw-ring fw-stack-2x"></i>-->
<!--<i class="fw fw-invitation fw-stack-1x"></i>-->
<!--</span>-->
<!--Invite Selected-->
<!--</a>-->
<!--</li>-->
<!--</ul>-->
<!--</th>-->
<!--</tr>-->
<!--</thead>-->
<!--<tbody id="ast-container">-->
<!--<br class="c-both"/>-->
<!--</tbody>-->
<!--</table>-->
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view" id="user-grid"> <table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view" id="user-grid">
<thead> <thead>
<tr class="sort-row"> <tr class="sort-row">
<th>By Username</th> <th>By Username</th>
</tr> </tr>
<tr class="bulk-action-row"> <tr class="bulk-action-row">
<th colspan="5"> <th colspan="3">
<ul class="tiles"> <ul class="tiles">
<li class="square"> <li class="square">
<a href="#" data-click-event="remove-form" class="btn square-element invite-user-link" <a id="invite-user-link" href="#" data-click-event="remove-form" class="btn square-element"
data-toggle="modal" data-target="#modalDemo"> data-toggle="modal" data-target="#modalDemo">
<span class="icon fw-stack"> <span class="icon fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-invitation fw-stack-2x"></i>
<i class="fw fw-invitation fw-stack-1x"></i> </span>
</span>
Invite Selected Invite Selected
</a> </a>
</li> </li>
@ -149,13 +92,10 @@
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody id="ast-container"> <tbody id="ast-container"></tbody>
<br class="c-both" />
</tbody>
</table> </table>
</div> </div>
<br class="c-both"/>
<div id="content-filter-types" style="display: none"> <div id="content-filter-types" style="display: none">
<div class="sort-title">Sort By</div> <div class="sort-title">Sort By</div>
<div class="sort-options"> <div class="sort-options">
@ -164,23 +104,19 @@
</div> </div>
<div id="invite-user-modal-content" class="hide"> <div id="invite-user-modal-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="col-lg-5 col-md-6 col-centered"> </div>
<h3> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
An invitation mail will be sent to the selected user(s) to initiate an enrolment process. <h4>
Do you wish to continue ? An invitation mail will be sent to the selected user(s) to initiate an enrolment process.
</h3> Do you wish to continue ?
<div class="buttons"> </h4>
<a href="#" id="invite-user-yes-link" class="btn-operations"> </div>
yes <div class="modal-footer">
</a> <div class="buttons">
<a href="#" id="invite-user-yes-link" class="btn-operations">yes</a>
<a href="#" id="invite-user-cancel-link" class="btn-operations"> <a href="#" id="invite-user-cancel-link" class="btn-operations">No</a>
No
</a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -201,165 +137,178 @@
</div> </div>
<div id="invite-user-error-content" class="hide"> <div id="invite-user-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>An unexpected error occurred. Try again later.</h3> <i class="fw fw-ring fw-stack-2x"></i>
<div class="buttons"> <i class="fw fw-error fw-stack-1x"></i>
<a href="#" id="invite-user-error-link" class="btn-operations"> </span>
Ok Unexpected Error
</a> </h3>
</div> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
An unexpected error occurred. Try again later.
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="invite-user-error-link" class="btn-operations">Ok</a>
</div> </div>
</div> </div>
</div> </div>
<div id="remove-user-modal-content" class="hide"> <div id="remove-user-modal-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Remove User
<h3>Do you really want to remove this user ?</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="remove-user-yes-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Remove <h4>
</a> Do you really want to remove this user ?
<a href="#" id="remove-user-cancel-link" class="btn-operations"> </h4>
Cancel </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="remove-user-yes-link" class="btn-operations">Remove</a>
<a href="#" id="remove-user-cancel-link" class="btn-operations">Cancel</a>
</div> </div>
</div> </div>
</div> </div>
<div id="remove-user-success-content" class="hide"> <div id="remove-user-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> User Removed.
<h3>Done. User was successfully removed.</h3> </h3>
<div class="buttons"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<a href="#" id="remove-user-success-link" class="btn-operations"> </div>
Ok <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</a> <h4>
</div> Done. User was successfully removed.
</div> </h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-user-success-link" class="btn-operations">Ok</a>
</div> </div>
</div> </div>
</div> </div>
<div id="remove-user-error-content" class="hide"> <div id="remove-user-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>An unexpected error occurred. Please try again later.</h3> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
<div class="buttons"> </span>
<a href="#" id="remove-user-error-link" class="btn-operations"> Unexpected Error
Ok </h3>
</a> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div> </div>
</div> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
An unexpected error occurred. Please try again later.
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-user-error-link" class="btn-operations">Ok</a>
</div> </div>
</div> </div>
</div> </div>
<div id="errorUsers" class="hide"> <div id="errorUsers" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i> <i class="fw fw-error fw-stack-1x"></i>
</span> </span>
Operation cannot be performed ! Operation cannot be performed !
</h3> </h3>
<h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
Please select a user or a list of users to send invitation emails. </div>
</h4> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> <h4>
<a href="javascript:hidePopup()" class="btn-operations"> Please select a user or a list of users to send invitation emails.
Ok </h4>
</a> </div>
</div> <div class="modal-footer">
</div> <div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">Ok</a>
</div> </div>
</div> </div>
</div> </div>
<div id="errorUserView" class="hide"> <div id="errorUserView" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Unauthorized action!
<h3> </h3>
<span class="fw-stack"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Unauthorized action!
</h3>
</div>
</div>
</div> </div>
</div> </div>
<div id="reset-password-window" class="hide"> <div id="reset-password-window" class="hide">
<input type="hidden" id="user" value="{{user.username}}"> <input type="hidden" id="user" value="{{user.username}}">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3> <i class="fw fw-ring fw-stack-2x"></i>
<span class="fw-stack"> <i class="fw fw-key fw-stack-1x"></i>
<i class="fw fw-ring fw-stack-2x"></i> </span>
<i class="fw fw-key fw-stack-1x"></i> Reset Password
</span> </h3>
Reset Password <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<br> </div>
</h3> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert"> <div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span> <i class="icon fw fw-error"></i><span></span>
</div> </div>
<h4> <h4>
Enter new password Enter new password
<br><br> <br><br>
<div> <div>
<input type="password" class="form-control modal-input operationDataKeys" id="new-password" data-key="message"/> <input type="password" class="form-control modal-input operationDataKeys" id="new-password" data-key="message"/>
</div> </div>
<br> <br>
Retype new password Retype new password
<br><br> <br><br>
<div> <div>
<input type="password" class="form-control modal-input operationDataKeys" id="confirmed-password" data-key="message"/> <input type="password" class="form-control modal-input operationDataKeys" id="confirmed-password" data-key="message"/>
</div>
<br>
</h4>
<div class="buttons">
<a href="#" id="reset-password-yes-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp;
</a>
&nbsp;&nbsp;
<a href="#" id="reset-password-cancel-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div> </div>
<br>
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="reset-password-yes-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp;
</a>
&nbsp;&nbsp;
<a href="#" id="reset-password-cancel-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="reset-password-success-content" class="hide"> <div id="reset-password-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Password reset is successful.
<h3>Password reset is successful.</h3> </h3>
<div class="buttons"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<a href="#" id="reset-password-success-link" class="btn-operations"> </div>
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp; <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="#" id="reset-password-success-link" class="btn-operations">
</div> &nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div> </div>
</div> </div>
</div> </div>
@ -369,6 +318,7 @@
<!--Later add the navigation menu from here--> <!--Later add the navigation menu from here-->
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget -->
<script id="user-listing" data-current-user="{{currentUser.username}}" <script id="user-listing" data-current-user="{{currentUser.username}}"
src="{{@page.publicUri}}/templates/listing.hbs" type="text/x-handlebars-template"></script> src="{{@page.publicUri}}/templates/listing.hbs" type="text/x-handlebars-template"></script>
{{js "js/listing.js"}} {{js "js/listing.js"}}

@ -115,8 +115,8 @@ var operationModule = function () {
var featureMap = { var featureMap = {
"DEVICE_LOCK": "lock", "DEVICE_LOCK": "lock",
"VPN": "vpn", "VPN": "vpn",
"PER_APP_VPN": "perappvpn", "PER_APP_VPN": "per-app-vpn",
"APP_TO_PER_APP_VPN_MAPPING": "apptoperappvpnmapping", "APP_TO_PER_APP_VPN_MAPPING": "app-to-per-app-vpn-mapping",
"RING": "ring", "RING": "ring",
"LOCATION": "location", "LOCATION": "location",
"NOTIFICATION": "notification", "NOTIFICATION": "notification",
@ -124,12 +124,12 @@ var operationModule = function () {
"RESTRICTION": "restriction", "RESTRICTION": "restriction",
"CELLULAR": "cellular", "CELLULAR": "cellular",
"WIFI": "wifi", "WIFI": "wifi",
"INSTALL_STORE_APPLICATION": "storeapplication", "INSTALL_STORE_APPLICATION": "store-application",
"INSTALL_ENTERPRISE_APPLICATION": "enterpriseapplication", "INSTALL_ENTERPRISE_APPLICATION": "enterprise-application",
"REMOVE_APPLICATION": "removeapplication", "REMOVE_APPLICATION": "remove-application",
"ENTERPRISE_WIPE": "enterprisewipe" "ENTERPRISE_WIPE": "enterprise-wipe"
}; };
return "/ios/operation/" + featureMap[operationCode]; return "/api/device-mgt/ios/v1.0/admin/devices/" + featureMap[operationCode];
}; };
/** /**

@ -18,9 +18,9 @@
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/jquery.qrcode.min.js"}} {{js "js/jquery.qrcode.min.js"}}
<script type="text/javascript"> <script type="text/javascript">
var modalPopup = '.wr-modalpopup', var modalPopup = '.modal',
modalPopupContainer = modalPopup + ' .modalpopup-container', modalPopupContainer = modalPopup + ' .modal-content',
modalPopupContent = modalPopup + ' .modalpopup-content'; modalPopupContent = modalPopup + ' .modal-content';
function openCollapsedNav(){ function openCollapsedNav(){
$(".wr-hidden-nav-toggle-btn").addClass("active"); $(".wr-hidden-nav-toggle-btn").addClass("active");
$("#hiddenNav").slideToggle("slideDown", function () { $("#hiddenNav").slideToggle("slideDown", function () {
@ -44,8 +44,8 @@
* show popup function. * show popup function.
*/ */
function showQRCodePopup() { function showQRCodePopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); //setPopupMaxHeight();
} }
/* /*
@ -54,7 +54,9 @@
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(""); $(modalPopupContent).html("");
$(modalPopupContent).removeClass("operation-data"); $(modalPopupContent).removeClass("operation-data");
$(modalPopup).hide(); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
} }
function generateQRCode(qrCodeClass){ function generateQRCode(qrCodeClass){
@ -68,8 +70,8 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function toggleEnrollment(){ function toggleEnrollment(){
$(".modalpopup-content").html($("#qr-code-modal").html()); $(".modal-content").html($("#qr-code-modal").html());
generateQRCode(".modalpopup-content .qr-code"); generateQRCode(".modal-content .qr-code");
showQRCodePopup(); showQRCodePopup();
} }
</script> </script>

@ -30,9 +30,9 @@ if (saveNewPrioritiesButtonEnabled) {
* Modal related stuff are as follows. * Modal related stuff are as follows.
*/ */
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modalpopup-container"; var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-content";
var body = "body"; var body = "body";
/* /*
@ -50,8 +50,8 @@ function setPopupMaxHeight() {
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); //setPopupMaxHeight();
} }
/* /*
@ -59,7 +59,9 @@ function showPopup() {
*/ */
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
} }
$(document).ready(function () { $(document).ready(function () {

@ -1,116 +0,0 @@
{{!
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.
}}
<!-- content/body -->
<div class="row">
<div class="col-md-12">
<!-- content -->
<div id="role-create-form" class="container col-centered wr-content">
<div class="wr-form">
<p class="page-sub-title">Add Role</p>
<hr />
<div class="row">
<div class="col-lg-8">
<div class="wr-steps">
<div class="col-md-6 col-xs-6">
<div class="itm-wiz itm-wiz-current" data-step="policy-platform">
<div class="wiz-no">1</div>
<div class="wiz-lbl hidden-xs"><span>Add a role</span></div>
</div>
<br class="c-both" />
</div>
<div class="col-md-6 col-xs-6">
<div class="itm-wiz" data-step="policy-profile">
<div class="wiz-no">2</div>
<div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div>
</div>
<br class="c-both" />
</div>
</div>
<br /><br />
<hr />
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<label class="wr-input-label">User Store Domain</label>
<div class="wr-input-control">
<select id="domain" class="form-control select">
<option>PRIMARY</option>
{{#each userStores}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
<label class="wr-input-label">
Role Name *
</label>
<br>
<label class="wr-input-label">
( {{roleNameHelpText}} )
</label>
<div id="roleNameField" class="form-group wr-input-control">
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}"
data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control" />
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in
minimum 3 characters long and do not
include any whitespaces. </label>
</div>
<label class="wr-input-label">
User list
</label>
<div class="wr-input-control">
<select id="users" class="form-control select2" multiple="multiple">
</select>
</div>
</div>
</div>
<br>
<button id="add-role-btn" class="wr-btn">Add Role</button>
</div>
</div>
<div id="role-created-msg" class="container col-centered wr-content hidden">
<div class="wr-form">
<p class="page-sub-title">Role was added successfully.</p>
<br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click
<b>"View Role List"</b> to complete the process and go back to the role list.
<hr />
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
View Role List
</button>
<a href="{{@app.context}}/roles/add-role" class="cu-btn-inner">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add Another Role
</a>
</div>
</div>
<!-- /content -->
<div id="app-context" data-app-context="{{@app.context}}" class="hidden"></div>
</div>
</div>
<!-- /content/body -->
{{#zone "bottomJs"}}
{{js "js/bottomJs.js"}}
{{/zone}}

@ -28,8 +28,8 @@
* Tree view function * Tree view function
* @return {Null} * @return {Null}
*/ */
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-content";
var apiBasePath = "/api/device-mgt/v1.0"; var apiBasePath = "/api/device-mgt/v1.0";
@ -38,15 +38,17 @@ var apiBasePath = "/api/device-mgt/v1.0";
*/ */
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
} }
/* /*
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); //setPopupMaxHeight();
} }
$.fn.tree_view = function(){ $.fn.tree_view = function(){
var tree = $(this); var tree = $(this);

@ -31,11 +31,8 @@
</div> </div>
<label class="wr-input-label">Domain</label> <label class="wr-input-label">Domain</label>
<div class="wr-input-control"> <div class="wr-input-control">
<select id="domain" class="form-control select"> <select id="domain" class="form-control select" disabled>
<option>PRIMARY</option> <option>{{userStore}}</option>
{{#each userStores}}
<option>{{this}}</option>
{{/each}}
</select> </select>
</div> </div>
<label class="wr-input-label"> <label class="wr-input-label">
@ -52,8 +49,8 @@
value="{{role.roleName}}" /> value="{{role.roleName}}" />
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span> <span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in <label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in
minimum 3 characters long and do not minimum 3 characters long and do not
include any whitespaces. </label> include any whitespaces. </label>
</div> </div>
</div> </div>
</div> </div>

@ -25,23 +25,31 @@
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var uri = request.getRequestURI(); var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri)); var uriMatcher = new URIMatcher(String(uri));
var isMatched = uriMatcher.match("/{context}/role/edit/{rolename}"); var isMatched = uriMatcher.match("/{context}/role/edit/{roleName}");
if (isMatched) { if (isMatched) {
var matchedElements = uriMatcher.elements(); var matchedElements = uriMatcher.elements();
var roleName = matchedElements.rolename; var roleName = matchedElements["roleName"];
var response = userModule.getRole(roleName); var response = userModule.getRole(roleName);
if (response["status"] == "success") { if (response["status"] == "success") {
context["role"] = response["content"]; context["role"] = response["content"];
} }
var userStores = userModule.getSecondaryUserStores(); var userStore;
context["userStores"] = userStores; if (roleName.indexOf("/") > -1) {
userStore = roleName.substring(0, roleName.indexOf("/"));
} else {
userStore = "PRIMARY";
}
context["userStore"] = userStore;
context["roleNameJSRegEx"] = deviceMgtProps["roleValidationConfig"]["roleNameJSRegEx"];
context["roleNameHelpText"] = deviceMgtProps["roleValidationConfig"]["roleNameHelpMsg"];
context["roleNameRegExViolationErrorMsg"] = deviceMgtProps["roleValidationConfig"]["roleNameRegExViolationErrorMsg"];
return context;
} else {
//TODO: handle error scenario
return context;
} }
//TODO: error scenario
context["roleNameJSRegEx"] = deviceMgtProps.roleValidationConfig.rolenameJSRegEx;
context["roleNameHelpText"] = deviceMgtProps.roleValidationConfig.rolenameHelpMsg;
context["roleNameRegExViolationErrorMsg"] = deviceMgtProps.roleValidationConfig.rolenameRegExViolationErrorMsg;
return context;
} }

@ -1,129 +0,0 @@
{{!
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.
}}
<div id="loading-content" class="col-centered">
{{#if removePermitted}}
<input type="hidden" id="can-remove" value="true" />
{{/if}}
{{#if editPermitted}}
<input type="hidden" id="can-edit" value="true" />
{{/if}}
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading roles . . .
<br>
</div>
<div id="role-listing-status" class="raw">
<ul style="list-style-type: none;">
<li class="message message-info">
<h4>
<i class="icon fw fw-info"></i>
<a id="role-listing-status-msg"></a>
</h4>
</li>
</ul>
</div>
<div id="role-table" data-role={{adminRole}}>
<table class="table table-striped table-hover list-table display responsive nowrap data-table row-view"
id="role-grid">
<thead>
<tr class="sort-row">
<th class="no-sort"></th>
<th>By Role Name</th>
<th class="no-sort"></th>
</tr>
<tr class="bulk-action-row">
<th colspan="3"></th>
</tr>
</thead>
<tbody id="ast-container" data-app-context="{{appContext}}">
<br class="c-both" />
</tbody>
</table>
</div>
<br class="c-both" />
<div id="content-filter-types" style="display: none">
<div class="sort-title">Sort By</div>
<div class="sort-options">
<th>By Role name</th>
</div>
</div>
<div id="remove-role-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Do you really want to remove this role ?</h3>
<div class="buttons">
<a href="#" id="remove-role-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-role-cancel-link" class="btn-operations">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-role-success-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Done. Role was successfully removed.</h3>
<div class="buttons">
<a href="#" id="remove-role-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-role-error-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>An unexpected error occurred. Please try again later.</h3>
<div class="buttons">
<a href="#" id="remove-role-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
{{#zone "common-navigation"}}
<!--Later add the navigation menu from here-->
{{/zone}}
{{#zone "bottomJs"}}
<script id="role-listing" data-current-user="{{currentUser.username}}"
src="{{@unit.publicUri}}/templates/role-listing.hbs" type="text/x-handlebars-template"></script>
{{js "js/role-listing.js"}}
<script type="text/javascript">
var clientJsAppContext = "{{{@app.context}}}";
</script>
{{/zone}}

@ -1,226 +0,0 @@
/*
* 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.
*/
var loadRoleBasedActionURL = function (action, rolename) {
var href = $("#ast-container").data("app-context") + "role/" + action + "/" + rolename;
$(location).attr('href', href);
};
var apiBasePath = "/api/device-mgt/v1.0";
/**
* Following function would execute
* when a user clicks on the list item
* initial mode and with out select mode.
*/
function InitiateViewOption() {
$(location).attr('href', $(this).data("url"));
}
/**
* Sorting function of roles
* listed on Role Management page in WSO2 Devicemgt Console.
*/
var loadPaginatedObjects = function (objectGridId, objectGridContainer, objectGridTemplateSrc, serviceURL, callback) {
var templateSrc = $(objectGridTemplateSrc).attr("src");
$.template(objectGridId, templateSrc, function (template) {
invokerUtil.get(serviceURL,
function (data) {
data = callback(data);
if (data.length > 0 && data != null) {
$('#ast-container').removeClass('hidden');
$('#role-listing-status').hide();
for (var i = 0; i < data.viewModel.roles.length; i++) {
data.viewModel.roles[i].adminRole = $("#role-table").data("role");
}
var content = template(data.viewModel);
$(objectGridContainer).html(content);
if (isInit) {
$('#role-grid').datatables_extended_serverside_paging();
isInit = false;
}
$("#dt-select-all").addClass("hidden");
$(".icon .text").res_text(0.2);
} else {
$('#ast-container').addClass('hidden');
$('#role-listing-status-msg').text('No roles are available to be displayed.');
$('#role-listing-status').show();
}
//$(objectGridId).datatables_extended();
}, function (message) {
$('#ast-container').addClass('hidden');
$('#role-listing-status-msg').text('Invalid search query. Try again with a valid search ' +
'query');
$('#role-listing-status').show();
});
});
};
function loadRoles(searchQuery) {
var loadingContent = $("#loading-content");
loadingContent.show();
var dataFilter = function(data){
data = JSON.parse(data);
var objects = [];
$(data.roles).each(function( index ) {
objects.push({name: data.roles[index], DT_RowId : "role-" + data.roles[index]})
});
json = {
"recordsTotal": data.count,
"recordsFiltered": data.count,
"data": objects
};
return JSON.stringify( json );
}
var fnCreatedRow = function( nRow, aData, iDataIndex ) {
$(nRow).attr('data-type', 'selectable');
}
var columns = [
{
class: "remove-padding icon-only content-fill",
data: null,
defaultContent: '<div class="thumbnail icon"> <i class="square-element text fw fw-user" style="font-size: 30px;"></i></div>'
},
{
class: "fade-edge remove-padding-top",
data: "name",
defaultContent: ''
},
{
class: "text-right content-fill text-left-on-grid-view no-wrap",
data: null,
render: function ( data, type, row, meta ) {
return '<a onclick="javascript:loadRoleBasedActionURL(\'edit\', \'' + data.name + '\')" data-role="' + data.name +
'" data-click-event="edit-form" class="btn padding-reduce-on-grid-view edit-role-link"><span class="fw-stack fw-lg">' +
'<i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-user fw-stack-1x"></i>' +
'<span class="fw-stack fw-move-right fw-move-bottom"><i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i>' +
'<i class="fw fw-circle fw-stack-2x"></i><i class="fw fw-edit fw-stack-1x fw-inverse"></i></span></span>' +
'<span class="hidden-xs hidden-on-grid-view">Edit</span></a>' +
'<a onclick="javascript:loadRoleBasedActionURL(\'edit-permission\', \'' + data.name +
'\')" data-role="' + data.name + '" data-click-event="edit-form" class="btn padding-reduce-on-grid-view edit-permission-link">' +
'<span class="fw-stack fw-lg"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-security-policy fw-stack-1x"></i>' +
'<span class="fw-stack fw-move-right fw-move-bottom"><i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i>' +
'<i class="fw fw-circle fw-stack-2x"></i><i class="fw fw-edit fw-stack-1x fw-inverse"></i></span></span>' +
'<span class="hidden-xs hidden-on-grid-view">Edit Permission</span></a>' +
'<a data-role="' + data.name + '" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-role-link">' +
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i></span>' +
'<span class="hidden-xs hidden-on-grid-view">Remove</span></a>'
}
}
];
var options = {
"placeholder": "Search By Role Name",
"searchKey" : "filter"
};
$('#role-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/roles', dataFilter, columns, fnCreatedRow, null, options);
loadingContent.hide();
}
var modalPopup = ".wr-modalpopup";
var modalPopupContainer = modalPopup + " .modalpopup-container";
var modalPopupContent = modalPopup + " .modalpopup-content";
var body = "body";
var isInit = true;
/*
* set popup maximum height function.
*/
function setPopupMaxHeight() {
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));
$(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2)));
}
/*
* show popup function.
*/
function showPopup() {
$(modalPopup).show();
setPopupMaxHeight();
}
/*
* hide popup function.
*/
function hidePopup() {
$(modalPopupContent).html('');
$(modalPopup).hide();
}
/**
* Following click function would execute
* when a user clicks on "Remove" link
* on Role Listing page in WSO2 Devicemgt Console.
*/
$("#role-grid").on("click", ".remove-role-link", function () {
var role = $(this).data("role");
var removeRoleAPI = apiBasePath + "/roles/" + role;
$(modalPopupContent).html($('#remove-role-modal-content').html());
showPopup();
$("a#remove-role-yes-link").click(function () {
invokerUtil.delete(
removeRoleAPI,
function () {
$("#role-" + role).remove();
$(modalPopupContent).html($('#remove-role-success-content').html());
$("a#remove-role-success-link").click(function () {
hidePopup();
});
},
function () {
$(modalPopupContent).html($('#remove-role-error-content').html());
$("a#remove-role-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#remove-role-cancel-link").click(function () {
hidePopup();
});
});
$("#search-btn").click(function () {
var searchQuery = $("#search-by-name").val();
if (searchQuery.trim() != "") {
loadRoles(searchQuery);
} else {
loadRoles();
}
});
$(document).ready(function () {
$('#role-listing-status').hide();
loadRoles();
isInit = true;
});

@ -11,9 +11,9 @@ function inputIsValid(regExp, inputString) {
} }
$(document).ready(function () { $(document).ready(function () {
var modalPopup = ".wr-modalpopup"; var modalPopup = ".modal";
// var modalPopupContainer = modalPopup + " .modalpopup-container"; // var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modalpopup-content"; var modalPopupContent = modalPopup + " .modal-body";
$("#change-password").click(function () { $("#change-password").click(function () {

@ -25,47 +25,48 @@
<div id="change-password-window" class="hide"> <div id="change-password-window" class="hide">
<input type="hidden" id="user" value="{{username}}"> <input type="hidden" id="user" value="{{username}}">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h4> <i class="fw fw-ring fw-stack-2x"></i>
<span class="fw-stack"> <i class="fw fw-key fw-stack-1x"></i>
<i class="fw fw-ring fw-stack-2x"></i> </span>
<i class="fw fw-key fw-stack-1x"></i> Change Password
</span> </h3>
Change Password <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<br><br> </div>
</h4> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert"> <div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span> <i class="icon fw fw-error"></i><span></span>
</div> </div>
<h3> <h3>
Enter old password * Enter old password *
<br><br> <br><br>
<div> <div>
<input type="password" class="form-control modal-input operationDataKeys" id="old-password" data-key="message"/> <input type="password" class="form-control modal-input operationDataKeys" id="old-password" data-key="message"/>
</div> </div>
<br> <br>
Enter new password * Enter new password *
<br><br> <br><br>
<div> <div>
<input type="password" class="form-control modal-input operationDataKeys" id="new-password" data-key="message"/> <input type="password" class="form-control modal-input operationDataKeys" id="new-password" data-key="message"/>
</div>
<br>
Retype new password *
<br><br>
<div>
<input type="password" class="form-control modal-input operationDataKeys" id="confirmed-password" data-key="message"/>
</div>
<br>
</h3>
<div class="buttons">
<a href="#" id="change-password-yes-link" class="btn-operations">Update</a>
<a href="#" id="change-password-cancel-link" class="btn-operations">Cancel</a>
</div>
</div> </div>
<br>
Retype new password *
<br><br>
<div>
<input type="password" class="form-control modal-input operationDataKeys" id="confirmed-password" data-key="message"/>
</div>
<br>
</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-password-yes-link" class="btn-operations">Update</a>
<a href="#" id="change-password-cancel-link" class="btn-operations">Cancel</a>
</div> </div>
</div> </div>
</div> </div>
<div id="change-password-success-content" class="hide"> <div id="change-password-success-content" class="hide">

@ -2642,64 +2642,7 @@ ul.tiles .icon {
/* ======================================================================== /* ========================================================================
* modal popup styles * modal popup styles
* ======================================================================== */ * ======================================================================== */
.modal-open {
padding: 0 !important;
}
.modal {
z-index: 100000001;
padding: 0 !important;
}
.modal-backdrop {
z-index: 100000000;
}
.modal-content {
background: #222;
color: #ffffff;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.modal-header {
border-bottom: none;
padding: 15px 15px 0;
}
.modal-header .close {
color: #ffffff;
text-shadow: none;
opacity: 0.8;
}
.modal-body {
padding: 0 15px;
}
.modal-dialog {
margin: 80px auto;
}
.modal-footer {
border-top: none;
}
@media only screen and (max-width: 768px) {
.modal {
padding: 0 15px !important;
}
}
@media only screen and (min-width: 1280px) {
.modal-dialog {
width: 1000px;
}
}
/* ======================================================================== /* ========================================================================
* list group styles * list group styles
@ -4018,72 +3961,6 @@ a.btn-operations {
} }
/* modal pop-up styles */ /* modal pop-up styles */
.wr-modalpopup {
display: none;
}
.wr-modalpopup .modalpopup-container {
display: block;
min-height: 100px;
width: 100%;
position: fixed;
background: #11375B;
color: #fff;
z-index: 1000001;
align-content: center;
top: 50%;
}
.modalpopup-content {
position: relative;
overflow-x: hidden;
overflow-y: auto;
padding: 50px 60px 60px 60px;
}
.modalpopup-content h3 {
font-weight: 300;
}
.modalpopup-content h3 .fw-stack {
margin-right: 15px;
}
.wr-modalpopup .modalpopup-close-btn {
color: #fff;
z-index: 1000002;
cursor: pointer;
position: absolute;
top: 20px;
left: 20px;
padding: 5px 8px;
font-size: 18px;
}
.wr-modalpopup .modalpopup-close-btn:hover {
}
.wr-modalpopup .modalpopup-content .buttons {
margin-top: 30px;
}
.wr-modalpopup .modalpopup-content .buttons .btn-operations {
background: #fff;
color: #333;
text-transform: uppercase;
font-weight: 500;
}
.wr-modalpopup .modalpopup-bg {
position: fixed;
z-index: 1000000;
width: 100%;
height: 100%;
background: #000000;
opacity: 0.9;
display: block;
}
/* notification panel styles */ /* notification panel styles */
.wr-notification-bar, .wr-side-panel { .wr-notification-bar, .wr-side-panel {
@ -6750,32 +6627,7 @@ ul.tiles .icon {
/* ======================================================================== /* ========================================================================
* modal popup styles * modal popup styles
* ======================================================================== */ * ======================================================================== */
.modal-open {
padding: 0 !important;
}
.modal {
z-index: 100000001;
padding: 0 !important;
}
.modal-backdrop {
z-index: 0;
}
.modal-content {
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.modal-dialog {
margin: 80px auto;
}
@media only screen and (max-width: 768px) {
.modal {
padding: 0 15px !important;
}
}
/* ======================================================================== /* ========================================================================
* asset details styles * asset details styles

@ -17,77 +17,4 @@
*/ */
/* modal pop-up styles */ /* modal pop-up styles */
.wr-modalpopup {
display: none;
}
.wr-modalpopup .modalpopup-container {
display: block;
min-height: 100px;
width: 100%;
position: fixed;
background: #11375B;
color: #fff;
z-index: 1000001;
align-content: center;
top: 50%;
left: 0%;
}
.modalpopup-content {
position: relative;
overflow-x: hidden;
overflow-y: auto;
padding: 50px;
}
.center-container {
left: 25%;
right: 25%;
}
.modal-content {
display: block;
/*padding: 2em 1.4em;*/
min-height: 110px;
background: none;
border: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.modalpopup-content h3 {
font-weight: 300;
font-size: 15px;
}
.modalpopup-content h3 .fw-stack {
margin-right: 15px;
}
.wr-modalpopup .modalpopup-close-btn {
color: #fff;
z-index: 1000002;
cursor: pointer;
position: absolute;
top: 30px;
left: 40px;
padding: 5px 8px;
font-size: 18px;
}
.wr-modalpopup .modalpopup-close-btn:hover {
}
.wr-modalpopup .modalpopup-bg {
position: fixed;
z-index: 1000000;
width: 100%;
height: 100%;
background: #000000;
opacity: 0.8;
display: block;
left: 0;
top: 0;
}

@ -16,7 +16,7 @@
under the License. under the License.
}} }}
{{#zone "topCss"}} {{#zone "topCss"}}
{{~css "css/validation-style.css"}} {{~css "css/validation-style.css" combine=false}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -4945,7 +4945,7 @@ button.list-group-item-danger.active:focus {
.panel { .panel {
margin-bottom: 20px; margin-bottom: 20px;
background-color: #fff; background-color: none;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 0; border-radius: 0;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
@ -5398,6 +5398,9 @@ button.close {
-moz-border-radius: 0; -moz-border-radius: 0;
border-radius: 0; border-radius: 0;
} }
.panel-body .message {
margin:0px;
}
.message h4 { .message h4 {
margin-top: 0; margin-top: 0;
margin-bottom: 5px; margin-bottom: 5px;
@ -7438,17 +7441,13 @@ ul.sidebar-messages > li {
* ======================================================================== */ * ======================================================================== */
.body-wrapper { .body-wrapper {
padding: 40px; padding: 40px;
margin-bottom:40px;
} }
.body-wrapper a.btn:hover,.body-wrapper a:hover { .body-wrapper a.btn:hover,.body-wrapper a:hover {
text-decoration: none; text-decoration: none;
} }
@media (max-width: 767px) {
.body-wrapper {
padding: 40px 0px;
}
}
.page-header { .page-header {
margin: 0 0 20px; margin: 0 0 20px;
} }
@ -7791,9 +7790,16 @@ ul.sidebar-messages > li {
background: transparent; background: transparent;
font-size: 24px; font-size: 24px;
font-weight: 300; font-weight: 300;
border-bottom: 1px solid #e4e4e4; }
padding-bottom: 10px;
margin-bottom: 20px; .panel-default > .panel-heading a[data-toggle="collapse"]{
display:block;
padding:10px;
}
.media.tab-responsive .panel-group .panel-heading + .panel-collapse > .panel-body,
.media.tab-responsive .panel-group .panel-heading + .panel-collapse > .list-group{
border:none;
border-top:1px solid #ddd;
} }
/* ======================================================================== /* ========================================================================
@ -8321,7 +8327,6 @@ a.list-group-item:hover {
border-style: solid; border-style: solid;
border-color: #ddd; border-color: #ddd;
padding: 20px; padding: 20px;
min-height: 300px;
} }

@ -26,7 +26,7 @@
{{~css "lib/font-wso2_1.2/css/font-wso2.css" combine=false}} {{~css "lib/font-wso2_1.2/css/font-wso2.css" combine=false}}
<!-- Theme LESS --> <!-- Theme LESS -->
{{~css "less/theme.less" combine=false}} {{~css "less/theme.less" combine=false}}
{{~css "css/theme-wso2.css"}} {{~css "css/theme-wso2.css" combine=false}}
{{/zone}} {{/zone}}
{{~#zone "topJs"}} {{~#zone "topJs"}}

@ -145,10 +145,6 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_POLICY ( CREATE TABLE IF NOT EXISTS DM_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT , ID INT(11) NOT NULL AUTO_INCREMENT ,
NAME VARCHAR(45) DEFAULT NULL , NAME VARCHAR(45) DEFAULT NULL ,
@ -168,9 +164,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY ( CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT , ID INT(11) NOT NULL AUTO_INCREMENT ,
DEVICE_ID INT(11) NOT NULL , DEVICE_ID INT(11) NOT NULL ,
@ -190,9 +183,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY ( CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ID INT(11) NOT NULL , ID INT(11) NOT NULL ,
DEVICE_TYPE VARCHAR(300) NOT NULL , DEVICE_TYPE VARCHAR(300) NOT NULL ,
@ -210,10 +200,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES ( CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
ID INT(11) NOT NULL AUTO_INCREMENT, ID INT(11) NOT NULL AUTO_INCREMENT,
PROFILE_ID INT(11) NOT NULL, PROFILE_ID INT(11) NOT NULL,
@ -229,9 +215,6 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY ( CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT , ID INT(11) NOT NULL AUTO_INCREMENT ,
ROLE_NAME VARCHAR(45) NOT NULL , ROLE_NAME VARCHAR(45) NOT NULL ,
@ -244,9 +227,6 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
ID INT NOT NULL AUTO_INCREMENT , ID INT NOT NULL AUTO_INCREMENT ,
POLICY_ID INT NOT NULL , POLICY_ID INT NOT NULL ,
@ -259,8 +239,7 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
ID INT NOT NULL AUTO_INCREMENT , ID INT NOT NULL AUTO_INCREMENT ,
DEVICE_ID INT NOT NULL , DEVICE_ID INT NOT NULL ,
ENROLMENT_ID INT(11) NOT NULL, ENROLMENT_ID INT(11) NOT NULL,
@ -279,8 +258,6 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_CRITERIA ( CREATE TABLE IF NOT EXISTS DM_CRITERIA (
ID INT NOT NULL AUTO_INCREMENT, ID INT NOT NULL AUTO_INCREMENT,
TENANT_ID INT NOT NULL, TENANT_ID INT NOT NULL,
@ -288,8 +265,6 @@ CREATE TABLE IF NOT EXISTS DM_CRITERIA (
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA ( CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
ID INT NOT NULL AUTO_INCREMENT, ID INT NOT NULL AUTO_INCREMENT,
CRITERIA_ID INT NOT NULL, CRITERIA_ID INT NOT NULL,
@ -335,7 +310,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT ( CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
ID INT NOT NULL AUTO_INCREMENT, ID INT NOT NULL AUTO_INCREMENT,
POLICY_ID INT NOT NULL, POLICY_ID INT NOT NULL,
@ -344,7 +318,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES ( CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
ID INT NOT NULL AUTO_INCREMENT, ID INT NOT NULL AUTO_INCREMENT,
COMPLIANCE_STATUS_ID INT NOT NULL, COMPLIANCE_STATUS_ID INT NOT NULL,
@ -359,20 +332,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
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 DEFAULT NULL,
DATE_OF_LAST_UPDATE TIMESTAMP 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
);
CREATE TABLE IF NOT EXISTS DM_APPLICATION ( CREATE TABLE IF NOT EXISTS DM_APPLICATION (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
NAME VARCHAR(150) NOT NULL, NAME VARCHAR(150) NOT NULL,
@ -420,8 +379,6 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
); );
-- NOTIFICATION TABLE END -- -- NOTIFICATION TABLE END --
DROP TABLE IF EXISTS DM_DEVICE_INFO;
CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO ( CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL, DEVICE_ID INT NULL,
@ -435,10 +392,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
DROP TABLE IF EXISTS DM_DEVICE_LOCATION;
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION ( CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL, DEVICE_ID INT NULL,
@ -459,7 +412,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ID INT NOT NULL AUTO_INCREMENT, ID INT NOT NULL AUTO_INCREMENT,
DEVICE_ID INT NOT NULL, DEVICE_ID INT NOT NULL,
@ -487,9 +439,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
-- POLICY AND DEVICE GROUP MAPPING -- -- POLICY AND DEVICE GROUP MAPPING --
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY ( CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
ID INT NOT NULL AUTO_INCREMENT, ID INT NOT NULL AUTO_INCREMENT,
DEVICE_GROUP_ID INT NOT NULL, DEVICE_GROUP_ID INT NOT NULL,
@ -507,11 +457,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION ON UPDATE NO ACTION
); );
-- END OF POLICY AND DEVICE GROUP MAPPING -- -- END OF POLICY AND DEVICE GROUP MAPPING --
-- DASHBOARD RELATED VIEWS -- -- DASHBOARD RELATED VIEWS --
CREATE VIEW POLICY_COMPLIANCE_INFO AS CREATE VIEW POLICY_COMPLIANCE_INFO AS
SELECT SELECT
DEVICE_INFO.DEVICE_ID, DEVICE_INFO.DEVICE_ID,

@ -1,356 +1,285 @@
CREATE TABLE DM_DEVICE_TYPE (
ID INTEGER IDENTITY(1,1) NOT NULL,
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
ID INT AUTO_INCREMENT NOT NULL,
NAME VARCHAR(300) DEFAULT NULL, NAME VARCHAR(300) DEFAULT NULL,
PROVIDER_TENANT_ID INTEGER DEFAULT 0, PROVIDER_TENANT_ID INTEGER NULL,
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE, SHARED_WITH_ALL_TENANTS BIT NOT NULL DEFAULT 0,
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; );
CREATE INDEX device_type_name ON DM_DEVICE_TYPE (NAME);
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME);
CREATE TABLE IF NOT EXISTS DM_DEVICE (
ID INTEGER AUTO_INCREMENT NOT NULL, CREATE TABLE DM_DEVICE (
DESCRIPTION TEXT DEFAULT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
NAME VARCHAR(100) DEFAULT NULL, DESCRIPTION VARBINARY(255) DEFAULT NULL,
DEVICE_TYPE_ID INT(11) DEFAULT NULL, NAME VARCHAR(100) DEFAULT NULL,
DEVICE_TYPE_ID INTEGER DEFAULT NULL,
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL, DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL, LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
TENANT_ID INTEGER DEFAULT 0, TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_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, 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 INDEX IDX_DM_DEVICE ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID);
CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATE TABLE DM_OPERATION (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
TYPE VARCHAR(50) NOT NULL, TYPE VARCHAR(20) NOT NULL,
CREATED_TIMESTAMP TIMESTAMP NOT NULL, CREATED_TIMESTAMP DATETIME2 NOT NULL,
RECEIVED_TIMESTAMP TIMESTAMP NULL, RECEIVED_TIMESTAMP DATETIME2 NULL,
OPERATION_CODE VARCHAR(1000) NOT NULL, OPERATION_CODE VARCHAR(50) NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; );
CREATE TABLE DM_CONFIG_OPERATION (
CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
OPERATION_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL,
OPERATION_CONFIG BLOB DEFAULT NULL, OPERATION_CONFIG VARBINARY(255) DEFAULT NULL,
PRIMARY KEY (OPERATION_ID), 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 DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION ( CREATE TABLE DM_COMMAND_OPERATION (
OPERATION_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL,
ENABLED BOOLEAN NOT NULL DEFAULT FALSE, ENABLED BIT NOT NULL DEFAULT 0,
PRIMARY KEY (OPERATION_ID), 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 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, OPERATION_ID INTEGER NOT NULL,
ENABLED INTEGER NOT NULL DEFAULT 0, ENABLED INTEGER NOT NULL DEFAULT 0,
OPERATION_DETAILS BLOB DEFAULT NULL, OPERATION_DETAILS VARBINARY(255) DEFAULT NULL,
PRIMARY KEY (OPERATION_ID), 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 DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION ( CREATE TABLE DM_PROFILE_OPERATION (
OPERATION_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL,
ENABLED INTEGER NOT NULL DEFAULT 0, ENABLED INTEGER NOT NULL DEFAULT 0,
OPERATION_DETAILS BLOB DEFAULT NULL, OPERATION_DETAILS VARBINARY(255) DEFAULT NULL,
PRIMARY KEY (OPERATION_ID), 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 DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
CREATE TABLE DM_ENROLMENT (
CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( ID INTEGER IDENTITY(1,1) NOT NULL,
ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
OWNER VARCHAR(50) NOT NULL, OWNER VARCHAR(50) NOT NULL,
OWNERSHIP VARCHAR(45) DEFAULT NULL, OWNERSHIP VARCHAR(45) DEFAULT NULL,
STATUS VARCHAR(50) NULL, STATUS VARCHAR(50) NULL,
DATE_OF_ENROLMENT TIMESTAMP NULL DEFAULT NULL, DATE_OF_ENROLMENT DATETIME2 DEFAULT NULL,
DATE_OF_LAST_UPDATE TIMESTAMP NULL DEFAULT NULL, DATE_OF_LAST_UPDATE DATETIME2 DEFAULT NULL,
TENANT_ID INT NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_DM_DEVICE_ENROLMENT FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FK_DM_DEVICE_ENROLMENT FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, 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 INDEX IDX_ENROLMENT_FK_DEVICE_ID ON DM_ENROLMENT(DEVICE_ID);
CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID ON DM_ENROLMENT(DEVICE_ID, TENANT_ID);
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( CREATE TABLE DM_ENROLMENT_OP_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
ENROLMENT_ID INTEGER NOT NULL, ENROLMENT_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL,
STATUS VARCHAR(50) NULL, STATUS VARCHAR(50) NULL,
CREATED_TIMESTAMP INT NOT NULL, CREATED_TIMESTAMP INTEGER NOT NULL,
UPDATED_TIMESTAMP INT NOT NULL, UPDATED_TIMESTAMP INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (ENROLMENT_ID) REFERENCES CONSTRAINT FK_DM_DEVICE_OPERATION_MAPPING_DEVICE FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_device_operation_mapping_operation FOREIGN KEY (OPERATION_ID) REFERENCES CONSTRAINT FK_DM_DEVICE_OPERATION_MAPPING_OPERATION FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
CREATE INDEX IDX_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMESTAMP);
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID);
CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE ( CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
ENROLMENT_ID INTEGER NOT NULL, ENROLMENT_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL,
OPERATION_RESPONSE BLOB DEFAULT NULL, OPERATION_RESPONSE VARBINARY(255) DEFAULT NULL,
RECEIVED_TIMESTAMP TIMESTAMP NULL, RECEIVED_TIMESTAMP DATETIME2 DEFAULT NULL
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES CONSTRAINT FK_DM_DEVICE_OPERATION_RESP_ENROLMENT FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_device_operation_response_operation FOREIGN KEY (OPERATION_ID) REFERENCES CONSTRAINT FK_DM_DEVICE_OPERATION_RESP_OPERATION FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
CREATE INDEX IDX_ENID_OPID ON DM_DEVICE_OPERATION_RESPONSE(OPERATION_ID, ENROLMENT_ID);
-- POLICY RELATED TABLES -- -- POLICY RELATED TABLES --
CREATE TABLE IF NOT EXISTS DM_PROFILE ( CREATE TABLE DM_PROFILE (
ID INT NOT NULL AUTO_INCREMENT , ID INTEGER IDENTITY(1,1) NOT NULL,
PROFILE_NAME VARCHAR(45) NOT NULL , PROFILE_NAME VARCHAR(45) NOT NULL ,
TENANT_ID INT NOT NULL , TENANT_ID INTEGER NOT NULL ,
DEVICE_TYPE VARCHAR(300) NOT NULL , DEVICE_TYPE_ID INTEGER NOT NULL ,
CREATED_TIME DATETIME NOT NULL , CREATED_TIME DATETIME NOT NULL ,
UPDATED_TIME DATETIME NOT NULL , UPDATED_TIME DATETIME NOT NULL ,
PRIMARY KEY (ID) , PRIMARY KEY (ID) ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE CONSTRAINT DM_PROFILE_DEVICE_TYPE FOREIGN KEY (DEVICE_TYPE_ID) REFERENCES
FOREIGN KEY (DEVICE_TYPE) DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES DM_DEVICE_TYPE (NAME) );
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;
CREATE TABLE DM_POLICY (
CREATE TABLE IF NOT EXISTS DM_POLICY ( ID INTEGER IDENTITY(1,1) NOT NULL,
ID INT(11) NOT NULL AUTO_INCREMENT ,
NAME VARCHAR(45) DEFAULT NULL , NAME VARCHAR(45) DEFAULT NULL ,
DESCRIPTION VARCHAR(1000) NULL, DESCRIPTION VARCHAR(1000) NULL,
TENANT_ID INT(11) NOT NULL , TENANT_ID INTEGER NOT NULL ,
PROFILE_ID INT(11) NOT NULL , PROFILE_ID INTEGER NOT NULL ,
OWNERSHIP_TYPE VARCHAR(45) NULL, OWNERSHIP_TYPE VARCHAR(45) NULL,
COMPLIANCE VARCHAR(100) NULL, COMPLIANCE VARCHAR(100) NULL,
PRIORITY INT NOT NULL, PRIORITY INTEGER NOT NULL,
ACTIVE INT(2) NOT NULL, ACTIVE BIT NOT NULL DEFAULT 0,
UPDATED INT(1) NULL, UPDATED BIT NULL DEFAULT 0,
PRIMARY KEY (ID) , PRIMARY KEY (ID) ,
CONSTRAINT FK_DM_PROFILE_DM_POLICY CONSTRAINT FK_DM_PROFILE_DM_POLICY FOREIGN KEY (PROFILE_ID) REFERENCES DM_PROFILE (ID)
FOREIGN KEY (PROFILE_ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES DM_PROFILE (ID ) );
ON DELETE NO ACTION
ON UPDATE NO ACTION CREATE TABLE DM_DEVICE_POLICY (
)ENGINE = InnoDB; ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL ,
ENROLMENT_ID INTEGER NOT NULL,
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY ( DEVICE VARBINARY(255) NOT NULL,
ID INT(11) NOT NULL AUTO_INCREMENT , POLICY_ID INTEGER NOT NULL ,
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) , PRIMARY KEY (ID) ,
CONSTRAINT FK_POLICY_DEVICE_POLICY CONSTRAINT FK_POLICY_DEVICE_POLICY FOREIGN KEY (POLICY_ID) REFERENCES DM_POLICY (ID)
FOREIGN KEY (POLICY_ID ) ON DELETE NO ACTION ON UPDATE NO ACTION,
REFERENCES DM_POLICY (ID ) CONSTRAINT FK_DEVICE_DEVICE_POLICY FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID)
ON DELETE NO ACTION ON DELETE NO ACTION ON UPDATE NO ACTION
ON UPDATE NO ACTION, );
CONSTRAINT FK_DEVICE_DEVICE_POLICY
FOREIGN KEY (DEVICE_ID ) CREATE TABLE DM_DEVICE_TYPE_POLICY (
REFERENCES DM_DEVICE (ID ) ID INTEGER IDENTITY(1,1) NOT NULL,
ON DELETE NO ACTION DEVICE_TYPE_ID INTEGER NOT NULL ,
ON UPDATE NO ACTION POLICY_ID INTEGER NOT NULL ,
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ID INT(11) NOT NULL ,
DEVICE_TYPE VARCHAR(300) NOT NULL ,
POLICY_ID INT(11) NOT NULL ,
PRIMARY KEY (ID) , PRIMARY KEY (ID) ,
CONSTRAINT FK_DEVICE_TYPE_POLICY CONSTRAINT FK_DEVICE_TYPE_POLICY FOREIGN KEY (POLICY_ID) REFERENCES DM_POLICY (ID)
FOREIGN KEY (POLICY_ID ) ON DELETE NO ACTION ON UPDATE NO ACTION,
REFERENCES DM_POLICY (ID ) CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE FOREIGN KEY (DEVICE_TYPE_ID) REFERENCES DM_DEVICE_TYPE (ID)
ON DELETE NO ACTION ON DELETE NO ACTION ON UPDATE NO ACTION
ON UPDATE NO ACTION, );
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE ) CREATE TABLE DM_PROFILE_FEATURES (
REFERENCES DM_DEVICE_TYPE (NAME) ID INTEGER IDENTITY(1,1) NOT NULL,
ON DELETE NO ACTION PROFILE_ID INTEGER NOT NULL,
ON UPDATE NO ACTION
)ENGINE = InnoDB;
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, FEATURE_CODE VARCHAR(100) NOT NULL,
DEVICE_TYPE VARCHAR(300) NOT NULL, DEVICE_TYPE VARCHAR(300) NOT NULL,
TENANT_ID INT(11) NOT NULL , TENANT_ID INTEGER NOT NULL ,
CONTENT BLOB NULL DEFAULT NULL, CONTENT VARBINARY(255) NULL DEFAULT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES FOREIGN KEY (PROFILE_ID) REFERENCES DM_PROFILE (ID)
FOREIGN KEY (PROFILE_ID) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES DM_PROFILE (ID) );
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;
CREATE TABLE DM_ROLE_POLICY (
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY ( ID INTEGER IDENTITY(1,1) NOT NULL,
ID INT(11) NOT NULL AUTO_INCREMENT ,
ROLE_NAME VARCHAR(45) NOT NULL , ROLE_NAME VARCHAR(45) NOT NULL ,
POLICY_ID INT(11) NOT NULL , POLICY_ID INTEGER NOT NULL ,
PRIMARY KEY (ID) , PRIMARY KEY (ID) ,
CONSTRAINT FK_ROLE_POLICY_POLICY CONSTRAINT FK_ROLE_POLICY_POLICY FOREIGN KEY (POLICY_ID) REFERENCES DM_POLICY (ID)
FOREIGN KEY (POLICY_ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES DM_POLICY (ID ) );
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( CREATE TABLE DM_USER_POLICY (
ID INT NOT NULL AUTO_INCREMENT , ID INTEGER IDENTITY(1,1) NOT NULL,
POLICY_ID INT NOT NULL , POLICY_ID INTEGER NOT NULL ,
USERNAME VARCHAR(45) NOT NULL , USERNAME VARCHAR(45) NOT NULL ,
PRIMARY KEY (ID) , PRIMARY KEY (ID) ,
CONSTRAINT DM_POLICY_USER_POLICY CONSTRAINT DM_POLICY_USER_POLICY FOREIGN KEY (POLICY_ID) REFERENCES DM_POLICY (ID)
FOREIGN KEY (POLICY_ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES DM_POLICY (ID ) );
ON DELETE NO ACTION
ON UPDATE NO ACTION CREATE TABLE DM_DEVICE_POLICY_APPLIED (
)ENGINE = InnoDB; ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL ,
ENROLMENT_ID INTEGER NOT NULL,
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED ( POLICY_ID INTEGER NOT NULL ,
ID INT NOT NULL AUTO_INCREMENT , POLICY_CONTENT VARBINARY(255) NULL ,
DEVICE_ID INT NOT NULL , TENANT_ID INTEGER NOT NULL,
ENROLMENT_ID INT(11) NOT NULL, APPLIED BIT NULL ,
POLICY_ID INT NOT NULL , CREATED_TIME DATETIME2 NULL ,
POLICY_CONTENT BLOB NULL , UPDATED_TIME DATETIME2 NULL ,
TENANT_ID INT NOT NULL, APPLIED_TIME DATETIME2 NULL ,
APPLIED TINYINT(1) NULL ,
CREATED_TIME TIMESTAMP NULL ,
UPDATED_TIME TIMESTAMP NULL ,
APPLIED_TIME TIMESTAMP NULL ,
PRIMARY KEY (ID) , PRIMARY KEY (ID) ,
CONSTRAINT FK_DM_POLICY_DEVCIE_APPLIED CONSTRAINT FK_DM_POLICY_DEVCIE_APPLIED FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID)
FOREIGN KEY (DEVICE_ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES DM_DEVICE (ID ) );
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;
CREATE TABLE DM_CRITERIA (
CREATE TABLE IF NOT EXISTS DM_CRITERIA ( ID INTEGER IDENTITY(1,1) NOT NULL,
ID INT NOT NULL AUTO_INCREMENT, TENANT_ID INTEGER NOT NULL,
TENANT_ID INT NOT NULL,
NAME VARCHAR(50) NULL, NAME VARCHAR(50) NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; );
CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA ( CREATE TABLE DM_POLICY_CRITERIA (
ID INT NOT NULL AUTO_INCREMENT, ID INTEGER IDENTITY(1,1) NOT NULL,
CRITERIA_ID INT NOT NULL, CRITERIA_ID INTEGER NOT NULL,
POLICY_ID INT NOT NULL, POLICY_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_CRITERIA_POLICY_CRITERIA CONSTRAINT FK_CRITERIA_POLICY_CRITERIA FOREIGN KEY (CRITERIA_ID) REFERENCES DM_CRITERIA (ID)
FOREIGN KEY (CRITERIA_ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
REFERENCES DM_CRITERIA (ID) CONSTRAINT FK_POLICY_POLICY_CRITERIA FOREIGN KEY (POLICY_ID) REFERENCES DM_POLICY (ID)
ON DELETE NO ACTION ON DELETE NO ACTION ON UPDATE NO ACTION
ON UPDATE NO ACTION, );
CONSTRAINT FK_POLICY_POLICY_CRITERIA
FOREIGN KEY (POLICY_ID) CREATE TABLE DM_POLICY_CRITERIA_PROPERTIES (
REFERENCES DM_POLICY (ID) ID INTEGER IDENTITY(1,1) NOT NULL,
ON DELETE NO ACTION POLICY_CRITERION_ID INTEGER NOT NULL,
ON UPDATE NO ACTION
)ENGINE = InnoDB;
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_KEY VARCHAR(45) NULL,
PROP_VALUE VARCHAR(100) NULL, PROP_VALUE VARCHAR(100) NULL,
CONTENT BLOB NULL COMMENT 'This is used to ', CONTENT VARBINARY(255) NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES FOREIGN KEY (POLICY_CRITERION_ID) REFERENCES DM_POLICY_CRITERIA (ID)
FOREIGN KEY (POLICY_CRITERION_ID) ON DELETE CASCADE ON UPDATE NO ACTION
REFERENCES DM_POLICY_CRITERIA (ID) );
ON DELETE CASCADE
ON UPDATE NO ACTION CREATE TABLE DM_POLICY_COMPLIANCE_STATUS (
)ENGINE = InnoDB; ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL,
ENROLMENT_ID INTEGER NOT NULL,
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS ( POLICY_ID INTEGER NOT NULL,
ID INT NOT NULL AUTO_INCREMENT, TENANT_ID INTEGER NOT NULL,
DEVICE_ID INT NOT NULL, STATUS INTEGER NULL,
ENROLMENT_ID INT(11) NOT NULL, LAST_SUCCESS_TIME DATETIME2 NULL,
POLICY_ID INT NOT NULL, LAST_REQUESTED_TIME DATETIME2 NULL,
TENANT_ID INT NOT NULL, LAST_FAILED_TIME DATETIME2 NULL,
STATUS INT NULL, ATTEMPTS INTEGER NULL,
LAST_SUCCESS_TIME TIMESTAMP NULL,
LAST_REQUESTED_TIME TIMESTAMP NULL,
LAST_FAILED_TIME TIMESTAMP NULL,
ATTEMPTS INT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; );
CREATE TABLE DM_POLICY_CHANGE_MGT (
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT ( ID INTEGER IDENTITY(1,1) NOT NULL,
ID INT NOT NULL AUTO_INCREMENT, POLICY_ID INTEGER NOT NULL,
POLICY_ID INT NOT NULL, DEVICE_TYPE VARCHAR(300) NOT NULL,
DEVICE_TYPE VARCHAR(300) NOT NULL , TENANT_ID INTEGER NOT NULL,
TENANT_ID INT(11) NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; );
CREATE TABLE DM_POLICY_COMPLIANCE_FEATURES (
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES ( ID INTEGER IDENTITY(1,1) NOT NULL,
ID INT NOT NULL AUTO_INCREMENT, COMPLIANCE_STATUS_ID INTEGER NOT NULL,
COMPLIANCE_STATUS_ID INT NOT NULL, TENANT_ID INTEGER NOT NULL,
TENANT_ID INT NOT NULL,
FEATURE_CODE VARCHAR(100) NOT NULL, FEATURE_CODE VARCHAR(100) NOT NULL,
STATUS INT NULL, STATUS INTEGER NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_COMPLIANCE_FEATURES_STATUS CONSTRAINT FK_COMPLIANCE_FEATURES_STATUS FOREIGN KEY (COMPLIANCE_STATUS_ID) REFERENCES DM_POLICY_COMPLIANCE_STATUS (ID)
FOREIGN KEY (COMPLIANCE_STATUS_ID) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES DM_POLICY_COMPLIANCE_STATUS (ID) );
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( CREATE TABLE DM_APPLICATION (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER IDENTITY(1,1) 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, NAME VARCHAR(150) NOT NULL,
APP_IDENTIFIER VARCHAR(150) NOT NULL, APP_IDENTIFIER VARCHAR(150) NOT NULL,
PLATFORM VARCHAR(50) DEFAULT NULL, PLATFORM VARCHAR(50) DEFAULT NULL,
@ -359,110 +288,116 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
TYPE VARCHAR(50) NULL, TYPE VARCHAR(50) NULL,
LOCATION_URL VARCHAR(100) DEFAULT NULL, LOCATION_URL VARCHAR(100) DEFAULT NULL,
IMAGE_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES BLOB NULL, APP_PROPERTIES VARBINARY(255) NULL,
MEMORY_USAGE INTEGER(10) NULL, MEMORY_USAGE INTEGER NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE, IS_ACTIVE BIT NOT NULL DEFAULT 0,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; );
CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING ( CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FK_DM_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES CONSTRAINT FK_DM_APPLICATION FOREIGN KEY (APPLICATION_ID) REFERENCES
DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
-- POLICY RELATED TABLES FINISHED -- -- POLICY RELATED TABLES FINISHED --
-- 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;
-- DEVICE GROUP TABLES --
CREATE TABLE DM_GROUP (
ID INTEGER IDENTITY(1,1) NOT NULL,
GROUP_NAME VARCHAR(100) DEFAULT NULL,
DESCRIPTION VARBINARY(255) NULL,
DATE_OF_CREATE BIGINT DEFAULT NULL,
DATE_OF_LAST_UPDATE BIGINT DEFAULT NULL,
OWNER VARCHAR(45) DEFAULT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( CREATE TABLE DM_DEVICE_GROUP_MAP (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER DEFAULT NULL, DEVICE_ID INTEGER DEFAULT NULL,
GROUP_ID INTEGER DEFAULT NULL, GROUP_ID INTEGER DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_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, REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID) CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
-- END OF DEVICE GROUP TABLES -- -- END OF DEVICE GROUP TABLES --
-- POLICY AND DEVICE GROUP MAPPING --
-- NOTIFICATION TABLES -- CREATE TABLE DM_DEVICE_GROUP_POLICY (
ID INTEGER IDENTITY(1,1) NOT NULL,
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 IF NOT EXISTS DM_NOTIFICATION ( -- END OF POLICY AND DEVICE GROUP MAPPING --
NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL,
-- NOTIFICATION TABLE --
CREATE TABLE DM_NOTIFICATION (
NOTIFICATION_ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
OPERATION_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
STATUS VARCHAR(10) NULL, STATUS VARCHAR(10) NULL,
DESCRIPTION VARCHAR(100) NULL, DESCRIPTION VARCHAR(100) NULL,
PRIMARY KEY (NOTIFICATION_ID), PRIMARY KEY (NOTIFICATION_ID),
CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FL_DM_NOTIFICATION FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES CONSTRAINT FK_DM_OPERATION_NOTIFICATION FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; );
-- NOTIFICATION TABLE END --
-- END NOTIFICATION TABLES --
DROP TABLE IF EXISTS DM_DEVICE_INFO;
CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO ( CREATE TABLE DM_DEVICE_INFO (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INT NULL, DEVICE_ID INTEGER NULL,
KEY_FIELD VARCHAR(45) NULL, KEY_FIELD VARCHAR(45) NULL,
VALUE_FIELD VARCHAR(100) NULL, VALUE_FIELD VARCHAR(100) NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
INDEX DM_DEVICE_INFO_DEVICE_idx (DEVICE_ID ASC), INDEX DM_DEVICE_INFO_DEVICE_idx (DEVICE_ID ASC),
CONSTRAINT DM_DEVICE_INFO_DEVICE CONSTRAINT DM_DEVICE_INFO_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION
FOREIGN KEY (DEVICE_ID) ON UPDATE NO ACTION
REFERENCES DM_DEVICE (ID) );
ON DELETE NO ACTION
ON UPDATE NO ACTION CREATE TABLE DM_DEVICE_LOCATION (
) ID INTEGER IDENTITY(1,1) NOT NULL,
ENGINE = InnoDB; 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, STREET1 VARCHAR(45) NULL,
STREET2 VARCHAR(45) NULL, STREET2 VARCHAR(45) NULL,
CITY VARCHAR(45) NULL, CITY VARCHAR(45) NULL,
ZIP VARCHAR(10) NULL, ZIP VARCHAR(10) NULL,
STATE VARCHAR(45) NULL, STATE VARCHAR(45) NULL,
COUNTRY VARCHAR(45) NULL, COUNTRY VARCHAR(45) NULL,
UPDATE_TIMESTAMP BIGINT(15) NOT NULL, UPDATE_TIMESTAMP INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
INDEX DM_DEVICE_LOCATION_DEVICE_idx (DEVICE_ID ASC), INDEX DM_DEVICE_LOCATION_DEVICE_idx (DEVICE_ID ASC),
CONSTRAINT DM_DEVICE_LOCATION_DEVICE CONSTRAINT DM_DEVICE_LOCATION_DEVICE
@ -470,14 +405,11 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
REFERENCES DM_DEVICE (ID) REFERENCES DM_DEVICE (ID)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION ON UPDATE NO ACTION
) );
ENGINE = InnoDB;
DROP TABLE IF EXISTS DM_DEVICE_DETAIL ; CREATE TABLE DM_DEVICE_DETAIL (
ID INTEGER IDENTITY(1,1) NOT NULL,
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( DEVICE_ID INTEGER NOT NULL,
ID INT NOT NULL AUTO_INCREMENT,
DEVICE_ID INT NOT NULL,
DEVICE_MODEL VARCHAR(45) NULL, DEVICE_MODEL VARCHAR(45) NULL,
VENDOR VARCHAR(45) NULL, VENDOR VARCHAR(45) NULL,
OS_VERSION VARCHAR(45) NULL, OS_VERSION VARCHAR(45) NULL,
@ -492,38 +424,16 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
CPU_USAGE DECIMAL(5) NULL, CPU_USAGE DECIMAL(5) NULL,
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL, TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL, AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
PLUGGED_IN INT(1) NULL, PLUGGED_IN INTEGER NULL,
UPDATE_TIMESTAMP BIGINT(15) NOT NULL, UPDATE_TIMESTAMP INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx (DEVICE_ID ASC), INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx (DEVICE_ID ASC),
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
FOREIGN KEY (DEVICE_ID) FOREIGN KEY (DEVICE_ID)
REFERENCES DM_DEVICE (ID) REFERENCES DM_DEVICE (ID)
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- 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 ON UPDATE NO ACTION
)ENGINE = InnoDB; );
-- END OF POLICY AND DEVICE GROUP MAPPING --
-- DASHBOARD RELATED VIEWS -- -- DASHBOARD RELATED VIEWS --
@ -588,4 +498,3 @@ DM_DEVICE.ID = DM_DEVICE_DETAIL.DEVICE_ID
ORDER BY TENANT_ID, DEVICE_ID; ORDER BY TENANT_ID, DEVICE_ID;
-- END OF DASHBOARD RELATED VIEWS -- -- END OF DASHBOARD RELATED VIEWS --

@ -336,22 +336,6 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
ON UPDATE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB; )ENGINE = InnoDB;
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 ( CREATE TABLE IF NOT EXISTS DM_APPLICATION (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
NAME VARCHAR(150) NOT NULL, NAME VARCHAR(150) NOT NULL,
@ -454,9 +438,6 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
-- END NOTIFICATION TABLES -- -- END NOTIFICATION TABLES --
DROP TABLE IF EXISTS DM_DEVICE_INFO;
CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO ( CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL, DEVICE_ID INT NULL,
@ -472,10 +453,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
) )
ENGINE = InnoDB; ENGINE = InnoDB;
DROP TABLE IF EXISTS DM_DEVICE_LOCATION;
CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION ( CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INT NULL, DEVICE_ID INT NULL,
@ -498,8 +475,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
) )
ENGINE = InnoDB; ENGINE = InnoDB;
DROP TABLE IF EXISTS DM_DEVICE_DETAIL ;
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
ID INT NOT NULL AUTO_INCREMENT, ID INT NOT NULL AUTO_INCREMENT,
DEVICE_ID INT NOT NULL, DEVICE_ID INT NOT NULL,

@ -764,13 +764,6 @@ WHEN (NEW.ID IS NULL)
END; END;
/ /
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_LOCATION';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
/
CREATE TABLE DM_DEVICE_LOCATION ( CREATE TABLE DM_DEVICE_LOCATION (
ID NUMBER(10) NOT NULL, ID NUMBER(10) NOT NULL,
DEVICE_ID NUMBER(10) NULL, DEVICE_ID NUMBER(10) NULL,
@ -802,13 +795,6 @@ WHEN (NEW.ID IS NULL)
END; END;
/ /
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_DETAIL';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
/
CREATE TABLE DM_DEVICE_DETAIL ( CREATE TABLE DM_DEVICE_DETAIL (
ID NUMBER(10) NOT NULL, ID NUMBER(10) NOT NULL,
DEVICE_ID NUMBER(10) NOT NULL, DEVICE_ID NUMBER(10) NOT NULL,

@ -6,6 +6,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
UNIQUE(NAME) UNIQUE(NAME)
); );
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME);
CREATE TABLE IF NOT EXISTS DM_DEVICE ( CREATE TABLE IF NOT EXISTS DM_DEVICE (
ID BIGSERIAL NOT NULL PRIMARY KEY, ID BIGSERIAL NOT NULL PRIMARY KEY,
DESCRIPTION TEXT DEFAULT NULL, DESCRIPTION TEXT DEFAULT NULL,
@ -18,6 +20,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX IDX_DM_DEVICE ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID);
CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATE TABLE IF NOT EXISTS DM_OPERATION (
ID BIGSERIAL NOT NULL PRIMARY KEY, ID BIGSERIAL NOT NULL PRIMARY KEY,
TYPE VARCHAR(50) NOT NULL, TYPE VARCHAR(50) NOT NULL,
@ -73,6 +77,9 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX IDX_ENROLMENT_FK_DEVICE_ID ON DM_ENROLMENT(DEVICE_ID);
CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID ON DM_ENROLMENT(DEVICE_ID, TENANT_ID);
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
ID BIGSERIAL NOT NULL PRIMARY KEY, ID BIGSERIAL NOT NULL PRIMARY KEY,
ENROLMENT_ID INTEGER NOT NULL, ENROLMENT_ID INTEGER NOT NULL,
@ -86,6 +93,10 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX IDX_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMESTAMP);
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID);
CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE ( CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
ID BIGSERIAL NOT NULL PRIMARY KEY, ID BIGSERIAL NOT NULL PRIMARY KEY,
ENROLMENT_ID INTEGER NOT NULL, ENROLMENT_ID INTEGER NOT NULL,
@ -98,6 +109,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX IDX_ENID_OPID ON DM_DEVICE_OPERATION_RESPONSE(OPERATION_ID, ENROLMENT_ID);
-- POLICY RELATED TABLES --- -- POLICY RELATED TABLES ---
CREATE TABLE IF NOT EXISTS DM_PROFILE ( CREATE TABLE IF NOT EXISTS DM_PROFILE (

@ -1,4 +1,6 @@
instructions.configure = \ instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt-cdmf);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt-cdmf);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggeryapps/devicemgt-cdmf,target:${installFolder}/../../deployment/server/jaggeryapps/devicemgt-cdmf,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggeryapps/devicemgt-cdmf,target:${installFolder}/../../deployment/server/jaggeryapps/devicemgt-cdmf,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/uuf-template-app);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggeryapps/uuf-template-app,target:${installFolder}/../../deployment/server/jaggeryapps/uuf-template-app,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggery-modules/utils/,target:${installFolder}/../../modules/utils,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggery-modules/utils/,target:${installFolder}/../../modules/utils,overwrite:true);\
Loading…
Cancel
Save