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 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"];
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 deviceModule = require("/app/modules/device.js").deviceModule;
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 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 constants = require("/app/modules/constants.js");
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 user = session.get(constants.USER_SESSION_KEY);

@ -23,7 +23,7 @@ var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri));
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"];
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 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")) {
var deviceType = request.getParameter("deviceType");

@ -23,7 +23,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/user-api.jag");
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 deviceModule = require("/app/modules/device.js").deviceModule;
var utility = require("/app/modules/utility.js").utility;

@ -17,16 +17,18 @@
*/
var conf = function () {
var conf = application.get("UI_CONF");
var conf = application.get("CONF");
if (!conf) {
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"];
pinch(conf, /^/,
function (path, key, value) {
if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) {
//noinspection JSUnresolvedFunction
return value.replace("%https.ip%", server.address("https"));
} else if ((typeof value === "string") && value.indexOf("%http.ip%") > -1) {
//noinspection JSUnresolvedFunction
return value.replace("%http.ip%", server.address("http"));
} else if ((typeof value === "string") && value.indexOf("%date-year%") > -1) {
var year = new Date().getFullYear();
@ -35,7 +37,7 @@ var conf = function () {
return value;
}
);
application.put("UI_CONF", conf);
application.put("CONF", conf);
}
return conf;
}();

@ -22,7 +22,7 @@ deviceModule = function () {
var utility = require('/app/modules/utility.js').utility;
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 ArrayList = Packages.java.util.ArrayList;

@ -22,7 +22,7 @@ var groupModule = {};
var userModule = require("/app/modules/user.js").userModule;
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 serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];

@ -17,7 +17,7 @@
*/
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({
tenanted: true,
url: devicemgtProps["httpsURL"] + "/admin"

@ -30,7 +30,7 @@ var onFail;
} else {
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;
(new carbonServer.Server({url: devicemgtProps["adminService"]}))
.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 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 privateMethods = {};

@ -35,7 +35,7 @@ var invokers = function () {
var TOKEN_EXPIRED = "Access token expired";
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 userModule = require("/app/modules/user.js")["userModule"];
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 utility = require('/app/modules/utility.js').utility;
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 publicMethods = {};

@ -25,7 +25,7 @@ policyModule = function () {
var constants = require('/app/modules/constants.js');
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 publicMethods = {};

@ -24,7 +24,7 @@ var userModule = function () {
var constants = require("/app/modules/constants.js");
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"];
/* Initializing user manager */

@ -20,7 +20,7 @@ var utility;
utility = function () {
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 JavaClass = Packages.java.lang.Class;
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;

@ -21,7 +21,7 @@ function onRequest(context) {
var user = session.get(constants.USER_SESSION_KEY);
var userModule = require("/app/modules/user.js").userModule;
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) {
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
*/
function onRequest(context) {
var devicemgtProps = require("/app/conf/reader/main.js")["conf"];
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var page = {};
page["groupNameJSRegEx"] = devicemgtProps.groupValidationConfig.groupNameJSRegEx;
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 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 response = userModule.getRolesByUserStore();

@ -20,7 +20,7 @@ function onRequest(context) {
var userModule = require("/app/modules/user.js").userModule;
var userName = request.getParameter("username");
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) {
var title;
if (user.firstname || user.lastname) {

@ -29,7 +29,7 @@ function onRequest(context) {
var page = {};
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["permissions"] = userModule.getUIPermissions();

@ -30,7 +30,7 @@ function onRequest (context) {
var userModule = require("/app/modules/user.js").userModule;
var constants = require("/app/modules/constants.js");
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["enrollmentURL"] = deviceMgtProps.enrollmentURL;

@ -24,7 +24,7 @@
*/
function onRequest(context) {
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();
if (response["status"] == "success") {
context["roles"] = response["content"];

@ -24,7 +24,7 @@
*/
function onRequest(context) {
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 uriMatcher = new URIMatcher(String(uri));
var isMatched = uriMatcher.match("/{context}/role/edit/{rolename}");

@ -30,7 +30,7 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) {
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["adminRole"] = deviceMgtProps.adminRole;
return context;

@ -28,7 +28,7 @@ function onRequest(context) {
}
});
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 uiPermissions = userModule.getUIPermissions();
context["permissions"] = uiPermissions;

Loading…
Cancel
Save