From 54b616985e53089c805e82962e42637f440dd6e6 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 31 Aug 2017 19:23:34 +0530 Subject: [PATCH] Added check for updating admin user by typing the url + code formatting. --- .../app/units/cdmf.unit.role.edit/edit.hbs | 128 ++++++++++-------- .../app/units/cdmf.unit.role.edit/edit.js | 3 + 2 files changed, 73 insertions(+), 58 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs index 76fc116776..428f1b8414 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs @@ -19,68 +19,80 @@
-
-
-

Edit Role

-

Please note that * sign represents required fields of data.

-
-
-
- - -
- -
- -
- - {{#if isCloud}} -
- - devicemgt - - - {{else}} -
- - {{/if}} + {{#if isAdminRole}} +
+
+

Attention!

+
+
This is an prohibited action. +
+
+ {{else}} +
+
+

Edit Role

+

Please note that * sign represents required fields of data.

+
+
+
+ + +
+ +
+ +
+ + {{#if isCloud}} +
+ + devicemgt + +
+ {{else}} +
+ +
+ {{/if}} + minimum 3 characters long and do not + include any whitespaces. + +
+ + + + +
-
-
- -
-
- - - -
+ {{/if}}
- - {{#zone "bottomJs"}} - {{js "js/bottomJs.js"}} - {{/zone}} +
+ +{{#zone "bottomJs"}} + {{js "js/bottomJs.js"}} +{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js index d5c363ef1f..86ff656737 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js @@ -31,6 +31,8 @@ function onRequest(context) { var userStore; context.isCloud = deviceMgtProps.isCloud; + var isAdminRole = deviceMgtProps["adminRole"] === roleName; + if (roleName) { if (roleName.indexOf("/") > -1) { userStore = roleName.substr(0, roleName.indexOf("/")); @@ -41,6 +43,7 @@ function onRequest(context) { if (response["status"] == "success") { context["role"] = response["content"]; } + context["isAdminRole"] = isAdminRole; context["userStore"] = userStore; context["roleNameJSRegEx"] = deviceMgtProps["roleValidationConfig"]["roleNameJSRegEx"]; context["roleNameHelpText"] = deviceMgtProps["roleValidationConfig"]["roleNameHelpMsg"];