Removing obsolete constants from constants.js - UI

revert-70aa11f8
dilanua 8 years ago
parent fbd51e31c0
commit 7bc927fbd0

@ -69,9 +69,9 @@ if (uriMatcher.match("/{context}/api/user/authenticate")) {
apiWrapperUtil.setupTokenPairByPasswordGrantType(username, password);
var permissions = userModule.getUIPermissions();
if (permissions.VIEW_DASHBOARD) {
response.sendRedirect(constants.WEB_APP_CONTEXT);
response.sendRedirect(devicemgtProps["appContext"]);
} else {
response.sendRedirect(constants.WEB_APP_CONTEXT + "/devices");
response.sendRedirect(devicemgtProps["appContext"] + "devices");
}
}, function () {
response.sendRedirect(devicemgtProps.appContext + "login?#auth-failed");

@ -22,7 +22,7 @@ deviceModule = function () {
var utility = require('/app/modules/utility.js').utility;
var constants = require('/app/modules/constants.js');
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
// var ArrayList = Packages.java.util.ArrayList;
@ -244,7 +244,7 @@ deviceModule = function () {
try {
utility.startTenantFlow(carbonUser);
//var url = mdmProps["httpsURL"] + "/mdm-admin/devices/view?type=" + deviceType + "&id=" + deviceId;
var url = mdmProps["httpsURL"] + "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId;
var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId;
return serviceInvokers.XMLHttp.get(
url,
function (backendResponse) {
@ -294,10 +294,11 @@ deviceModule = function () {
var uiPermissions = userModule.getUIPermissions();
var url;
if (uiPermissions.LIST_DEVICES) {
url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/devices/count";
url = devicemgtProps["httpsURL"] +
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices/count";
} else if (uiPermissions.LIST_OWN_DEVICES) {
url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/devices/user/" + carbonUser.username
+ "/count";
url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] +
"/devices/user/" + carbonUser.username + "/count";
} else {
log.error("Access denied for user: " + carbonUser.username);
return -1;
@ -351,7 +352,8 @@ deviceModule = function () {
// };
publicMethods.getDevices = function (userName) {
var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/devices/user/" + userName;
var url = devicemgtProps["httpsURL"] +
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices/user/" + userName;
return serviceInvokers.XMLHttp.get(
url, function (responsePayload) {
for (var i = 0; i < responsePayload.length; i++) {

@ -26,7 +26,8 @@ var groupModule = {};
var utility = require("/app/modules/utility.js").utility;
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var groupServiceEndpoint = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/groups";
var groupServiceEndpoint = devicemgtProps["httpsURL"] +
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/groups";
var user = session.get(constants.USER_SESSION_KEY);

@ -38,7 +38,7 @@ var operationModule = function () {
}
privateMethods.getOperationsFromFeatures = function (deviceType, operationType) {
var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/features/" + deviceType;
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/features/" + deviceType;
var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) {
var features = responsePayload;
var featureList = [];

@ -16,9 +16,6 @@
* under the License.
*/
var WEB_APP_TITLE = "WSO2 CDM";
var WEB_APP_CONTEXT = "/devicemgt";
var ADMIN_SERVICE_CONTEXT = "/api/device-mgt/v1.0";
var USER_SESSION_KEY = "_UUF_USER";
var UNSPECIFIED = "Unspecified";
var httpURL = "httpURL";
@ -72,12 +69,6 @@ var HTTP_GET = "GET";
var HTTP_POST = "POST";
var HTTP_PUT = "PUT";
var HTTP_DELETE = "DELETE";
var REFERER = "referer"
var GRANT_TYPE_PASSWORD = "password";
var GRANT_TYPE_SAML = "saml";
var MQTT_QUEUE_CONFIG_NAME = "MQTT";
var HTTP_CONFLICT = 409;
var HTTP_CREATED = 201;

@ -16,25 +16,25 @@
* under the License.
*/
function onRequest(context) {
function onRequest() {
var constants = require("/app/modules/constants.js");
var user = session.get(constants.USER_SESSION_KEY);
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var permissions = userModule.getUIPermissions();
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"];
var user = session.get(constants["USER_SESSION_KEY"]);
var permissions = userModule.getUIPermissions();
if (!permissions.VIEW_DASHBOARD) {
response.sendRedirect(constants.WEB_APP_CONTEXT + "/devices");
response.sendRedirect(devicemgtProps["appContext"] + "devices");
return;
}
var page = {};
page.permissions = permissions;
page.enrollmentURL = devicemgtProps.enrollmentURL;
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"];
page.device_count = deviceModule.getDevicesCount();
page.group_count = groupModule.getGroupCount();
page.user_count = userModule.getUsers()["content"].length;

Loading…
Cancel
Save