From 05f540abf1792f05f33fd6f5e745b242a0521b71 Mon Sep 17 00:00:00 2001 From: kamidu Date: Fri, 9 Sep 2016 17:48:26 +0530 Subject: [PATCH] permission modifications --- .../DeviceManagementAdminService.java | 50 +- .../services/DeviceManagementService.java | 12 +- .../DeviceTypeConfigurationService.java | 2 +- .../services/EventReceiverService.java | 4 +- .../src/main/webapp/META-INF/permissions.xml | 16 +- .../units/mdm.unit.policy.create/create.hbs | 526 +++++++++--------- .../units/mdm.unit.policy.create/create.js | 3 + .../app/units/mdm.unit.policy.edit/edit.hbs | 430 +++++++------- .../app/units/mdm.unit.policy.edit/edit.js | 4 + 9 files changed, 557 insertions(+), 490 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index 9775c721b..ac46bbc1f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -93,7 +93,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new lock operation.") }) - @Permission(name = "Lock Device", permission = "/device-mgt/devices/android/operations/lock") + @Permission(name = "Lock Device", permission = "/device-mgt/devices/owning/operations/android/lock") Response configureDeviceLock( @ApiParam(name = "deviceLockBeanWrapper", value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper); @@ -147,7 +147,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new un-lock operation.") }) - @Permission(name = "Unlock Device", permission = "/device-mgt/devices/android/operations/unlock") + @Permission(name = "Unlock Device", permission = "/device-mgt/devices/owning/operations/android/unlock") Response configureDeviceUnlock( @ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation") List deviceIDs); @@ -200,7 +200,7 @@ public interface DeviceManagementAdminService { code = 500, message = "Internal Server Error. \n " + "Server error occurred while adding a new get-location operation.")}) - @Permission(name = "Get Device Location", permission = "/device-mgt/devices/android/operations/location") + @Permission(name = "Get Device Location", permission = "/device-mgt/devices/owning/operations/android/location") Response getDeviceLocation( @ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location") List deviceIDs); @@ -253,7 +253,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new clear password operation.") }) - @Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/android/operations/clear-password") + @Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/owning/operations/android/clear-password") Response removePassword( @ApiParam(name = "deviceIDs", value = "DeviceIds to be requested to remove password") List deviceIDs); @@ -306,7 +306,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new control camera operation.") }) - @Permission(name = "Manage Camera", permission = "/device-mgt/devices/android/operations/camera") + @Permission(name = "Manage Camera", permission = "/device-mgt/devices/owning/operations/android/camera") Response configureCamera( @ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs") CameraBeanWrapper cameraBeanWrapper); @@ -362,7 +362,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device info operation.") }) - @Permission(name = "Get Device Information", permission = "/device-mgt/devices/android/operations/info") + @Permission(name = "Get Device Information", permission = "/device-mgt/devices/owning/operations/android/info") Response getDeviceInformation( @ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information") List deviceIDs); @@ -418,7 +418,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device logcat operation.") }) - @Permission(name = "Get Logs", permission = "/device-mgt/devices/android/operations/logcat") + @Permission(name = "Get Logs", permission = "/device-mgt/devices/owning/operations/android/logcat") Response getDeviceLogcat( @ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device logcat") List deviceIDs); @@ -472,7 +472,7 @@ public interface DeviceManagementAdminService { code = 500, message = "Internal Server Error. \n " + "Server error occurred while adding a enterprise wipe operation.")}) - @Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/android/operations/enterprise-wipe") + @Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/owning/operations/android/enterprise-wipe") Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe") List deviceIDs); @@ -524,7 +524,7 @@ public interface DeviceManagementAdminService { code = 500, message = "Internal Server Error. \n " + "Server error occurred while adding a device wipe operation.")}) - @Permission(name = "Factory Reset", permission = "/device-mgt/devices/android/operations/wipe") + @Permission(name = "Factory Reset", permission = "/device-mgt/devices/owning/operations/android/wipe") Response wipeData( @ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data") WipeDataBeanWrapper wipeDataBeanWrapper); @@ -581,7 +581,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new get-applications operation.") }) - @Permission(name = "Get Installed Application", permission = "/device-mgt/devices/android/operations/applications") + @Permission(name = "Get Installed Application", permission = "/device-mgt/devices/owning/operations/android/applications") Response getApplications( @ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed") List deviceIDs); @@ -634,7 +634,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device ring operation.") }) - @Permission(name = "Ring Device", permission = "/device-mgt/devices/android/operations/ring") + @Permission(name = "Ring Device", permission = "/device-mgt/devices/owning/operations/android/ring") Response ringDevice( @ApiParam(name = "deviceIDs", value = "Device Ids needed for ring") List deviceIDs); @@ -687,7 +687,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device reboot operation.") }) - @Permission(name = "Reboot Device", permission = "/device-mgt/devices/android/operations/reboot") + @Permission(name = "Reboot Device", permission = "/device-mgt/devices/owning/operations/android/reboot") Response rebootDevice( @ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.") List deviceIDs); @@ -740,7 +740,7 @@ public interface DeviceManagementAdminService { "Server error occurred while adding a new device mute operation.") }) @Path("/mute") - @Permission(name = "Mute Device", permission = "/device-mgt/devices/android/operations/mute") + @Permission(name = "Mute Device", permission = "/device-mgt/devices/owning/operations/android/mute") Response muteDevice( @ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted") List deviceIDs); @@ -796,7 +796,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new install-application operation.") }) - @Permission(name = "Install Applications", permission = "/device-mgt/devices/android/operations/install-app") + @Permission(name = "Install Applications", permission = "/device-mgt/devices/owning/operations/android/install-app") Response installApplication( @ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs") ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper); @@ -852,7 +852,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new update-application operation.") }) - @Permission(name = "Update installed applications", permission = "/device-mgt/devices/android/operations/update-app") + @Permission(name = "Update installed applications", permission = "/device-mgt/devices/owning/operations/android/update-app") Response updateApplication( @ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs") ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper); @@ -905,7 +905,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new uninstall-application operation.") }) - @Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/android/operations/uninstall-app") + @Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/owning/operations/android/uninstall-app") Response uninstallApplication( @ApiParam(name = "applicationUninstallationBeanWrapper", value = "applicationUninstallationConfigs and Device Ids") @@ -960,7 +960,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new blacklist-applications operation.") }) - @Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/android/operations/blacklist-app") + @Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/owning/operations/android/blacklist-app") Response blacklistApplications( @ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " + "Configuration and DeviceIds") @@ -1015,7 +1015,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new upgrade firmware operation.") }) - @Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/android/operations/upgrade") + @Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/owning/operations/android/upgrade") Response upgradeFirmware( @ApiParam(name = "upgradeFirmwareBeanWrapper", value = "Firmware upgrade configuration and DeviceIds") @@ -1070,7 +1070,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new configure VPN operation.") }) - @Permission(name = "Add VPN", permission = "/device-mgt/devices/android/operations/vpn") + @Permission(name = "Add VPN", permission = "/device-mgt/devices/owning/operations/android/vpn") Response configureVPN( @ApiParam(name = "vpnBeanWrapper", value = "VPN configuration and DeviceIds") @@ -1124,7 +1124,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new send notification operation.") }) - @Permission(name = "Send Notifications", permission = "/device-mgt/devices/android/operations/notification") + @Permission(name = "Send Notifications", permission = "/device-mgt/devices/owning/operations/android/notification") Response sendNotification( @ApiParam(name = "notificationBeanWrapper", value = "Notification Configurations and device Ids") @@ -1178,7 +1178,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new configure wifi operation.") }) - @Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/android/operations/wifi") + @Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/owning/operations/android/wifi") Response configureWifi( @ApiParam(name = "wifiBeanWrapper", value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper); @@ -1231,7 +1231,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new encrypt storage operation.") }) - @Permission(name = "Encrypt Device", permission = "/device-mgt/devices/android/operations/encrypt") + @Permission(name = "Encrypt Device", permission = "/device-mgt/devices/owning/operations/android/encrypt") Response encryptStorage( @ApiParam(name = "encryptionBeanWrapper", value = "Configurations and deviceIds need to be done data encryption") @@ -1285,7 +1285,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new change lock code operation.") }) - @Permission(name = "Change Password of Device", permission = "/device-mgt/devices/android/operations/change-lock") + @Permission(name = "Change Password of Device", permission = "/device-mgt/devices/owning/operations/android/change-lock") Response changeLockCode( @ApiParam(name = "lockCodeBeanWrapper", value = "Configurations and device Ids need to be done change lock code") @@ -1339,7 +1339,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new set password policy operation.") }) - @Permission(name = "Set Password Policy", permission = "/device-mgt/devices/android/operations/password-policy") + @Permission(name = "Set Password Policy", permission = "/device-mgt/devices/owning/operations/android/password-policy") Response setPasswordPolicy( @ApiParam(name = "passwordPolicyBeanWrapper", value = "Password Policy Configurations and Device Ids") @@ -1393,7 +1393,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new set webclip operation.") }) - @Permission(name = "Add Webclips", permission = "/device-mgt/devices/android/operations/webclip") + @Permission(name = "Add Webclips", permission = "/device-mgt/devices/owning/operations/android/webclip") Response setWebClip( @ApiParam(name = "webClipBeanWrapper", value = "Configurations to need set web clip on device and device Ids") diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java index f15055c52..c582886e9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java @@ -88,7 +88,7 @@ public interface DeviceManagementService { message = "Internal Server Error. \n " + "Server error occurred while updating the application list.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll") + @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") Response updateApplicationList( @ApiParam( name = "id", @@ -142,7 +142,7 @@ public interface DeviceManagementService { code = 500, message = "Internal Server Error. \n Server error occurred while fetching policies.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll") + @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") Response getPendingOperations( @ApiParam( name = "id", @@ -207,7 +207,7 @@ public interface DeviceManagementService { message = "Internal Server Error. \n " + "Server error occurred while adding a new policy.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll") + @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") @Valid AndroidDevice device); @@ -246,7 +246,7 @@ public interface DeviceManagementService { code = 500, message = "Internal Server Error. \n Server error occurred while fetching the enrollment status of the Android device.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll") + @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") Response isEnrolled( @ApiParam( name = "id", @@ -300,7 +300,7 @@ public interface DeviceManagementService { message = "Internal Server Error. \n " + "Server error occurred while updating the device enrollment.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll") + @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") Response modifyEnrollment( @ApiParam( name = "id", @@ -330,7 +330,7 @@ public interface DeviceManagementService { message = "Internal Server Error. \n " + "Server error occurred while dis-enrolling the device.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll") + @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") Response disEnrollDevice( @ApiParam( name = "id", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java index 9e590e85a..5b24c62be 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java @@ -180,7 +180,7 @@ public interface DeviceTypeConfigurationService { code = 500, message = "Internal Server Error. \n Server error occurred while fetching Android license configuration.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll") + @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") Response getLicense( @ApiParam( name = "If-Modified-Since", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java index 8d72e9ce7..2b2dd0d1e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java @@ -91,7 +91,7 @@ public interface EventReceiverService { message = "Internal Server Error. \n " + "Server error occurred while publishing events.") }) - @Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/android/events/manage") + @Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/enroll/android") Response publishEvents( @ApiParam( name = "eventBeanWrapper", @@ -141,7 +141,7 @@ public interface EventReceiverService { code = 500, message = "Error occurred while getting published events for specific device.") }) - @Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/android/events/manage") + @Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/enroll/android") Response retrieveAlerts( @ApiParam( name = "id", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml index d85ab6971..1ed463398 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml @@ -55,7 +55,7 @@ Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /configuration/license GET @@ -66,42 +66,42 @@ Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /devices POST Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /devices/* DELETE Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /devices/* PUT Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /devices/*/applications PUT Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /devices/*/pending-operations PUT Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /devices/*/status GET @@ -112,7 +112,7 @@ Enroll - /device-mgt/user/device/android/enroll + /device-mgt/user/device/enroll/android /events/publish POST diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.hbs index 61c0a85ce..be01bc306 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.hbs @@ -1,287 +1,305 @@ {{#zone "content"}} -
-
+ {{#if isAuthorized}} +
+
- + -