{{unit "cdmf.unit.device.operation-mod"}}
{{#if deviceCount}}
-
@@ -324,7 +324,7 @@
{{/zone}}
{{#zone "bottomJs"}}
-
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js
index 88cb32d704..6a376bb028 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js
@@ -31,25 +31,13 @@ function onRequest(context) {
page.groupName = groupName;
}
page.title = title;
- page.permissions = {};
var currentUser = session.get(constants.USER_SESSION_KEY);
- var permissions = [];
if (currentUser) {
- if (userModule.isAuthorized("/permission/admin/device-mgt/admin/devices/list")) {
- permissions.push("LIST_DEVICES");
- } else if (userModule.isAuthorized("/permission/admin/device-mgt/user/devices/list")) {
- permissions.push("LIST_OWN_DEVICES");
- } else if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/policies/list")) {
- permissions.push("LIST_POLICIES");
- }
+ page.permissions = {};
+ page.permissions.list = stringify(userModule.getUIPermissions());
if (userModule.isAuthorized("/permission/admin/device-mgt/admin/devices/add")) {
permissions.enroll = true;
}
- if (userModule.isAuthorized("/permission/admin/device-mgt/admin/devices/remove")) {
- permissions.push("REMOVE_DEVICE");
- }
-
- page.permissions.list = permissions;
page.currentUser = currentUser;
var deviceCount = 0;
if (groupName && groupOwner) {
@@ -64,15 +52,17 @@ function onRequest(context) {
var utility = require("/app/modules/utility.js").utility;
var data = deviceModule.getDeviceTypes();
var deviceTypes = [];
- if (data.data) {
- for (var i = 0; i < data.data.length; i++) {
+ if (data) {
+ for (var i = 0; i < data.length; i++) {
+ var deviceType = utility.getDeviceTypeConfig(data[i].name).deviceType;
deviceTypes.push({
- "type": data.data[i].name,
- "category": utility.getDeviceTypeConfig(data.data[i].name).deviceType.category
- });
+ "type": data[i].name,
+ "category": deviceType.category,
+ "label": deviceType.label
+ });
}
}
- page.deviceTypes = deviceTypes;
+ page.deviceTypes = stringify(deviceTypes);
}
}
return page;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js
index 2711b2b29c..767c37f684 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js
@@ -72,8 +72,10 @@ $(document).ready(function () {
var i;
var permissionList = $("#permission").data("permission");
- for (i = 0; i < permissionList.length; i++) {
- $.setPermission(permissionList[i]);
+ for (var key in permissionList) {
+ if (permissionList.hasOwnProperty(key)) {
+ $.setPermission(key);
+ }
}
/* for device list sorting drop down */
@@ -171,7 +173,7 @@ function loadDevices(searchType, searchParam){
serviceURL = "/devicemgt_admin/devices";
} else if ($.hasPermission("LIST_OWN_DEVICES")) {
//Get authenticated users devices
- serviceURL = "/devicemgt_admin/users/devices?username="+currentUser;
+ serviceURL = "/devicemgt_admin/users/devices?username=" + currentUser;
} else {
$("#loading-content").remove();
$('#device-table').addClass('hidden');
@@ -181,8 +183,11 @@ function loadDevices(searchType, searchParam){
}
function getPropertyValue(deviceProperties, propertyName) {
+ if (!deviceProperties) {
+ return;
+ }
var property;
- for (var i =0; i < deviceProperties.length; i++) {
+ for (var i = 0; i < deviceProperties.length; i++) {
property = deviceProperties[i];
if (property.name == propertyName) {
return property.value;
@@ -191,6 +196,16 @@ function loadDevices(searchType, searchParam){
return {};
}
+ function getDeviceTypeLabel(type){
+ var deviceTypes = deviceListing.data("deviceTypes");
+ for (var i = 0; i < deviceTypes.length; i++){
+ if (deviceTypes[i].type == type){
+ return deviceTypes[i].label;
+ }
+ }
+ return type;
+ }
+
$('#device-grid').datatables_extended ({
serverSide: true,
processing: false,
@@ -242,7 +257,10 @@ function loadDevices(searchType, searchParam){
}
return html;
}},
- { targets: 4, data: 'type' , className: 'fade-edge remove-padding-top' },
+ { targets: 4, data: 'type' , className: 'fade-edge remove-padding-top' ,
+ render: function ( status, type, row, meta ) {
+ return getDeviceTypeLabel(row.type);
+ }},
{ targets: 5, data: 'enrolmentInfo.ownership' , className: 'fade-edge remove-padding-top' },
{ targets: 6, data: 'enrolmentInfo.status' , className: 'text-right content-fill text-left-on-grid-view no-wrap' ,
render: function ( status, type, row, meta ) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js
index 00aa67e7d5..15679db063 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js
@@ -22,33 +22,42 @@ var invokerUtil = function () {
var END_POINT = window.location.origin+"/devicemgt/api/invoker/execute/";
- module.get = function (url, successCallback, errorCallback) {
+ module.get = function (url, successCallback, errorCallback, contentType, acceptType) {
var payload = null;
- execute("GET", url, payload, successCallback, errorCallback);
+ execute("GET", url, payload, successCallback, errorCallback, contentType, acceptType);
};
- module.post = function (url, payload, successCallback, errorCallback) {
- execute("POST", url, payload, successCallback, errorCallback);
+ module.post = function (url, payload, successCallback, errorCallback, contentType, acceptType) {
+ execute("POST", url, payload, successCallback, errorCallback, contentType, acceptType);
};
- module.put = function (url, payload, successCallback, errorCallback) {
- execute("PUT", url, payload, successCallback, errorCallback);
+ module.put = function (url, payload, successCallback, errorCallback, contentType, acceptType) {
+ execute("PUT", url, payload, successCallback, errorCallback, contentType, acceptType);
};
- module.delete = function (url, successCallback, errorCallback) {
+ module.delete = function (url, successCallback, errorCallback, contentType, acceptType) {
var payload = null;
- execute("DELETE", url, payload, successCallback, errorCallback);
+ execute("DELETE", url, payload, successCallback, errorCallback, contentType, acceptType);
};
- function execute (methoad, url, payload, successCallback, errorCallback) {
+ function execute (methoad, url, payload, successCallback, errorCallback, contentType, acceptType) {
+ if(contentType == undefined){
+ contentType = "application/json";
+ }
+ if(acceptType == undefined){
+ acceptType = "application/json";
+ }
var data = {
url: END_POINT,
type: "POST",
- contentType: "application/json",
- accept: "application/json",
+ contentType: contentType,
+ accept: acceptType,
success: successCallback
};
console.log(data);
var paramValue = {};
paramValue.actionMethod = methoad;
paramValue.actionUrl = url;
- paramValue.actionPayload = JSON.stringify(payload);
+ paramValue.actionPayload = payload;
+ if(contentType == "application/json"){
+ paramValue.actionPayload = JSON.stringify(payload);
+ }
data.data = JSON.stringify(paramValue);
$.ajax(data).fail(function (jqXHR) {
if (jqXHR.status == "401") {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js
index 73563a8c57..922563ed6b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js
@@ -56,7 +56,7 @@ var module = {};
cachedAuthModuleConfigs = authModuleConfigs;
} else {
log.error("Cannot find User module configurations in application configuration file '"
- + constants.FILE_APP_CONF + "'.");
+ + constants.FILE_APP_CONF + "'.");
cachedAuthModuleConfigs = {};
}
return cachedAuthModuleConfigs;
@@ -85,7 +85,7 @@ var module = {};
return (rv) ? rv : {};
} else {
log.error("Cannot find login configurations in Auth module configurations in "
- + "application configuration file '" + constants.FILE_APP_CONF + "'.");
+ + "application configuration file '" + constants.FILE_APP_CONF + "'.");
return {};
}
}
@@ -113,7 +113,7 @@ var module = {};
return (rv) ? rv : {};
} else {
log.error("Cannot find logout configurations in Auth module configurations in "
- + "application configuration file '" + constants.FILE_APP_CONF + "'.");
+ + "application configuration file '" + constants.FILE_APP_CONF + "'.");
return {};
}
}
@@ -133,7 +133,7 @@ var module = {};
cachedSsoConfigs = ssoConfigs;
} else {
log.error("Cannot find SSO configurations in Auth module configurations in application "
- + "configuration file '" + constants.FILE_APP_CONF + "'.");
+ + "configuration file '" + constants.FILE_APP_CONF + "'.");
cachedSsoConfigs = {};
}
return cachedSsoConfigs;
@@ -156,13 +156,13 @@ var module = {};
if (operation == OPERATION_LOGIN) {
configs = getLoginConfigurations(event);
pageFullName = (event == EVENT_SUCCESS) ?
- configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_SUCCESS_PAGE] :
- configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_FAIL_PAGE];
+ configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_SUCCESS_PAGE] :
+ configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_FAIL_PAGE];
} else {
configs = getLogoutConfigurations(event);
pageFullName = (event == EVENT_SUCCESS) ?
- configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_SUCCESS_PAGE] :
- configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_FAIL_PAGE];
+ configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_SUCCESS_PAGE] :
+ configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_FAIL_PAGE];
}
if (pageFullName) {
@@ -173,13 +173,13 @@ var module = {};
return page.definition[constants.PAGE_DEFINITION_URI];
}
log.warn("Page '" + pageFullName + "' mentioned in Auth module configurations in "
- + "application configuration file '" + constants.FILE_APP_CONF
- + "' is disabled.");
+ + "application configuration file '" + constants.FILE_APP_CONF
+ + "' is disabled.");
} else {
log.error("Page '" + pageFullName + "' mentioned in Auth module configurations in "
- + "application configuration file '" + constants.FILE_APP_CONF
- + "' does not exists.");
+ + "application configuration file '" + constants.FILE_APP_CONF
+ + "' does not exists.");
}
}
return "/";
@@ -207,13 +207,13 @@ var module = {};
if (operation == OPERATION_LOGIN) {
configs = getLoginConfigurations(event);
scriptFilePath = (event == EVENT_SUCCESS) ?
- configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_SUCCESS_SCRIPT] :
- configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_FAIL_SCRIPT];
+ configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_SUCCESS_SCRIPT] :
+ configs[constants.APP_CONF_AUTH_MODULE_LOGIN_ON_FAIL_SCRIPT];
} else {
configs = getLogoutConfigurations(event);
scriptFilePath = (event == EVENT_SUCCESS) ?
- configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_SUCCESS_SCRIPT] :
- configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_FAIL_SCRIPT];
+ configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_SUCCESS_SCRIPT] :
+ configs[constants.APP_CONF_AUTH_MODULE_LOGOUT_ON_FAIL_SCRIPT];
}
if (!scriptFilePath || (scriptFilePath.length == 0)) {
@@ -222,8 +222,8 @@ var module = {};
var scriptFile = new File(scriptFilePath);
if (!scriptFile.isExists() || scriptFile.isDirectory()) {
log.error("Script '" + scriptFilePath + "' mentioned in Auth module configurations in "
- + "application configuration file '" + constants.FILE_APP_CONF
- + "' does not exists.");
+ + "application configuration file '" + constants.FILE_APP_CONF
+ + "' does not exists.");
return true;
}
@@ -265,7 +265,7 @@ var module = {};
} else {
// event == EVENT_FAIL
redirectUri = getRedirectUri(operation, EVENT_FAIL) + "?error=" + scriptArgument.message
- + "&" + constants.URL_PARAM_REFERER + "=" + getRelayState(operation);
+ + "&" + constants.URL_PARAM_REFERER + "=" + getRelayState(operation);
}
response.sendRedirect(encodeURI(module.getAppContext() + redirectUri));
}
@@ -276,8 +276,8 @@ var module = {};
var identityProviderUrl = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_IDENTITY_PROVIDER_URL];
if (!identityProviderUrl || (identityProviderUrl.length == 0)) {
var msg = "Identity Provider URL is not given in SSO configurations in Auth module "
- + "configurations in application configuration file '"
- + constants.FILE_APP_CONF + "'.";
+ + "configurations in application configuration file '"
+ + constants.FILE_APP_CONF + "'.";
log.error(msg);
response.sendError(500, msg);
return null;
@@ -286,7 +286,7 @@ var module = {};
var issuer = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_ISSUER];
if (!issuer || (issuer.length == 0)) {
var msg = "Issuer is not given in SSO configurations in Auth module configurations in "
- + "application configuration file '" + constants.FILE_APP_CONF + "'.";
+ + "application configuration file '" + constants.FILE_APP_CONF + "'.";
log.error(msg);
response.sendError(500, msg);
return null;
@@ -316,8 +316,8 @@ var module = {};
var identityProviderUrl = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_IDENTITY_PROVIDER_URL];
if (!identityProviderUrl || (identityProviderUrl.length == 0)) {
var msg = "Identity Provider URL is not given in SSO configurations in Auth module "
- + "configurations in application configuration file '"
- + constants.FILE_APP_CONF + "'.";
+ + "configurations in application configuration file '"
+ + constants.FILE_APP_CONF + "'.";
log.error(msg);
response.sendError(500, msg);
return null;
@@ -331,7 +331,7 @@ var module = {};
var issuer = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_ISSUER];
if (!issuer || (issuer.length == 0)) {
var msg = "Issuer is not given in SSO configurations in Auth module configurations in "
- + "application configuration file '" + constants.FILE_APP_CONF + "'.";
+ + "application configuration file '" + constants.FILE_APP_CONF + "'.";
log.error(msg);
response.sendError(500, msg);
return null;
@@ -341,10 +341,10 @@ var module = {};
try {
var ssoClient = require("sso").client;
encodedSAMLAuthRequest = ssoClient.getEncodedSAMLLogoutRequest(username,
- ssoSessionIndex, issuer);
+ ssoSessionIndex, issuer);
} catch (e) {
log.error("Cannot create SAML logout authorization token for user '" + username
- + "' with issuer '" + issuer + "'.");
+ + "' with issuer '" + issuer + "'.");
log.error(e.message, e);
response.sendError(500, e.message);
return null;
@@ -446,17 +446,17 @@ var module = {};
intermediatePage = utils.getFurthestChild(intermediatePage);
if (!intermediatePage.disabled) {
renderer.renderUiComponent(intermediatePage, requestParams, renderingContext,
- lookupTable, response);
+ lookupTable, response);
return;
}
log.warn("Intermediate page '" + intermediatePageName + " mentioned in Auth module "
- + "configurations in application configuration file '"
- + constants.FILE_APP_CONF + "' is disabled.");
+ + "configurations in application configuration file '"
+ + constants.FILE_APP_CONF + "' is disabled.");
} else {
log.error("Intermediate page '" + intermediatePageName
- + " mentioned in Auth module "
- + "configurations in application configuration file '"
- + constants.FILE_APP_CONF + "' does not exists.");
+ + " mentioned in Auth module "
+ + "configurations in application configuration file '"
+ + constants.FILE_APP_CONF + "' does not exists.");
}
}
@@ -528,13 +528,13 @@ var module = {};
* string}}
*/
var ssoSession = ssoClient.decodeSAMLLoginResponse(samlResponseObj, samlResponse,
- session.getId());
+ session.getId());
if (ssoSession.sessionId) {
var ssoSessions = getSsoSessions();
ssoSessions[ssoSession.sessionId] = ssoSession;
var carbonUser = (require("carbon")).server.tenantUser(ssoSession.loggedInUser);
utils.setCurrentUser(carbonUser.username, carbonUser.domain, carbonUser.tenantId);
- var scriptArgument = {input: {}, user: module.getCurrentUser()};
+ var scriptArgument = {input: {samlToken: ssoSession.samlToken}, user: module.getCurrentUser()};
handleEvent(OPERATION_LOGIN, EVENT_SUCCESS, scriptArgument);
} else {
var msg = "Cannot decode SAML login response.";
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml
index 791f382a9c..b728ed51ea 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml
@@ -59,7 +59,7 @@
${project.build.directory}/maven-shared-archive-resources/webapps
-
mdm-admin.war
+
devicemgt_admin.war
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf
index ff61b588ec..91d8294fa2 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf
@@ -1,3 +1,3 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.api_${feature.version}/webapps/mdm-admin.war,target:${installFolder}/../../deployment/server/webapps/mdm-admin.war,overwrite:true);\
\ No newline at end of file
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.api_${feature.version}/webapps/devicemgt_admin.war,target:${installFolder}/../../deployment/server/webapps/devicemgt_admin.war,overwrite:true);\
\ No newline at end of file
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml
index 175e970d1e..ec7962494d 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml
@@ -1,18 +1,18 @@
@@ -44,6 +44,11 @@
org.wso2.carbon.devicemgt
org.wso2.carbon.device.mgt.common
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.api.feature
+ zip
+
org.wso2.carbon.commons
org.wso2.carbon.email.verification
@@ -97,6 +102,11 @@
org.eclipse.equinox.p2.type.group:false
+
+
+ org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.api.feature:${carbon.device.mgt.version}
+
+
org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.core:${carbon.device.mgt.version}
diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml
index 2479f90a61..18ec1fd164 100644
--- a/features/device-mgt/pom.xml
+++ b/features/device-mgt/pom.xml
@@ -1,21 +1,21 @@
+ ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ 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.
+ -->
@@ -27,7 +27,6 @@
4.0.0
- org.wso2.carbon.devicemgt
device-mgt-feature
pom
WSO2 Carbon - Device Management Feature
diff --git a/pom.xml b/pom.xml
index 1d058e9ec8..8e16d112ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -275,6 +275,12 @@
zip
${carbon.device.mgt.version}
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.api.feature
+ zip
+ ${carbon.device.mgt.version}
+
org.wso2.carbon.devicemgt
org.wso2.carbon.device.mgt.ui.feature