diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js index c1acb8e9f2..fa2eaffb6e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js @@ -150,6 +150,8 @@ function loadRoles() { var innerhtml = ''; + var isAdminRole = $("#role-table").data("role") === data.name; + var editLink = ''; - if (!isCloud) { + if (!isCloud && !isAdminRole) { innerhtml = editLink + editPermissionLink + removeLink; } return innerhtml; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js index 997711701c..f16ea8db7c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js @@ -18,8 +18,6 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var username = request.getParameter("username"); - var user = userModule.getUser(username)["content"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var isExsistingUser = false; var userName = request.getParameter("username"); @@ -49,7 +47,8 @@ function onRequest(context) { } var canEdit = false; - if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit") && + userName !== deviceMgtProps['adminUser'].split("@")[0]) { canEdit = true; } 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"];