|
|
@ -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"];
|
|
|
|