Adding conf-reader to UI modules

revert-70aa11f8
dilanua 8 years ago
parent bbff93adcc
commit 39b14c9bc5

@ -22,7 +22,7 @@ var log = new Log("api/data-tables-invoker-api.jag");
var uri = request.getRequestURI(); var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri)); var uriMatcher = new URIMatcher(String(uri));
var devicemgtProps = require("/app/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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
function appendQueryParam (url, queryParam , value) { function appendQueryParam (url, queryParam , value) {

@ -24,7 +24,7 @@ var log = new Log("api/device-api.jag");
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/device.js").deviceModule;
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/user.js").userModule;
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];

@ -23,7 +23,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/device-api.jag"); var log = new Log("api/device-api.jag");
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var devicemgtProps = require("/app/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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var user = session.get(constants.USER_SESSION_KEY); var user = session.get(constants.USER_SESSION_KEY);

@ -23,7 +23,7 @@ var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri)); var uriMatcher = new URIMatcher(String(uri));
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var devicemgtProps = require("/app/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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
if (uriMatcher.match("/{context}/api/invoker/execute/")) { if (uriMatcher.match("/{context}/api/invoker/execute/")) {

@ -23,7 +23,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/operation-api.jag"); var log = new Log("api/operation-api.jag");
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
if (uriMatcher.match("/{context}/api/operation/paginate")) { if (uriMatcher.match("/{context}/api/operation/paginate")) {
var deviceType = request.getParameter("deviceType"); var deviceType = request.getParameter("deviceType");

@ -23,7 +23,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/user-api.jag"); var log = new Log("api/user-api.jag");
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/user.js").userModule;
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/device.js").deviceModule;
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;

@ -17,16 +17,18 @@
*/ */
var conf = function () { var conf = function () {
var conf = application.get("UI_CONF"); var conf = application.get("CONF");
if (!conf) { if (!conf) {
conf = require("/app/conf/config.json"); conf = require("/app/conf/config.json");
var pinch = require("/app/conf/reader/pinch.min.js")["pinch"]; var pinch = require("/app/modules/conf-reader/pinch.min.js")["pinch"];
var server = require("carbon")["server"]; var server = require("carbon")["server"];
pinch(conf, /^/, pinch(conf, /^/,
function (path, key, value) { function (path, key, value) {
if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) { if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) {
//noinspection JSUnresolvedFunction
return value.replace("%https.ip%", server.address("https")); return value.replace("%https.ip%", server.address("https"));
} else if ((typeof value === "string") && value.indexOf("%http.ip%") > -1) { } else if ((typeof value === "string") && value.indexOf("%http.ip%") > -1) {
//noinspection JSUnresolvedFunction
return value.replace("%http.ip%", server.address("http")); return value.replace("%http.ip%", server.address("http"));
} else if ((typeof value === "string") && value.indexOf("%date-year%") > -1) { } else if ((typeof value === "string") && value.indexOf("%date-year%") > -1) {
var year = new Date().getFullYear(); var year = new Date().getFullYear();
@ -35,7 +37,7 @@ var conf = function () {
return value; return value;
} }
); );
application.put("UI_CONF", conf); application.put("CONF", conf);
} }
return conf; return conf;
}(); }();

@ -22,7 +22,7 @@ deviceModule = function () {
var utility = require('/app/modules/utility.js').utility; var utility = require('/app/modules/utility.js').utility;
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var devicemgtProps = require("/app/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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
// var ArrayList = Packages.java.util.ArrayList; // var ArrayList = Packages.java.util.ArrayList;

@ -22,7 +22,7 @@ var groupModule = {};
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/user.js").userModule;
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];

@ -17,7 +17,7 @@
*/ */
var carbonModule = require("carbon"); var carbonModule = require("carbon");
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var carbonServer = new carbonModule.server.Server({ var carbonServer = new carbonModule.server.Server({
tenanted: true, tenanted: true,
url: devicemgtProps["httpsURL"] + "/admin" url: devicemgtProps["httpsURL"] + "/admin"

@ -30,7 +30,7 @@ var onFail;
} else { } else {
apiWrapperUtil.setupTokenPairByPasswordGrantType(context.input.username, context.input.password); apiWrapperUtil.setupTokenPairByPasswordGrantType(context.input.username, context.input.password);
} }
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var carbonServer = require("carbon").server; var carbonServer = require("carbon").server;
(new carbonServer.Server({url: devicemgtProps["adminService"]})) (new carbonServer.Server({url: devicemgtProps["adminService"]}))
.login(context.input.username, context.input.password); .login(context.input.username, context.input.password);

@ -27,7 +27,7 @@ var handlers = function () {
var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var publicMethods = {}; var publicMethods = {};
var privateMethods = {}; var privateMethods = {};

@ -35,7 +35,7 @@ var invokers = function () {
var TOKEN_EXPIRED = "Access token expired"; var TOKEN_EXPIRED = "Access token expired";
var TOKEN_INVALID = "Invalid input. Access token validation failed"; var TOKEN_INVALID = "Invalid input. Access token validation failed";
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/user.js")["userModule"];
var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];

@ -20,7 +20,7 @@ var operationModule = function () {
var log = new Log("/app/modules/operation.js"); var log = new Log("/app/modules/operation.js");
var utility = require('/app/modules/utility.js').utility; var utility = require('/app/modules/utility.js').utility;
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var devicemgtProps = require("/app/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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var publicMethods = {}; var publicMethods = {};

@ -25,7 +25,7 @@ policyModule = function () {
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var utility = require("/app/modules/utility.js")["utility"]; var utility = require("/app/modules/utility.js")["utility"];
var devicemgtProps = require("/app/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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var publicMethods = {}; var publicMethods = {};

@ -24,7 +24,7 @@ var userModule = function () {
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var utility = require("/app/modules/utility.js")["utility"]; var utility = require("/app/modules/utility.js")["utility"];
var devicemgtProps = require("/app/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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
/* Initializing user manager */ /* Initializing user manager */

@ -20,7 +20,7 @@ var utility;
utility = function () { utility = function () {
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var log = new Log("/app/modules/utility.js"); var log = new Log("/app/modules/utility.js");
var JavaClass = Packages.java.lang.Class; var JavaClass = Packages.java.lang.Class;
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext; var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;

@ -21,7 +21,7 @@ function onRequest(context) {
var user = session.get(constants.USER_SESSION_KEY); var user = session.get(constants.USER_SESSION_KEY);
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/user.js").userModule;
var permissions = userModule.getUIPermissions(); var permissions = userModule.getUIPermissions();
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
if (!permissions.VIEW_DASHBOARD) { if (!permissions.VIEW_DASHBOARD) {
response.sendRedirect(constants.WEB_APP_CONTEXT + "/devices"); response.sendRedirect(constants.WEB_APP_CONTEXT + "/devices");

@ -23,7 +23,7 @@
* @returns {*} A context object that returns the dynamic state of this page to be presented * @returns {*} A context object that returns the dynamic state of this page to be presented
*/ */
function onRequest(context) { function onRequest(context) {
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var page = {}; var page = {};
page["groupNameJSRegEx"] = devicemgtProps.groupValidationConfig.groupNameJSRegEx; page["groupNameJSRegEx"] = devicemgtProps.groupValidationConfig.groupNameJSRegEx;
page["groupNameRegExViolationErrorMsg"] = devicemgtProps.groupValidationConfig.groupNameRegExViolationErrorMsg; page["groupNameRegExViolationErrorMsg"] = devicemgtProps.groupValidationConfig.groupNameRegExViolationErrorMsg;

@ -26,7 +26,7 @@ function onRequest(context) {
//var log = new Log("/app/pages/cdmf.page.user.create server-side js"); //var log = new Log("/app/pages/cdmf.page.user.create server-side js");
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/user.js")["userModule"];
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var page = {}; var page = {};
var response = userModule.getRolesByUserStore(); var response = userModule.getRolesByUserStore();

@ -20,7 +20,7 @@ function onRequest(context) {
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/user.js").userModule;
var userName = request.getParameter("username"); var userName = request.getParameter("username");
var user = userModule.getUser(userName)["content"]; var user = userModule.getUser(userName)["content"];
var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
if (user) { if (user) {
var title; var title;
if (user.firstname || user.lastname) { if (user.firstname || user.lastname) {

@ -29,7 +29,7 @@ function onRequest(context) {
var page = {}; var page = {};
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/user.js")["userModule"];
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
page["adminUser"] = deviceMgtProps["adminUser"]; page["adminUser"] = deviceMgtProps["adminUser"];
page["permissions"] = userModule.getUIPermissions(); page["permissions"] = userModule.getUIPermissions();

@ -30,7 +30,7 @@ function onRequest (context) {
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/user.js").userModule;
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var permissions = userModule.getUIPermissions(); var permissions = userModule.getUIPermissions();
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
context.permissions = permissions; context.permissions = permissions;
context["enrollmentURL"] = deviceMgtProps.enrollmentURL; context["enrollmentURL"] = deviceMgtProps.enrollmentURL;

@ -24,7 +24,7 @@
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/user.js")["userModule"];
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var response = userModule.getRoles(); var response = userModule.getRoles();
if (response["status"] == "success") { if (response["status"] == "success") {
context["roles"] = response["content"]; context["roles"] = response["content"];

@ -24,7 +24,7 @@
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/user.js")["userModule"];
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var uri = request.getRequestURI(); var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri)); var uriMatcher = new URIMatcher(String(uri));
var isMatched = uriMatcher.match("/{context}/role/edit/{rolename}"); var isMatched = uriMatcher.match("/{context}/role/edit/{rolename}");

@ -30,7 +30,7 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) { if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) {
context["removePermitted"] = true; context["removePermitted"] = true;
} }
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
context["appContext"] = deviceMgtProps.appContext; context["appContext"] = deviceMgtProps.appContext;
context["adminRole"] = deviceMgtProps.adminRole; context["adminRole"] = deviceMgtProps.adminRole;
return context; return context;

@ -28,7 +28,7 @@ function onRequest(context) {
} }
}); });
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/user.js")["userModule"];
var mdmProps = require('/app/conf/reader/main.js')["conf"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var uiPermissions = userModule.getUIPermissions(); var uiPermissions = userModule.getUIPermissions();
context["permissions"] = uiPermissions; context["permissions"] = uiPermissions;

Loading…
Cancel
Save