Fixing EMM-1755

revert-70aa11f8
Megala 8 years ago
parent d5c62f74dc
commit d9ec203727

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

@ -17,7 +17,7 @@
*/ */
var loadRoleBasedActionURL = function (action, rolename) { var loadRoleBasedActionURL = function (action, rolename) {
var href = $("#ast-container").data("app-context") + "role/" + action + "/" + rolename; href = $("#ast-container").data("app-context") + "role/" + action + "/?rolename=" + encodeURIComponent(rolename);
$(location).attr('href', href); $(location).attr('href', href);
}; };

@ -26,32 +26,19 @@ function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceMgtProps = require("/app/modules/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 roleName = request.getParameter("rolename");
var isMatched = uriMatcher.match("/{context}/role/edit/{roleName}") ||
uriMatcher.match("/{context}/role/edit/{userStoreName}/{roleName}");
var matchedElements;
var roleName;
var response; var response;
var userStore; var userStore;
if (isMatched) { if (roleName) {
if (uriMatcher.match("/{context}/role/edit/{roleName}")) { if (roleName.indexOf("/") > -1) {
matchedElements = uriMatcher.elements(); userStore = roleName.substr(0, roleName.indexOf("/"));
roleName = matchedElements["roleName"]; } else {
response = userModule.getRole(roleName);
if (response["status"] == "success") {
context["role"] = response["content"];
}
userStore = "PRIMARY"; userStore = "PRIMARY";
} else if (uriMatcher.match("/{context}/role/edit/{userStoreName}/{roleName}")) { }
matchedElements = uriMatcher.elements(); response = userModule.getRole(roleName);
roleName = matchedElements["roleName"]; if (response["status"] == "success") {
userStore = matchedElements["userStoreName"]; context["role"] = response["content"];
response = userModule.getRole(userStore + "/" + roleName);
if (response["status"] == "success") {
context["role"] = response["content"];
}
} }
context["userStore"] = userStore; context["userStore"] = userStore;
context["roleNameJSRegEx"] = deviceMgtProps["roleValidationConfig"]["roleNameJSRegEx"]; context["roleNameJSRegEx"] = deviceMgtProps["roleValidationConfig"]["roleNameJSRegEx"];

Loading…
Cancel
Save