revert-70aa11f8
charitha 8 years ago
commit de6f2558c5

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

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

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

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

@ -181,7 +181,7 @@ public interface DeviceManagementProviderService {
* @return true if the user owns the device else will return false.
* @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;

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

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

@ -45,7 +45,12 @@ policyModule = function () {
policyObjectToView["priorityId"] = policyObjectFromRestEndpoint["priorityId"];
policyObjectToView["name"] = policyObjectFromRestEndpoint["policyName"];
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"];
var assignedRoleCount = policyObjectFromRestEndpoint["roles"].length;

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

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

@ -24,17 +24,117 @@
</a>
</li>
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles">
Roles
</a>
</li>
<li>
<a href="{{@app.context}}/roles/add-role">
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/role/add">
Add
</a>
</li>
{{/zone}}
{{#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}}

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

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

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

@ -26,6 +26,7 @@
</a>
</li>
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles">
Roles
</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
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"}}
{{#zone "breadcrumbs"}}
@ -26,6 +26,7 @@
</a>
</li>
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles">
Roles
</a>
@ -34,7 +35,8 @@
{{#zone "navbarActions"}}
<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">
<i class="fw fw-add fw-stack-1x"></i>
<i class="fw fw-ring fw-stack-2x"></i>
@ -45,5 +47,114 @@
{{/zone}}
{{#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}}

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

@ -32,18 +32,17 @@ $(function () {
var sortableElem = '.wr-sortable';
$(sortableElem).sortable({
beforeStop: function () {
var sortedIDs = $(this).sortable('toArray');
$(this).sortable('toArray');
}
});
$(sortableElem).disableSelection();
});
var apiBasePath = "/api/device-mgt/v1.0";
var modalPopup = ".wr-modalpopup";
var modalPopupContainer = modalPopup + " .modalpopup-container";
var modalPopupContent = modalPopup + " .modalpopup-content";
var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modal-body";
var body = "body";
var isInit = true;
$(".icon .text").res_text(0.2);
/*
@ -58,7 +57,7 @@ function setPopupMaxHeight() {
* show popup function.
*/
function showPopup() {
$(modalPopup).show();
$(modalPopup).modal('show');
setPopupMaxHeight();
}
@ -67,19 +66,7 @@ function showPopup() {
*/
function hidePopup() {
$(modalPopupContent).html('');
$(modalPopup).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;
$(modalPopup).modal('hide');
}
/**
@ -87,7 +74,7 @@ function getSelectedUsernames() {
* when a user clicks on "Invite" link
* on User Management page in WSO2 MDM Console.
*/
$("a.invite-user-link").click(function () {
$("a#invite-user-link").click(function () {
var usernameList = getSelectedUsernames();
var inviteUserAPI = apiBasePath + "/users/send-invitation";
@ -123,44 +110,16 @@ $("a.invite-user-link").click(function () {
});
});
/**
* Following click function would execute
* when a user clicks on "Remove" link
* on User Listing page in WSO2 MDM Console.
/*
* Function to get selected usernames.
*/
function removeUser(uname) {
var username = uname;
var removeUserAPI = apiBasePath + "/users/" + username;
$(modalPopupContent).html($('#remove-user-modal-content').html());
showPopup();
$("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();
function getSelectedUsernames() {
var usernameList = [];
var userList = $("#user-grid").find("tr.DTTT_selected");
userList.each(function () {
usernameList.push($(this).data('username'));
});
return usernameList;
}
/**
@ -168,15 +127,13 @@ function removeUser(uname) {
* when a user clicks on "Reset Password" link
* on User Listing page in WSO2 MDM Console.
*/
function resetPassword(uname) {
function resetPassword(username) {
$(modalPopupContent).html($('#reset-password-window').html());
showPopup();
$("a#reset-password-yes-link").click(function () {
var newPassword = $("#new-password").val();
var confirmedPassword = $("#confirmed-password").val();
var user = uname;
var errorMsgWrapper = "#notification-error-msg";
var errorMsg = "#notification-error-msg span";
@ -194,22 +151,24 @@ function resetPassword(uname) {
$(errorMsgWrapper).removeClass("hidden");
} else {
var resetPasswordFormData = {};
//resetPasswordFormData.username = user;
resetPasswordFormData.newPassword = unescape(confirmedPassword);
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ user +"/credentials";
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ username +"/credentials";
invokerUtil.post(
resetPasswordServiceURL,
resetPasswordFormData,
function (data, textStatus, jqXHR) { // The success callback
// The success callback
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) {
$(modalPopupContent).html($('#reset-password-success-content').html());
$("a#reset-password-success-link").click(function () {
hidePopup();
});
}
}, function (jqXHR) { // The error callback
},
// The error callback
function (jqXHR) {
var payload = JSON.parse(jqXHR.responseText);
$(errorMsg).text(payload.message);
$(errorMsgWrapper).removeClass("hidden");
@ -224,15 +183,41 @@ function resetPassword(uname) {
}
/**
* Following on click function would execute
* when a user type on the search field on User Listing page in
* WSO2 MDM Console then click on the search button.
* Following click function would execute
* when a user clicks on "Remove" link
* on User Listing page in WSO2 MDM Console.
*/
$("#search-btn").click(function () {
var searchQuery = $("#search-by-username").val();
$("#ast-container").empty();
loadUsers(searchQuery);
function removeUser(username) {
var removeUserAPI = apiBasePath + "/users/" + username;
$(modalPopupContent).html($('#remove-user-modal-content').html());
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
@ -248,11 +233,9 @@ function InitiateViewOption() {
}
}
function loadUsers(searchParam) {
$("#loading-content").show();
function loadUsers() {
var loadingContentView = "#loading-content";
$(loadingContentView).show();
var dataFilter = function (data) {
data = JSON.parse(data);
@ -262,155 +245,120 @@ function loadUsers(searchParam) {
$(data.users).each( function (index) {
objects.push({
filter: data.users[index].username,
firstname: data.users[index].firstname ? data.users[index].firstname: '' ,
lastname: data.users[index].lastname ? data.users[index].lastname : '',
emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '',
DT_RowId : "role-" + data.users[index].username})
firstname: data.users[index].firstname ? data.users[index].firstname : "" ,
lastname: data.users[index].lastname ? data.users[index].lastname : "",
emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : "",
DT_RowId : "user-" + data.users[index].username})
});
json = {
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');
$(nRow).attr('data-username', aData["filter"]);
}
};
//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-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",
data: null,
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",
data: 'filter',
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",
data: null,
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",
data: null,
render: function (data, type, row, meta) {
return '<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"> ' +
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-edit fw-stack-1x"></i>' +
' </span> <span class="hidden-xs hidden-on-grid-view">Edit</span> </a>' +
'<a href="#" data-username="' + data.filter + '" data-userid=' + data.filter +
' data-click-event="remove-form" onclick="javascript:removeUser(\'' + 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"> ' +
'<span class="fw-stack"> ' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-edit fw-stack-1x"></i>' +
'</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">' +
'<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>' +
'<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"> <span class="fw-stack"> <i class="fw fw-ring fw-stack-2x">' +
'</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"><' +
'/i> <i class="fw fw-circle fw-stack-2x"></i> <i class="fw fw-refresh fw-stack-1x fw-inverse">' +
'</i> </span> </span> <span class="hidden-xs hidden-on-grid-view">Reset</span> </a>'
'<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-key fw-stack-1x"></i>' +
'</span>' +
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Reset Password' +
'</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 = {
"placeholder": "Search By Username",
"searchKey" : "filter"
};
$('#user-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options);
$("#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');
// }
// );
// });
$(loadingContentView).hide();
}
$(document).ready(function () {
loadUsers();
$(".viewEnabledIcon").click(function () {
InitiateViewOption();
});

@ -15,8 +15,8 @@
specific language governing permissions and limitations
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"}}
{{#zone "breadcrumbs"}}
@ -26,6 +26,7 @@
</a>
</li>
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/users">
USERS
</a>
@ -34,6 +35,7 @@
{{#zone "navbarActions"}}
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/user/add">
<span class="icon fw-stack">
<i class="fw fw-add fw-stack-1x"></i>
@ -64,83 +66,24 @@
<input type="hidden" id="can-reset-password" value="true"/>
{{/if}}
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading users . . .
<br>
</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}}>
<!--<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">
<thead>
<tr class="sort-row">
<th>By Username</th>
</tr>
<tr class="bulk-action-row">
<th colspan="5">
<th colspan="3">
<ul class="tiles">
<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">
<span class="icon fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-invitation fw-stack-1x"></i>
<i class="fw fw-invitation fw-stack-2x"></i>
</span>
Invite Selected
</a>
@ -149,13 +92,10 @@
</th>
</tr>
</thead>
<tbody id="ast-container">
<br class="c-both" />
</tbody>
<tbody id="ast-container"></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">
@ -164,23 +104,19 @@
</div>
<div id="invite-user-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
An invitation mail will be sent to the selected user(s) to initiate an enrolment process.
Do you wish to continue ?
</h3>
<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">
No
</a>
</div>
</h4>
</div>
<div class="modal-footer">
<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">No</a>
</div>
</div>
</div>
@ -201,123 +137,135 @@
</div>
<div id="invite-user-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. Try again later.</h3>
<div class="buttons">
<a href="#" id="invite-user-error-link" class="btn-operations">
Ok
</a>
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Unexpected Error
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</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 id="remove-user-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 user ?</h3>
<div class="buttons">
<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 class="modal-header">
<h3 class="pull-left modal-title">
Remove User
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
Do you really want to remove this user ?
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<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 id="remove-user-success-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Done. User was successfully removed.</h3>
<div class="buttons">
<a href="#" id="remove-user-success-link" class="btn-operations">
Ok
</a>
<div class="modal-header">
<h3 class="pull-left modal-title">
User Removed.
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
Done. User was successfully removed.
</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 id="remove-user-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-user-error-link" class="btn-operations">
Ok
</a>
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Unexpected Error
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</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 id="errorUsers" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
Please select a user or a list of users to send invitation emails.
</h4>
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">Ok</a>
</div>
</div>
</div>
<div id="errorUserView" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
<div class="modal-header">
<h3 class="pull-left modal-title">
Unauthorized action!
</h3>
</div>
</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
</div>
<div id="reset-password-window" class="hide">
<input type="hidden" id="user" value="{{user.username}}">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-key fw-stack-1x"></i>
</span>
Reset Password
<br>
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -335,6 +283,8 @@
</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;
@ -346,14 +296,15 @@
</div>
</div>
</div>
</div>
</div>
<div id="reset-password-success-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Password reset is successful.</h3>
<div class="modal-header">
<h3 class="pull-left modal-title">
Password reset is successful.
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="reset-password-success-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
@ -361,14 +312,13 @@
</div>
</div>
</div>
</div>
</div>
{{/zone}}
{{#zone "common-navigation"}}
<!--Later add the navigation menu from here-->
{{/zone}}
{{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget -->
<script id="user-listing" data-current-user="{{currentUser.username}}"
src="{{@page.publicUri}}/templates/listing.hbs" type="text/x-handlebars-template"></script>
{{js "js/listing.js"}}

@ -115,8 +115,8 @@ var operationModule = function () {
var featureMap = {
"DEVICE_LOCK": "lock",
"VPN": "vpn",
"PER_APP_VPN": "perappvpn",
"APP_TO_PER_APP_VPN_MAPPING": "apptoperappvpnmapping",
"PER_APP_VPN": "per-app-vpn",
"APP_TO_PER_APP_VPN_MAPPING": "app-to-per-app-vpn-mapping",
"RING": "ring",
"LOCATION": "location",
"NOTIFICATION": "notification",
@ -124,12 +124,12 @@ var operationModule = function () {
"RESTRICTION": "restriction",
"CELLULAR": "cellular",
"WIFI": "wifi",
"INSTALL_STORE_APPLICATION": "storeapplication",
"INSTALL_ENTERPRISE_APPLICATION": "enterpriseapplication",
"REMOVE_APPLICATION": "removeapplication",
"ENTERPRISE_WIPE": "enterprisewipe"
"INSTALL_STORE_APPLICATION": "store-application",
"INSTALL_ENTERPRISE_APPLICATION": "enterprise-application",
"REMOVE_APPLICATION": "remove-application",
"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"}}
{{js "js/jquery.qrcode.min.js"}}
<script type="text/javascript">
var modalPopup = '.wr-modalpopup',
modalPopupContainer = modalPopup + ' .modalpopup-container',
modalPopupContent = modalPopup + ' .modalpopup-content';
var modalPopup = '.modal',
modalPopupContainer = modalPopup + ' .modal-content',
modalPopupContent = modalPopup + ' .modal-content';
function openCollapsedNav(){
$(".wr-hidden-nav-toggle-btn").addClass("active");
$("#hiddenNav").slideToggle("slideDown", function () {
@ -44,8 +44,8 @@
* show popup function.
*/
function showQRCodePopup() {
$(modalPopup).show();
setPopupMaxHeight();
$(modalPopup).modal('show');
//setPopupMaxHeight();
}
/*
@ -54,7 +54,9 @@
function hidePopup() {
$(modalPopupContent).html("");
$(modalPopupContent).removeClass("operation-data");
$(modalPopup).hide();
$(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
}
function generateQRCode(qrCodeClass){
@ -68,8 +70,8 @@
</script>
<script type="text/javascript">
function toggleEnrollment(){
$(".modalpopup-content").html($("#qr-code-modal").html());
generateQRCode(".modalpopup-content .qr-code");
$(".modal-content").html($("#qr-code-modal").html());
generateQRCode(".modal-content .qr-code");
showQRCodePopup();
}
</script>

@ -30,9 +30,9 @@ if (saveNewPrioritiesButtonEnabled) {
* Modal related stuff are as follows.
*/
var modalPopup = ".wr-modalpopup";
var modalPopupContainer = modalPopup + " .modalpopup-container";
var modalPopupContent = modalPopup + " .modalpopup-content";
var modalPopup = ".modal";
var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modal-content";
var body = "body";
/*
@ -50,8 +50,8 @@ function setPopupMaxHeight() {
* show popup function.
*/
function showPopup() {
$(modalPopup).show();
setPopupMaxHeight();
$(modalPopup).modal('show');
//setPopupMaxHeight();
}
/*
@ -59,7 +59,9 @@ function showPopup() {
*/
function hidePopup() {
$(modalPopupContent).html('');
$(modalPopup).hide();
$(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
}
$(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
* @return {Null}
*/
var modalPopup = ".wr-modalpopup";
var modalPopupContent = modalPopup + " .modalpopup-content";
var modalPopup = ".modal";
var modalPopupContent = modalPopup + " .modal-content";
var apiBasePath = "/api/device-mgt/v1.0";
@ -38,15 +38,17 @@ var apiBasePath = "/api/device-mgt/v1.0";
*/
function hidePopup() {
$(modalPopupContent).html('');
$(modalPopup).hide();
$(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px');
$('.modal-backdrop').remove();
}
/*
* show popup function.
*/
function showPopup() {
$(modalPopup).show();
setPopupMaxHeight();
$(modalPopup).modal('show');
//setPopupMaxHeight();
}
$.fn.tree_view = function(){
var tree = $(this);

@ -31,11 +31,8 @@
</div>
<label class="wr-input-label">Domain</label>
<div class="wr-input-control">
<select id="domain" class="form-control select">
<option>PRIMARY</option>
{{#each userStores}}
<option>{{this}}</option>
{{/each}}
<select id="domain" class="form-control select" disabled>
<option>{{userStore}}</option>
</select>
</div>
<label class="wr-input-label">

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

@ -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 () {
var modalPopup = ".wr-modalpopup";
// var modalPopupContainer = modalPopup + " .modalpopup-container";
var modalPopupContent = modalPopup + " .modalpopup-content";
var modalPopup = ".modal";
// var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modal-body";
$("#change-password").click(function () {

@ -25,17 +25,17 @@
<div id="change-password-window" class="hide">
<input type="hidden" id="user" value="{{username}}">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h4>
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-key fw-stack-1x"></i>
</span>
Change Password
<br><br>
</h4>
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -59,13 +59,14 @@
</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 id="change-password-success-content" class="hide">

@ -2642,64 +2642,7 @@ ul.tiles .icon {
/* ========================================================================
* 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
@ -4018,72 +3961,6 @@ a.btn-operations {
}
/* 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 */
.wr-notification-bar, .wr-side-panel {
@ -6750,32 +6627,7 @@ ul.tiles .icon {
/* ========================================================================
* 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

@ -17,77 +17,4 @@
*/
/* 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.
}}
{{#zone "topCss"}}
{{~css "css/validation-style.css"}}
{{~css "css/validation-style.css" combine=false}}
{{/zone}}
{{#zone "bottomJs"}}

@ -4945,7 +4945,7 @@ button.list-group-item-danger.active:focus {
.panel {
margin-bottom: 20px;
background-color: #fff;
background-color: none;
border: 1px solid transparent;
border-radius: 0;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
@ -5398,6 +5398,9 @@ button.close {
-moz-border-radius: 0;
border-radius: 0;
}
.panel-body .message {
margin:0px;
}
.message h4 {
margin-top: 0;
margin-bottom: 5px;
@ -7438,17 +7441,13 @@ ul.sidebar-messages > li {
* ======================================================================== */
.body-wrapper {
padding: 40px;
margin-bottom:40px;
}
.body-wrapper a.btn:hover,.body-wrapper a:hover {
text-decoration: none;
}
@media (max-width: 767px) {
.body-wrapper {
padding: 40px 0px;
}
}
.page-header {
margin: 0 0 20px;
}
@ -7791,9 +7790,16 @@ ul.sidebar-messages > li {
background: transparent;
font-size: 24px;
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-color: #ddd;
padding: 20px;
min-height: 300px;
}

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

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

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

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

@ -764,13 +764,6 @@ WHEN (NEW.ID IS NULL)
END;
/
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_LOCATION';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
/
CREATE TABLE DM_DEVICE_LOCATION (
ID NUMBER(10) NOT NULL,
DEVICE_ID NUMBER(10) NULL,
@ -802,13 +795,6 @@ WHEN (NEW.ID IS NULL)
END;
/
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE DM_DEVICE_DETAIL';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
/
CREATE TABLE DM_DEVICE_DETAIL (
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)
);
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME);
CREATE TABLE IF NOT EXISTS DM_DEVICE (
ID BIGSERIAL NOT NULL PRIMARY KEY,
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
);
CREATE INDEX IDX_DM_DEVICE ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID);
CREATE TABLE IF NOT EXISTS DM_OPERATION (
ID BIGSERIAL NOT NULL PRIMARY KEY,
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
);
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 (
ID BIGSERIAL NOT NULL PRIMARY KEY,
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
);
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 (
ID BIGSERIAL NOT NULL PRIMARY KEY,
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
);
CREATE INDEX IDX_ENID_OPID ON DM_DEVICE_OPERATION_RESPONSE(OPERATION_ID, ENROLMENT_ID);
-- POLICY RELATED TABLES ---
CREATE TABLE IF NOT EXISTS DM_PROFILE (

@ -1,4 +1,6 @@
instructions.configure = \
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.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);\
Loading…
Cancel
Save