Add permission for global proxy operation & refactor

Refactored API path for global-proxy operation and add permissions and scopes to the API
revert-dabc3590
Madawa Soysa 6 years ago committed by Madawa Soysa
parent 8b2a5f5157
commit 9c220a5b44

@ -210,6 +210,12 @@ import java.util.List;
key = "perm:android:configure-wifi",
permissions = {"/device-mgt/devices/owning-device/operations/android/wifi"}
),
@Scope(
name = "Configure Global Proxy",
description = "Configure Global Proxy on Android Device",
key = "perm:android:configure-global-proxy",
permissions = {"/device-mgt/devices/owning-device/operations/android/global-proxy"}
),
@Scope(
name = "Encrypt Storage",
description = "Encrypting storage on Android Device",
@ -1852,7 +1858,7 @@ public interface DeviceManagementAdminService {
WebClipBeanWrapper webClipBeanWrapper);
@POST
@Path("/set-global-proxy")
@Path("/configure-global-proxy")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
@ -1863,14 +1869,15 @@ public interface DeviceManagementAdminService {
tags = "Android Device Management Administrative Service",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:set-global-proxy")
@ExtensionProperty(name = AndroidConstants.SCOPE,
value = "perm:android:configure-global-proxy")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 201,
message = "Created. \n Successfully scheduled the set global proxy operation.",
message = "Created. \n Successfully scheduled the global proxy operation.",
response = Activity.class,
responseHeaders = {
@ResponseHeader(

@ -977,16 +977,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
}
@POST
@Path("/set-global-proxy")
@Path("/configure-global-proxy")
@Override
public Response setRecommendedGlobalProxy(GlobalProxyBeanWrapper globalProxyBeanWrapper) {
if (log.isDebugEnabled()) {
log.debug("Invoking 'set-global-proxy' operation");
log.debug("Invoking 'configure-global-proxy' operation");
}
try {
if (globalProxyBeanWrapper == null || globalProxyBeanWrapper.getOperation() == null) {
String errorMessage = "The payload of the set global proxy operation is incorrect";
String errorMessage = "The payload of the global proxy operation is incorrect";
log.error(errorMessage);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build());

@ -460,7 +460,7 @@ var androidOperationModule = function () {
publicMethods.getAndroidServiceEndpoint = function (operationCode) {
var featureMap = {
"WIFI": "configure-wifi",
"GLOBAL_PROXY": "set-global-proxy",
"GLOBAL_PROXY": "configure-global-proxy",
"CAMERA": "control-camera",
"VPN": "configure-vpn",
"DEVICE_LOCK": "lock-devices",

@ -13,6 +13,7 @@
"perm:android:lock-devices",
"perm:android:configure-vpn",
"perm:android:configure-wifi",
"perm:android:configure-global-proxy",
"perm:android:enroll",
"perm:android:uninstall-application",
"perm:android:manage-configuration",

Loading…
Cancel
Save