Fixing EMM-1755

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

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

@ -17,7 +17,7 @@
*/
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);
};

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

Loading…
Cancel
Save