Fix api accessing issue

pull/250/head
Pramila Niroshan 1 year ago
parent 73c3a567f8
commit df2943ed1e

@ -40,7 +40,7 @@ import java.util.List;
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "DeviceStatusManagement"),
@ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/device-status-filter"),
@ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/device-status-filters"),
})
}
),
@ -55,14 +55,14 @@ import java.util.List;
description = "View device status details",
key = "dm:devicestatusfilter:view",
roles = {"Internal/devicemgt-user"},
permissions = {"/device-mgt/devicestatusfilter/view"}
permissions = {"/device-mgt/device-status-filters/view"}
),
@Scope(
name = "Update Device status filter",
description = "Updating Device status filter",
key = "dm:devicestatusfilter:update",
roles = {"Internal/devicemgt-user"},
permissions = {"/device-mgt/devicestatusfilter/update"}
permissions = {"/device-mgt/device-status-filters/update"}
),
}
)
@ -77,7 +77,12 @@ public interface DeviceStatusFilterService {
httpMethod = HTTPConstants.HEADER_GET,
value = "Get device status filters",
notes = "Get device status filters for the tenant of the logged in user",
tags = "Tenant Metadata Management"
tags = "Tenant Metadata Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "dm:devicestatusfilter:view")
})
}
)
@ApiResponses(
value = {
@ -114,7 +119,12 @@ public interface DeviceStatusFilterService {
httpMethod = HTTPConstants.HEADER_GET,
value = "Get device status filter",
notes = "Get device status filter enable or not for the tenant of the logged in user",
tags = "Tenant Metadata Management"
tags = "Tenant Metadata Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "dm:devicestatusfilter:view")
})
}
)
@ApiResponses(
value = {
@ -138,7 +148,7 @@ public interface DeviceStatusFilterService {
@ApiResponse(
code = 500,
message = "Internal Server Error. " +
"\n Server error occurred while getting white label artifact.",
"\n Server error occurred while getting device status check.",
response = ErrorResponse.class)
})
Response getDeviceStatusCheck();

@ -67,11 +67,7 @@ public class DeviceStatusFilterServiceImpl implements DeviceStatusFilterService
try {
DeviceStatusManagementService deviceManagementProviderService = DeviceMgtAPIUtils.getDeviceStatusManagmentService();
result = deviceManagementProviderService.getDeviceStatusCheck(tenantId);
if (result) {
return Response.status(Response.Status.OK).entity(true).build();
} else {
return Response.status(Response.Status.NO_CONTENT).entity(false).build();
}
return Response.status(Response.Status.OK).entity(result).build();
} catch (MetadataManagementException e) {
String msg = "Error occurred while getting device status filter of the tenant.";
log.error(msg, e);

Loading…
Cancel
Save