From e80daf7709e3db73b6e0b1dd108cca09da1d999a Mon Sep 17 00:00:00 2001 From: thusithakalugamage Date: Thu, 8 Sep 2016 12:29:49 +0530 Subject: [PATCH 1/6] responsive small device view defect fixes --- .../uuf.unit.theme/public/css/theme-wso2.css | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css index 5fe5c2e37d..7d570d33e0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css @@ -5398,6 +5398,9 @@ button.close { -moz-border-radius: 0; border-radius: 0; } +.panel-body .message { + margin:0px; +} .message h4 { margin-top: 0; margin-bottom: 5px; @@ -7438,17 +7441,13 @@ ul.sidebar-messages > li { * ======================================================================== */ .body-wrapper { padding: 40px; + margin-bottom:40px; } .body-wrapper a.btn:hover,.body-wrapper a:hover { text-decoration: none; } -@media (max-width: 767px) { - .body-wrapper { - padding: 40px 0px; - } -} .page-header { margin: 0 0 20px; } @@ -7791,9 +7790,16 @@ ul.sidebar-messages > li { background: transparent; font-size: 24px; font-weight: 300; - border-bottom: 1px solid #e4e4e4; - padding-bottom: 10px; - margin-bottom: 20px; +} + +.panel-default > .panel-heading a[data-toggle="collapse"]{ + display:block; + padding:10px; +} +.media.tab-responsive .panel-group .panel-heading + .panel-collapse > .panel-body, +.media.tab-responsive .panel-group .panel-heading + .panel-collapse > .list-group{ + border:none; + border-top:1px solid #ddd; } /* ======================================================================== @@ -8321,7 +8327,6 @@ a.list-group-item:hover { border-style: solid; border-color: #ddd; padding: 20px; - min-height: 300px; } From 2fde165b7c40de81dc3c68a638dd76fa0a144727 Mon Sep 17 00:00:00 2001 From: charitha Date: Thu, 8 Sep 2016 14:46:01 +0530 Subject: [PATCH 2/6] Fix SQL error when could happen due to duplicate enrollments. (cherry picked from commit c75307f) --- .../device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 1ecdb88459..44062cffc7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -763,10 +763,9 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { ResultSet rs = null; try { conn = this.getConnection(); - String sql = "SELECT ID AS ENROLMENT_ID FROM DM_ENROLMENT WHERE DEVICE_ID = (SELECT DISTINCT d.ID " + - "FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID " + - "AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) " + - "AND STATUS = ? AND TENANT_ID = ?"; + String sql = "SELECT e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, DM_DEVICE_TYPE t " + + "WHERE d.DEVICE_TYPE_ID = t.ID AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) dtm " + + "WHERE e.DEVICE_ID = dtm.ID AND e.STATUS = ? AND e.TENANT_ID = ?;"; stmt = conn.prepareStatement(sql); stmt.setString(1, deviceId.getId()); stmt.setString(2, deviceId.getType()); From 411641bc57704c62b26f07f59827057e631cdc7b Mon Sep 17 00:00:00 2001 From: kamidu Date: Thu, 8 Sep 2016 18:41:51 +0530 Subject: [PATCH 3/6] Enable permission check according to the new permissions --- .../cdmf.page.certificate.create/create.js | 24 ++++---- .../cdmf.page.certificates/certificates.js | 15 ++--- .../app/pages/cdmf.page.policies/policies.hbs | 8 +-- .../app/pages/cdmf.page.policies/policies.js | 9 +-- .../pages/cdmf.page.user.create/create.hbs | 9 +++ .../app/pages/cdmf.page.user.create/create.js | 3 + .../app/pages/cdmf.page.user.edit/edit.hbs | 11 +++- .../app/pages/cdmf.page.user.edit/edit.js | 4 ++ .../app/pages/cdmf.page.user.view/view.hbs | 9 +++ .../app/pages/cdmf.page.user.view/view.js | 7 ++- .../app/pages/cdmf.page.users/users.hbs | 59 +++++++++++-------- .../app/pages/cdmf.page.users/users.js | 17 ++---- .../cdmf.unit.notification.listing/listing.js | 2 +- .../configuration.hbs | 9 +++ .../configuration.js | 9 ++- 15 files changed, 120 insertions(+), 75 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js index 4e7585163a..6244fc1f09 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.js @@ -19,8 +19,8 @@ /** * Returns the dynamic state to be populated by add-user page. * - * @param context Object that gets updated with the dynamic state of this page to be presented - * @returns {*} A context object that returns the dynamic state of this page to be presented + * @param viewModel Object that gets updated with the dynamic state of this page to be presented + * @returns {*} A viewModel object that returns the dynamic state of this page to be presented */ function onRequest(context) { // var log = new Log("units/user-create/create.js"); @@ -29,17 +29,17 @@ function onRequest(context) { var response = userModule.getRolesByUserStore(); if (response["status"] == "success") { - context["roles"] = response["content"]; + viewModel["roles"] = response["content"]; } - context["charLimit"] = mdmProps["usernameLength"]; - context["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"]; - context["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"]; - context["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; - context["firstnameJSRegEx"] = mdmProps["userValidationConfig"]["firstnameJSRegEx"]; - context["firstnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"]; - context["lastnameJSRegEx"] = mdmProps["userValidationConfig"]["lastnameJSRegEx"]; - context["lastnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"]; + viewModel["charLimit"] = mdmProps["usernameLength"]; + viewModel["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"]; + viewModel["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"]; + viewModel["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; + viewModel["firstnameJSRegEx"] = mdmProps["userValidationConfig"]["firstnameJSRegEx"]; + viewModel["firstnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"]; + viewModel["lastnameJSRegEx"] = mdmProps["userValidationConfig"]["lastnameJSRegEx"]; + viewModel["lastnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"]; - return context; + return viewModel; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js index 8aeb02353e..a4be059e94 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.js @@ -1,15 +1,16 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; + var viewModel = {}; - context["permissions"] = userModule.getUIPermissions(); - if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/certificate/Get")) { - context["removePermitted"] = true; + if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/manage")) { + viewModel["removePermitted"] = true; } - if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/certificate/Get")) { - context["viewPermitted"] = true; + if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/view")) { + viewModel["viewPermitted"] = true; } - context["adminUser"] = mdmProps.adminUser; - return context; + + viewModel.adminUser = mdmProps.adminUser; + return viewModel; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs index 2dcfb0122e..9a3a113791 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs @@ -40,7 +40,7 @@ {{/zone}} {{#zone "navbarActions"}} - {{#if permissions.ADD_ADMIN_POLICY}} + {{#if managePermitted}}
  • @@ -50,8 +50,6 @@ Add Policy
  • - {{/if}} - {{#if permissions.CHANGE_POLICY_PRIORITY}} {{#equal noPolicy false}}
  • @@ -81,7 +79,7 @@