diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/GroupImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/GroupImpl.java index 4c47f1b35b0..ebe9228c31b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/GroupImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/GroupImpl.java @@ -118,7 +118,7 @@ public class GroupImpl implements Group { @Override @GET @Produces("application/json") - public Response getGroups(@QueryParam("start") int startIndex, @PathParam("length") int length) { + public Response getGroups(@QueryParam("start") int startIndex, @QueryParam("length") int length) { try { PaginationResult paginationResult = DeviceMgtAPIUtils.getGroupManagementProviderService() .getGroups(startIndex, length); @@ -331,8 +331,7 @@ public class GroupImpl implements Group { @Produces("application/json") public Response addSharing(@QueryParam("shareUser") String shareUser, @PathParam("groupName") String groupName, @PathParam("owner") String owner, - @PathParam("roleName") String roleName, - @FormParam("permissions") String[] permissions) { + @PathParam("roleName") String roleName, String[] permissions) { try { boolean isAdded = DeviceMgtAPIUtils.getGroupManagementProviderService().addGroupSharingRole( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/PolicyImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/PolicyImpl.java index a1c84a0d05b..5947b5ec4a8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/PolicyImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/api/impl/PolicyImpl.java @@ -21,6 +21,11 @@ package org.wso2.carbon.device.mgt.jaxrs.api.impl; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException; import org.wso2.carbon.device.mgt.jaxrs.api.util.DeviceMgtAPIUtils; import org.wso2.carbon.device.mgt.jaxrs.beans.PriorityUpdatedPolicyWrapper; @@ -97,6 +102,22 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy { private Response addPolicy(PolicyManagerService policyManagementService, ResponsePayload responseMsg, org.wso2.carbon.policy.mgt.common.Policy policy) { + List devices = policy.getDevices(); + if (devices != null && devices.size() == 1) { + DeviceAccessAuthorizationService deviceAccessAuthorizationService = DeviceManagementDataHolder.getInstance().getDeviceAccessAuthorizationService(); + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(devices.get(0).getDeviceIdentifier(), devices.get(0).getType()); + PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + String username = threadLocalCarbonContext.getUsername(); + try { + if (!deviceAccessAuthorizationService.isUserAuthorized(deviceIdentifier, username)) { + return Response.status(Response.Status.UNAUTHORIZED).build(); + } + } catch (DeviceAccessAuthorizationException e) { + String msg = "Device access authorization exception"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } try { PolicyAdministratorPoint pap = policyManagementService.getPAP(); pap.addPolicy(policy); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml index 89aa3f02f24..ca4664f9cb6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml @@ -669,6 +669,12 @@ /policies/inactive-policy POST + + Add Policy + /device-mgt/user/policies/add + /policies/inactive-policy + POST + List policies @@ -704,6 +710,12 @@ /policies/active-policy POST + + Add Policy + /device-mgt/user/policies/add + /policies/inactive-policy + POST + Remove policy @@ -726,6 +738,20 @@ GET + + List user policies + /device-mgt/user/policies/list + /policies + GET + + + + List user policies + /device-mgt/user/policies/list + /policies/* + GET + + Update policy /device-mgt/admin/policies/update diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag index 2dc839f9077..05364453b5b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag @@ -147,7 +147,7 @@ if (uriMatcher.match("/{context}/api/user/authenticate")) { lastname = addUserFormData.lastname; emailAddress = addUserFormData.emailAddress; password = addUserFormData.password; - userRoles = ["devicemgt-user"]; + userRoles = ["internal/devicemgt-user"]; try { result = userModule.registerUser(username, firstname, lastname, emailAddress, password, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js index 2aa4bc8f625..9474dd26976 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js @@ -28,6 +28,7 @@ var userModule = require("/app/modules/user.js")["userModule"]; var utility = require("/app/modules/utility.js")["utility"]; var permissions = { - '/permission/admin/device-mgt/user': ['ui.execute'] + '/permission/admin/device-mgt/user': ['ui.execute'], + '/permission/admin/device-mgt/api/application': ['ui.execute'] }; -userModule.addRole("devicemgt-user", ["admin"], permissions); +userModule.addRole("internal/devicemgt-user", ["admin"], permissions); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js index bca48a0362c..b0eb98c5548 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js @@ -668,6 +668,9 @@ var userModule = function () { if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/roles/add")) { permissions["ADD_ROLE"] = true; } + if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/policies/add")) { + permissions["ADD_ADMIN_POLICY"] = true; + } if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/policies/add")) { permissions["ADD_POLICY"] = true; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs index 7fc77538b0c..b8fdc158ab0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.hbs @@ -34,19 +34,34 @@ {{#zone "content"}}
-
-
-

{{groupName}} Analytics

+ {{#if deviceTypes}} +
+ {{unit "cdmf.unit.analytics.date-range-picker" deviceTypes=deviceTypes}}
- {{unit "cdmf.unit.analytics.date-range-picker" deviceTypes=deviceTypes}} -
-
-
-
- {{#each deviceTypes}} - {{unit deviceAnalyticsViewUnitName devices=devices}} - {{/each}} -
+
+
+
+ {{#each deviceTypes}} + {{unit deviceAnalyticsViewUnitName devices=devices}} + {{/each}} +
+ {{else}} +
+ +
+ {{/if}}
{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js index 64173b06c80..563660dadb2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.analytics/analytics.js @@ -21,31 +21,35 @@ function onRequest(context) { var groupModule = require("/app/modules/group.js").groupModule; var groupName = context.uriParams.name; var groupOwner = context.uriParams.owner; - var deviceTypes = []; var devices = groupModule.getGroupDevices(groupName, groupOwner).data; - - for (var i = 0; i < devices.length; i++) { - var hasDeviceType = false; - for (var j = 0; j < deviceTypes.length; j++) { - if (deviceTypes[j].type === devices[i].type) { - deviceTypes[j].devices.push(devices[i]); - hasDeviceType = true; - break; + var page = { + "groupName": groupName, + "groupOwner": groupOwner, + "title": groupName + " Analytics" + }; + if (devices) { + var deviceTypes = []; + for (var i = 0; i < devices.length; i++) { + var hasDeviceType = false; + for (var j = 0; j < deviceTypes.length; j++) { + if (deviceTypes[j].type === devices[i].type) { + deviceTypes[j].devices.push(devices[i]); + hasDeviceType = true; + break; + } + } + if (!hasDeviceType) { + var deviceType = {}; + deviceType.type = devices[i].type; + deviceType.devices = []; + deviceType.devices.push(devices[i]); + deviceType.deviceAnalyticsViewUnitName = utility.getTenantedDeviceUnitName(deviceType.type, "analytics-view"); + deviceTypes.push(deviceType); } } - if (!hasDeviceType) { - var deviceType = {}; - deviceType.type = devices[i].type; - deviceType.devices = []; - deviceType.devices.push(devices[i]); - deviceType.deviceAnalyticsViewUnitName = utility.getTenantedDeviceUnitName(deviceType.type, "analytics-view"); - deviceTypes.push(deviceType); - } + page.deviceTypes = deviceTypes; + page.devices = devices; } - return { - "groupName": groupName, - "groupOwner": groupOwner, - "deviceTypes": deviceTypes - }; + return page; } 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 55117a4cf06..6a12ef4f905 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 @@ -1,7 +1,14 @@ {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} - {{unit "cdmf.unit.data-tables-extended"}} +{{#zone "topCss"}} + +{{/zone}} + {{#zone "breadcrumbs"}}
  • @@ -16,24 +23,30 @@ {{/zone}} {{#zone "navbarActions"}} -
  • - + {{#if permissions.ADD_ADMIN_POLICY}} +
  • + - Add Policy - -
  • -
  • - - - - - - Policy Priority - -
  • + Add Policy + + + {{/if}} + {{#if permissions.CHANGE_POLICY_PRIORITY}} + {{#equal noPolicy false}} +
  • + + + + + + Policy Priority + +
  • + {{/equal}} + {{/if}}
  • @@ -46,5 +59,565 @@ {{/zone}} {{#zone "content"}} - {{unit "cdmf.unit.policy.listing"}} + {{#equal noPolicy true}} + + {{/equal}} + {{#equal noPolicy false}} + {{#equal isUpdated true}} + + {{/equal}} +
    + + Loading policies . . . +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{#each policyListToView}} + + + + + + + + + + + + {{/each}} +
    + + + {{/equal}} +
    + + + +
    +
    +
    +
    +

    Do you really want to remove the selected policy(s)?

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    Done. Selected policy was successfully removed.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    An unexpected error occurred. Please try again later.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    You cannot remove policies that are already applied to devices. Please deselect + them and try + again.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    Do you really want to publish the selected policy(s)?

    + +
    + Yes + No +
    +
    +
    +
    +
    + +
    +
    +
    +
    +

    Done. Selected policy was successfully published.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    An unexpected error occurred. Please try again later.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    Do you really want to unpublish the selected policy(s)?

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    Done. Selected policy was successfully unpublished.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    An unexpected error occurred. Please try again later.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    Done. New Policy priorities were successfully updated.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    An unexpected error occurred. Please try again later.

    +

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    Do you really want to apply changes to all policies?

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    Done. Changes applied successfully.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    An unexpected error occurred. Please try again later.

    + + +
    +
    +
    +
    + +
    +
    +
    +
    +

    + + + + + Operation cannot be performed ! +

    +

    + Please select a policy or a list of policies to unpublish. +

    + + +
    +
    +
    +
    +
    +
    +
    +
    +

    + + + + + Operation cannot be performed ! +

    +

    + You cannot select already inactive policies. Please deselect inactive policies + and try again. +

    + + +
    +
    +
    +
    +
    +
    +
    +
    +

    + + + + + Operation cannot be performed ! +

    +

    + You cannot select already active policies. Please deselect active policies and + try again. +

    + + +
    +
    +
    +
    +
    +
    +
    +
    +

    + + + + + Operation cannot be performed ! +

    +

    + Please select a policy or a list of policies to publish. +

    + + +
    +
    +
    +
    +
    +
    +
    +
    +

    + + + + + Operation cannot be performed ! +

    +

    + Please select a policy or a list of policies to remove. +

    + + +
    +
    +
    +
    +{{/zone}} + +{{#zone "bottomJs"}} + {{js "js/policy-list.js"}} {{/zone}} \ 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.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js index ccc71cc1504..b21d376f06a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.js @@ -16,14 +16,55 @@ * under the License. */ -function onRequest(context){ +function onRequest(context) { context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { - if (arguments.length < 3) + if (arguments.length < 3) { throw new Error("Handlebars Helper equal needs 2 parameters"); - if( lvalue!=rvalue ) { + } + if (lvalue != rvalue) { return options.inverse(this); } else { return options.fn(this); } }); -} \ No newline at end of file + var page = {}; + var policyModule = require("/app/modules/policy.js")["policyModule"]; + var userModule = require("/app/modules/user.js")["userModule"]; + var response = policyModule.getAllPolicies(); + if (response["status"] == "success") { + var policyListToView = response["content"]; + page["policyListToView"] = policyListToView; + var policyCount = policyListToView.length; + if (policyCount == 0) { + page["policyListingStatusMsg"] = "No policy is available to be displayed."; + page["saveNewPrioritiesButtonEnabled"] = false; + page["noPolicy"] = true; + } else if (policyCount == 1) { + page["saveNewPrioritiesButtonEnabled"] = false; + page["noPolicy"] = false; + page["isUpdated"] = response["updated"]; + } else { + page["saveNewPrioritiesButtonEnabled"] = true; + page["noPolicy"] = false; + page["isUpdated"] = response["updated"]; + } + } else { + // here, response["status"] == "error" + page["policyListToView"] = []; + page["policyListingStatusMsg"] = "An unexpected error occurred @ backend. Please try again later."; + page["saveNewPrioritiesButtonEnabled"] = false; + page["noPolicy"] = true; + } + + if (userModule.isAuthorized("/permission/admin/device-mgt/policies/delete")) { + page["removePermitted"] = true; + } + if (userModule.isAuthorized("/permission/admin/device-mgt/policies/remove")) { + page["removePermitted"] = true; + } + if (userModule.isAuthorized("/permission/admin/device-mgt/policies/update")) { + page["editPermitted"] = true; + } + page.permissions = userModule.getUIPermissions(); + return page; +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/public/js/policy-list.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/public/js/policy-list.js rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js index 3963ffeba18..cff14da8955 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js @@ -264,7 +264,6 @@ $(document).ready(function () { // Refreshing with success message $("#user-create-form").addClass("hidden"); $("#user-created-msg").removeClass("hidden"); - generateQRCode("#user-created-msg .qr-code"); } else if (data["statusCode"] == 409) { $(errorMsg).text(data["messageFromServer"]); $(errorMsgWrapper).removeClass("hidden"); @@ -273,6 +272,7 @@ $(document).ready(function () { $(errorMsgWrapper).removeClass("hidden"); } }, function (data) { + data = JSON.parse(data.responseText); if (data["statusCode"] == 409) { $(errorMsg).text("User : " + username + " already exists. Pick another username."); } else if (data["statusCode"] == 500) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/operation-mod.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/operation-mod.json index d6642342f13..688e939808b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/operation-mod.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/operation-mod.json @@ -1,7 +1,3 @@ { - "version": "1.0.0", - "pushedUris": [ - "/policies", - "/policy/{+any}" - ] + "version": "1.0.0" } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs index 6a2d8e035c4..ecf3aedacfb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs @@ -22,7 +22,7 @@
    3
    - +

    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.hbs deleted file mode 100644 index 257f17fae12..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.hbs +++ /dev/null @@ -1,550 +0,0 @@ -{{#zone "topCss"}} - -{{/zone}} -{{#equal isUpdated true}} - -{{/equal}} -
    - - Loading policies . . . -
    -
    - -{{#equal noPolicy false}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{#each policyListToView}} - - - - - - - - - - - - {{/each}} -
    - - -{{/equal}} -
    - - - -
    -
    -
    -
    -

    Do you really want to remove the selected policy(s)?

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Done. Selected policy was successfully removed.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    You cannot remove policies that are already applied to devices. Please deselect - them and try - again.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Do you really want to publish the selected policy(s)?

    - -
    - Yes - No -
    -
    -
    -
    -
    - -
    -
    -
    -
    -

    Done. Selected policy was successfully published.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Do you really want to unpublish the selected policy(s)?

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Done. Selected policy was successfully unpublished.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Done. New Policy priorities were successfully updated.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    -

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Do you really want to apply changes to all policies?

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    Done. Changes applied successfully.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    - - -
    -
    -
    -
    - -
    -
    -
    -
    -

    - - - - - Operation cannot be performed ! -

    -

    - Please select a policy or a list of policies to unpublish. -

    - - -
    -
    -
    -
    -
    -
    -
    -
    -

    - - - - - Operation cannot be performed ! -

    -

    - You cannot select already inactive policies. Please deselect inactive policies - and try again. -

    - - -
    -
    -
    -
    -
    -
    -
    -
    -

    - - - - - Operation cannot be performed ! -

    -

    - You cannot select already active policies. Please deselect active policies and - try again. -

    - - -
    -
    -
    -
    -
    -
    -
    -
    -

    - - - - - Operation cannot be performed ! -

    -

    - Please select a policy or a list of policies to publish. -

    - - -
    -
    -
    -
    -
    -
    -
    -
    -

    - - - - - Operation cannot be performed ! -

    -

    - Please select a policy or a list of policies to remove. -

    - - -
    -
    -
    -
    - - -{{#zone "bottomJs"}} - {{js "js/policy-list.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.js deleted file mode 100644 index b3c27be6cd4..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -function onRequest(context) { - // var log = new Log("policy-listing.js"); - var policyModule = require("/app/modules/policy.js")["policyModule"]; - var userModule = require("/app/modules/user.js")["userModule"]; - var response = policyModule.getAllPolicies(); - if (response["status"] == "success") { - var policyListToView = response["content"]; - context["policyListToView"] = policyListToView; - var policyCount = policyListToView.length; - if (policyCount == 0) { - context["policyListingStatusMsg"] = "No policy is available to be displayed."; - context["saveNewPrioritiesButtonEnabled"] = false; - context["noPolicy"] = true; - } else if (policyCount == 1) { - context["saveNewPrioritiesButtonEnabled"] = false; - context["noPolicy"] = false; - context["isUpdated"] = response["updated"]; - } else { - context["saveNewPrioritiesButtonEnabled"] = true; - context["noPolicy"] = false; - context["isUpdated"] = response["updated"]; - } - } else { - // here, response["status"] == "error" - context["policyListToView"] = []; - context["policyListingStatusMsg"] = "An unexpected error occurred @ backend. Please try again later."; - context["saveNewPrioritiesButtonEnabled"] = false; - context["noPolicy"] = true; - } - - if (userModule.isAuthorized("/permission/admin/device-mgt/policies/delete")) { - context["removePermitted"] = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/policies/remove")) { - context["removePermitted"] = true; - } - if (userModule.isAuthorized("/permission/admin/device-mgt/policies/update")) { - context["editPermitted"] = true; - } - - return context; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.json deleted file mode 100644 index ec74a2db536..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs index db5498211f7..830b0fb2e50 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs @@ -29,7 +29,7 @@ - +
    +