Showing
1 changed file
with
11 additions
and
2 deletions
@@ -97,6 +97,7 @@ import static org.thingsboard.server.controller.EdgeController.EDGE_ID; | @@ -97,6 +97,7 @@ import static org.thingsboard.server.controller.EdgeController.EDGE_ID; | ||
97 | @RequiredArgsConstructor | 97 | @RequiredArgsConstructor |
98 | @Slf4j | 98 | @Slf4j |
99 | public class DeviceController extends BaseController { | 99 | public class DeviceController extends BaseController { |
100 | + public static final String DEVICE_ID_PARAM_DESCRIPTION = "A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; | ||
100 | private final DeviceBulkImportService deviceBulkImportService; | 101 | private final DeviceBulkImportService deviceBulkImportService; |
101 | 102 | ||
102 | private static final String DEVICE_ID = "deviceId"; | 103 | private static final String DEVICE_ID = "deviceId"; |
@@ -235,10 +236,13 @@ public class DeviceController extends BaseController { | @@ -235,10 +236,13 @@ public class DeviceController extends BaseController { | ||
235 | } | 236 | } |
236 | } | 237 | } |
237 | 238 | ||
239 | + @ApiOperation(value = "Unassign device from customer (unassignDeviceFromCustomer)", | ||
240 | + notes = "Clears assignment of the device to customer. Customer will not be able to query device afterwards.") | ||
238 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") | 241 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
239 | @RequestMapping(value = "/customer/device/{deviceId}", method = RequestMethod.DELETE) | 242 | @RequestMapping(value = "/customer/device/{deviceId}", method = RequestMethod.DELETE) |
240 | @ResponseBody | 243 | @ResponseBody |
241 | - public Device unassignDeviceFromCustomer(@PathVariable(DEVICE_ID) String strDeviceId) throws ThingsboardException { | 244 | + public Device unassignDeviceFromCustomer(@ApiParam(value = DEVICE_ID_PARAM_DESCRIPTION) |
245 | + @PathVariable(DEVICE_ID) String strDeviceId) throws ThingsboardException { | ||
242 | checkParameter(DEVICE_ID, strDeviceId); | 246 | checkParameter(DEVICE_ID, strDeviceId); |
243 | try { | 247 | try { |
244 | DeviceId deviceId = new DeviceId(toUUID(strDeviceId)); | 248 | DeviceId deviceId = new DeviceId(toUUID(strDeviceId)); |
@@ -266,10 +270,15 @@ public class DeviceController extends BaseController { | @@ -266,10 +270,15 @@ public class DeviceController extends BaseController { | ||
266 | } | 270 | } |
267 | } | 271 | } |
268 | 272 | ||
273 | + @ApiOperation(value = "Make device publicly available (assignDeviceToPublicCustomer)", | ||
274 | + notes = "Device will be available for non-authorized (not logged-in) users. " + | ||
275 | + "This is useful to create dashboards that you plan to share/embed on a publicly available website. " + | ||
276 | + "However, users that are logged-in and belong to different tenant will not be able to access the device.") | ||
269 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") | 277 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
270 | @RequestMapping(value = "/customer/public/device/{deviceId}", method = RequestMethod.POST) | 278 | @RequestMapping(value = "/customer/public/device/{deviceId}", method = RequestMethod.POST) |
271 | @ResponseBody | 279 | @ResponseBody |
272 | - public Device assignDeviceToPublicCustomer(@PathVariable(DEVICE_ID) String strDeviceId) throws ThingsboardException { | 280 | + public Device assignDeviceToPublicCustomer(@ApiParam(value = DEVICE_ID_PARAM_DESCRIPTION) |
281 | + @PathVariable(DEVICE_ID) String strDeviceId) throws ThingsboardException { | ||
273 | checkParameter(DEVICE_ID, strDeviceId); | 282 | checkParameter(DEVICE_ID, strDeviceId); |
274 | try { | 283 | try { |
275 | DeviceId deviceId = new DeviceId(toUUID(strDeviceId)); | 284 | DeviceId deviceId = new DeviceId(toUUID(strDeviceId)); |