Implemented permission based authorization

revert-dabc3590
mharindu 8 years ago
parent 5900f4873d
commit cbae4e207d

@ -20,6 +20,7 @@ package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.mdm.services.android.bean.wrapper.*;
@ -92,7 +93,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new lock operation.")
})
@Scope(key = "device:android:operation:lock", name = "Lock device", description = "")
@Permission(name = "Lock Device", permission = "/device-mgt/devices/android/operations/lock")
Response configureDeviceLock(
@ApiParam(name = "deviceLockBeanWrapper",
value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper);
@ -146,7 +147,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new un-lock operation.")
})
@Scope(key = "device:android:operation:unlock", name = "Unlock device", description = "")
@Permission(name = "Unlock Device", permission = "/device-mgt/devices/android/operations/unlock")
Response configureDeviceUnlock(
@ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation")
List<String> deviceIDs);
@ -199,7 +200,7 @@ public interface DeviceManagementAdminService {
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a new get-location operation.")})
@Scope(key = "device:android:operation:location", name = "Get device location", description = "")
@Permission(name = "Get Device Location", permission = "/device-mgt/devices/android/operations/location")
Response getDeviceLocation(
@ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location")
List<String> deviceIDs);
@ -252,7 +253,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new clear password operation.")
})
@Scope(key = "device:android:operation:clear-password", name = "Clear password of device", description = "")
@Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/android/operations/clear-password")
Response removePassword(
@ApiParam(name = "deviceIDs",
value = "DeviceIds to be requested to remove password") List<String> deviceIDs);
@ -305,7 +306,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new control camera operation.")
})
@Scope(key = "device:android:operation:camera", name = "Enable/Disable camera", description = "")
@Permission(name = "Manage Camera", permission = "/device-mgt/devices/android/operations/camera")
Response configureCamera(
@ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs")
CameraBeanWrapper cameraBeanWrapper);
@ -361,19 +362,19 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device info operation.")
})
@Scope(key = "device:android:operation:info", name = "Get device information", description = "")
@Permission(name = "Get Device Information", permission = "/device-mgt/devices/android/operations/info")
Response getDeviceInformation(
@ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information")
List<String> deviceIDs);
@POST
@Path("/info")
@Path("/logcat")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Requesting Information from Android Devices",
notes = "Using this REST API you are able to request for Android device details. Once this REST API is" +
value = "Requesting logcat from Android Devices",
notes = "Using this REST API you are able to request for Android device log details. Once this REST API is" +
" executed it will be in the Android operation queue until the device calls the server to retrieve " +
"the list of operations that needs to be executed on the device",
response = Activity.class,
@ -417,6 +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")
Response getDeviceLogcat(
@ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device logcat")
List<String> deviceIDs);
@ -470,7 +472,7 @@ public interface DeviceManagementAdminService {
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a enterprise wipe operation.")})
@Scope(key = "device:android:operation:enterprise-wipe", name = "Enterprise wipe", description = "")
@Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/android/operations/enterprise-wipe")
Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe")
List<String> deviceIDs);
@ -522,7 +524,7 @@ public interface DeviceManagementAdminService {
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a device wipe operation.")})
@Scope(key = "device:android:operation:wipe", name = "Factory reset device", description = "")
@Permission(name = "Factory Reset", permission = "/device-mgt/devices/android/operations/wipe")
Response wipeData(
@ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data")
WipeDataBeanWrapper wipeDataBeanWrapper);
@ -579,7 +581,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new get-applications operation.")
})
@Scope(key = "device:android:operation:applications", name = "Get installed applications", description = "")
@Permission(name = "Get Installed Application", permission = "/device-mgt/devices/android/operations/applications")
Response getApplications(
@ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed")
List<String> deviceIDs);
@ -632,7 +634,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device ring operation.")
})
@Scope(key = "device:android:operation:ring", name = "Ring device", description = "")
@Permission(name = "Ring Device", permission = "/device-mgt/devices/android/operations/ring")
Response ringDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for ring")
List<String> deviceIDs);
@ -685,7 +687,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device reboot operation.")
})
@Scope(key = "device:android:operation:reboot", name = "Reboot device", description = "")
@Permission(name = "Reboot Device", permission = "/device-mgt/devices/android/operations/reboot")
Response rebootDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.")
List<String> deviceIDs);
@ -738,7 +740,7 @@ public interface DeviceManagementAdminService {
"Server error occurred while adding a new device mute operation.")
})
@Path("/mute")
@Scope(key = "device:android:operation:mute", name = "Mute device", description = "")
@Permission(name = "Mute Device", permission = "/device-mgt/devices/android/operations/mute")
Response muteDevice(
@ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted")
List<String> deviceIDs);
@ -794,7 +796,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new install-application operation.")
})
@Scope(key = "device:android:operation:install-app", name = "Install applications", description = "")
@Permission(name = "Install Applications", permission = "/device-mgt/devices/android/operations/install-app")
Response installApplication(
@ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs")
ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper);
@ -850,7 +852,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new update-application operation.")
})
@Scope(key = "device:android:operation:update-app", name = "Update installed applications", description = "")
@Permission(name = "Update installed applications", permission = "/device-mgt/devices/android/operations/update-app")
Response updateApplication(
@ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs")
ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper);
@ -903,7 +905,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new uninstall-application operation.")
})
@Scope(key = "device:android:operation:uninstall-app", name = "Uninstall applications", description = "")
@Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/android/operations/uninstall-app")
Response uninstallApplication(
@ApiParam(name = "applicationUninstallationBeanWrapper",
value = "applicationUninstallationConfigs and Device Ids")
@ -958,7 +960,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new blacklist-applications operation.")
})
@Scope(key = "device:android:operation:blacklist-app", name = "Blacklist applications", description = "")
@Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/android/operations/blacklist-app")
Response blacklistApplications(
@ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " +
"Configuration and DeviceIds")
@ -1013,7 +1015,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new upgrade firmware operation.")
})
@Scope(key = "device:android:operation:upgrade", name = "Upgrade firmware", description = "")
@Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/android/operations/upgrade")
Response upgradeFirmware(
@ApiParam(name = "upgradeFirmwareBeanWrapper",
value = "Firmware upgrade configuration and DeviceIds")
@ -1068,7 +1070,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new configure VPN operation.")
})
@Scope(key = "device:android:operation:vpn", name = "Add VPN profiles", description = "")
@Permission(name = "Add VPN", permission = "/device-mgt/devices/android/operations/vpn")
Response configureVPN(
@ApiParam(name = "vpnBeanWrapper",
value = "VPN configuration and DeviceIds")
@ -1122,7 +1124,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new send notification operation.")
})
@Scope(key = "device:android:operation:notification", name = "Send notifications", description = "")
@Permission(name = "Send Notifications", permission = "/device-mgt/devices/android/operations/notification")
Response sendNotification(
@ApiParam(name = "notificationBeanWrapper",
value = "Notification Configurations and device Ids")
@ -1176,7 +1178,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new configure wifi operation.")
})
@Scope(key = "device:android:operation:wifi", name = "Add WiFi configurations", description = "")
@Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/android/operations/wifi")
Response configureWifi(
@ApiParam(name = "wifiBeanWrapper",
value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper);
@ -1229,7 +1231,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new encrypt storage operation.")
})
@Scope(key = "device:android:operation:encrypt", name = "Encrypt device", description = "")
@Permission(name = "Encrypt Device", permission = "/device-mgt/devices/android/operations/encrypt")
Response encryptStorage(
@ApiParam(name = "encryptionBeanWrapper",
value = "Configurations and deviceIds need to be done data encryption")
@ -1283,7 +1285,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new change lock code operation.")
})
@Scope(key = "device:android:operation:change-lock", name = "Change password of device", description = "")
@Permission(name = "Change Password of Device", permission = "/device-mgt/devices/android/operations/change-lock")
Response changeLockCode(
@ApiParam(name = "lockCodeBeanWrapper",
value = "Configurations and device Ids need to be done change lock code")
@ -1337,7 +1339,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new set password policy operation.")
})
@Scope(key = "device:android:operation:password-policy", name = "Set password policy", description = "")
@Permission(name = "Set Password Policy", permission = "/device-mgt/devices/android/operations/password-policy")
Response setPasswordPolicy(
@ApiParam(name = "passwordPolicyBeanWrapper",
value = "Password Policy Configurations and Device Ids")
@ -1391,7 +1393,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new set webclip operation.")
})
@Scope(key = "device:android:operation:webclip", name = "Add webclips", description = "")
@Permission(name = "Add Webclips", permission = "/device-mgt/devices/android/operations/webclip")
Response setWebClip(
@ApiParam(name = "webClipBeanWrapper",
value = "Configurations to need set web clip on device and device Ids")

@ -20,6 +20,7 @@ package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication;
@ -87,7 +88,7 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " +
"Server error occurred while updating the application list.")
})
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll")
Response updateApplicationList(
@ApiParam(
name = "id",
@ -141,7 +142,7 @@ public interface DeviceManagementService {
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching policies.")
})
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll")
Response getPendingOperations(
@ApiParam(
name = "id",
@ -206,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")
Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll")
@Valid AndroidDevice device);
@ -245,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.")
})
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll")
Response isEnrolled(
@ApiParam(
name = "id",
@ -299,7 +300,7 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " +
"Server error occurred while updating the device enrollment.")
})
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll")
Response modifyEnrollment(
@ApiParam(
name = "id",
@ -329,7 +330,7 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " +
"Server error occurred while dis-enrolling the device.")
})
@Scope(key = "device:android:disenroll", name = "Enroll Android device", description = "")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll")
Response disEnrollDevice(
@ApiParam(
name = "id",

@ -20,6 +20,7 @@ package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration;
@ -81,7 +82,7 @@ public interface DeviceTypeConfigurationService {
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Android platform configuration.")
})
@Scope(key = "configuration:view", name = "View configurations", description = "")
@Permission(name = "View Configurations", permission = "/device-mgt/configurations/view")
Response getConfiguration(
@ApiParam(
name = "If-Modified-Since",
@ -131,7 +132,7 @@ public interface DeviceTypeConfigurationService {
message = "Internal Server Error. \n " +
"Server error occurred while modifying Android platform configuration.")
})
@Scope(key = "configuration:manage", name = "Add configurations", description = "")
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
Response updateConfiguration(
@ApiParam(name = "configuration",
value = "AndroidPlatformConfiguration")
@ -179,7 +180,7 @@ public interface DeviceTypeConfigurationService {
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Android license configuration.")
})
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/android/enroll")
Response getLicense(
@ApiParam(
name = "If-Modified-Since",

@ -20,6 +20,7 @@ package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper;
@ -90,7 +91,7 @@ public interface EventReceiverService {
message = "Internal Server Error. \n " +
"Server error occurred while publishing events.")
})
@Scope(key = "device:android:event:manage", name = "Publish events to DAS", description = "")
@Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/android/events/manage")
Response publishEvents(
@ApiParam(
name = "eventBeanWrapper",
@ -140,7 +141,7 @@ public interface EventReceiverService {
code = 500,
message = "Error occurred while getting published events for specific device.")
})
@Scope(key = "device:android:event:read", name = "View events", description = "")
@Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/android/events/manage")
Response retrieveAlerts(
@ApiParam(
name = "id",

@ -19,6 +19,7 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
@ -49,7 +50,7 @@ public interface ConfigurationMgtService {
* @throws WindowsConfigurationException
*/
@POST
@Scope(key = "configuration:manage", name = "Add configurations", description = "")
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
Message ConfigureSettings(PlatformConfiguration configuration) throws WindowsConfigurationException;
/**
@ -59,7 +60,7 @@ public interface ConfigurationMgtService {
* @throws WindowsConfigurationException
*/
@GET
@Scope(key = "configuration:view", name = "View configurations", description = "")
@Permission(name = "View Configurations", permission = "/device-mgt/configurations/view")
PlatformConfiguration getConfiguration() throws WindowsConfigurationException;
/**
@ -70,6 +71,6 @@ public interface ConfigurationMgtService {
* @throws WindowsConfigurationException
*/
@PUT
@Scope(key = "configuration:manage", name = "Add configurations", description = "")
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException;
}

Loading…
Cancel
Save