diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs
index 47e8181218..5476c743dd 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs
@@ -50,45 +50,66 @@
{{/zone}}
{{#zone "content"}}
-
- {{#unless isCloud}}
- {{#if removePermitted}}
-
+ {{#if hasRoles}}
+
+ {{#unless isCloud}}
+ {{#if removePermitted}}
+
+ {{/if}}
+ {{#if editPermitted}}
+
+ {{/if}}
+ {{/unless}}
+ {{#if isCloud}}
+
{{/if}}
- {{#if editPermitted}}
-
- {{/if}}
- {{/unless}}
- {{#if isCloud}}
-
- {{/if}}
-
- Loading roles . . .
-
-
+
+ Loading roles . . .
+
+
+
+
-
Sort By
-
+
+ {{/if}}
{{/zone}}
{{#zone "bottomJs"}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js
index 10121aa72d..145d39ee4e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js
@@ -33,6 +33,16 @@ function onRequest(context) {
context["adminRole"] = deviceMgtProps["adminRole"];
context["isCloud"] = deviceMgtProps["isCloud"];
+ var roleCount = userModule.getRolesCount()
+ if (deviceMgtProps["isCloud"]) {
+ roleCount = userModule.getFilteredRoles("devicemgt").content.count;
+ }
+
+ if (roleCount > 0) {
+ context["hasRoles"] = true;
+ } else {
+ context["hasRoles"] = false;
+ }
return context;
}
\ No newline at end of file