Commit e1b672eaa1ed32af7d3ea34b97b81b590ce0a1c4

Authored by xp.Huang
1 parent d5505b56

perf: 调整权限使用方式

... ... @@ -222,7 +222,7 @@ public class TkDeviceController extends BaseController {
222 222
223 223 @GetMapping("{id}")
224 224 @ApiOperation("详情")
225   - @PreAuthorize("@check.checkPermissions({},{'api:yt:device:get'})")
  225 + @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:device:get'})")
226 226 public ResponseEntity<DeviceDTO> getDevice(@PathVariable("id") String id)
227 227 throws ThingsboardException {
228 228 return ResponseEntity.of(tkdeviceService.getDevice(getCurrentUser().getCurrentTenantId(), id));
... ... @@ -236,7 +236,7 @@ public class TkDeviceController extends BaseController {
236 236 return ResponseEntity.of(tkdeviceService.getDevice(getCurrentUser().getCurrentTenantId(), id));
237 237 }
238 238
239   - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})")
  239 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
240 240 @PostMapping(params = {PAGE_SIZE, PAGE})
241 241 @ApiOperation("查询")
242 242 public TkPageData<DeviceDTO> pageDevice(
... ... @@ -262,7 +262,7 @@ public class TkDeviceController extends BaseController {
262 262 return tkdeviceService.page(getCurrentUser().getCurrentTenantId(), queryMap);
263 263 }
264 264
265   - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})")
  265 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
266 266 @GetMapping(
267 267 path = {"/relation"},
268 268 params = {PAGE_SIZE, PAGE})
... ...
... ... @@ -114,7 +114,7 @@ public class TkDeviceScriptController extends BaseController {
114 114
115 115 @GetMapping(params = {PAGE_SIZE, PAGE})
116 116 @ApiOperation("分页查询")
117   - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})")
  117 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
118 118 public TkPageData<TkDeviceScriptDTO> pageDeviceScript(
119 119 @RequestParam(PAGE_SIZE) int pageSize,
120 120 @RequestParam(PAGE) int page,
... ... @@ -209,7 +209,7 @@ public class TkDeviceScriptController extends BaseController {
209 209
210 210
211 211
212   - @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
  212 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
213 213 @PostMapping("/modbus")
214 214 @ApiOperation("生成Modbus指令")
215 215 public ResponseEntity<String> modbus(@RequestBody TkDeviceRpcDTO inputParams)
... ...
... ... @@ -19,12 +19,10 @@ import org.thingsboard.server.common.data.StringUtils;
19 19 import org.thingsboard.server.common.data.exception.ThingsboardException;
20 20 import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException;
21 21 import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage;
22   -import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO;
23 22 import org.thingsboard.server.common.data.yunteng.dto.sip.StreamContentDTO;
24 23 import org.thingsboard.server.common.data.yunteng.enums.PTZCommandEnum;
25 24 import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult;
26 25 import org.thingsboard.server.controller.BaseController;
27   -import org.thingsboard.server.dao.yunteng.service.TkDeviceService;
28 26 import org.thingsboard.server.service.yunteng.media.TkVideoControlService;
29 27
30 28 @RestController
... ... @@ -35,7 +33,6 @@ import org.thingsboard.server.service.yunteng.media.TkVideoControlService;
35 33 public class TkVideoControlController extends BaseController {
36 34
37 35 private final TkVideoControlService tkVideoControlService;
38   - private final TkDeviceService tkDeviceService;
39 36
40 37 @GetMapping("/start/{deviceId}/{channelId}")
41 38 @ApiOperation(value = "视频点播/预览")
... ...