Commit 50127b8cc70043bfd61bd43d25a37c8db40015ad
1 parent
5a0336aa
EdgeController: clear only license for customer users. Deleted ASSIGN_TO_EDGE, UNASSIGN_FROM_EDGE
Showing
7 changed files
with
18 additions
and
22 deletions
... | ... | @@ -434,7 +434,7 @@ public class AssetController extends BaseController { |
434 | 434 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
435 | 435 | |
436 | 436 | AssetId assetId = new AssetId(toUUID(strAssetId)); |
437 | - checkAssetId(assetId, Operation.ASSIGN_TO_EDGE); | |
437 | + checkAssetId(assetId, Operation.READ); | |
438 | 438 | |
439 | 439 | Asset savedAsset = checkNotNull(assetService.assignAssetToEdge(getTenantId(), assetId, edgeId)); |
440 | 440 | |
... | ... | @@ -467,7 +467,7 @@ public class AssetController extends BaseController { |
467 | 467 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
468 | 468 | |
469 | 469 | AssetId assetId = new AssetId(toUUID(strAssetId)); |
470 | - Asset asset = checkAssetId(assetId, Operation.UNASSIGN_FROM_EDGE); | |
470 | + Asset asset = checkAssetId(assetId, Operation.READ); | |
471 | 471 | |
472 | 472 | Asset savedAsset = checkNotNull(assetService.unassignAssetFromEdge(getTenantId(), assetId, edgeId)); |
473 | 473 | ... | ... |
... | ... | @@ -657,7 +657,7 @@ public class DashboardController extends BaseController { |
657 | 657 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
658 | 658 | |
659 | 659 | DashboardId dashboardId = new DashboardId(toUUID(strDashboardId)); |
660 | - checkDashboardId(dashboardId, Operation.ASSIGN_TO_EDGE); | |
660 | + checkDashboardId(dashboardId, Operation.READ); | |
661 | 661 | |
662 | 662 | Dashboard savedDashboard = checkNotNull(dashboardService.assignDashboardToEdge(getCurrentUser().getTenantId(), dashboardId, edgeId)); |
663 | 663 | |
... | ... | @@ -689,7 +689,7 @@ public class DashboardController extends BaseController { |
689 | 689 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
690 | 690 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
691 | 691 | DashboardId dashboardId = new DashboardId(toUUID(strDashboardId)); |
692 | - Dashboard dashboard = checkDashboardId(dashboardId, Operation.UNASSIGN_FROM_EDGE); | |
692 | + Dashboard dashboard = checkDashboardId(dashboardId, Operation.READ); | |
693 | 693 | |
694 | 694 | Dashboard savedDashboard = checkNotNull(dashboardService.unassignDashboardFromEdge(getCurrentUser().getTenantId(), dashboardId, edgeId)); |
695 | 695 | ... | ... |
... | ... | @@ -682,7 +682,7 @@ public class DeviceController extends BaseController { |
682 | 682 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
683 | 683 | |
684 | 684 | DeviceId deviceId = new DeviceId(toUUID(strDeviceId)); |
685 | - checkDeviceId(deviceId, Operation.ASSIGN_TO_EDGE); | |
685 | + checkDeviceId(deviceId, Operation.READ); | |
686 | 686 | |
687 | 687 | Device savedDevice = checkNotNull(deviceService.assignDeviceToEdge(getCurrentUser().getTenantId(), deviceId, edgeId)); |
688 | 688 | |
... | ... | @@ -716,7 +716,7 @@ public class DeviceController extends BaseController { |
716 | 716 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
717 | 717 | |
718 | 718 | DeviceId deviceId = new DeviceId(toUUID(strDeviceId)); |
719 | - Device device = checkDeviceId(deviceId, Operation.UNASSIGN_FROM_EDGE); | |
719 | + Device device = checkDeviceId(deviceId, Operation.READ); | |
720 | 720 | |
721 | 721 | Device savedDevice = checkNotNull(deviceService.unassignDeviceFromEdge(getCurrentUser().getTenantId(), deviceId, edgeId)); |
722 | 722 | ... | ... |
... | ... | @@ -81,7 +81,7 @@ public class EdgeController extends BaseController { |
81 | 81 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
82 | 82 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
83 | 83 | if (Authority.CUSTOMER_USER.equals(getCurrentUser().getAuthority())) { |
84 | - cleanUpSensitiveData(edge); | |
84 | + cleanUpLicenseKey(edge); | |
85 | 85 | } |
86 | 86 | return edge; |
87 | 87 | } catch (Exception e) { |
... | ... | @@ -98,7 +98,7 @@ public class EdgeController extends BaseController { |
98 | 98 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
99 | 99 | EdgeInfo edgeInfo = checkEdgeInfoId(edgeId, Operation.READ); |
100 | 100 | if (Authority.CUSTOMER_USER.equals(getCurrentUser().getAuthority())) { |
101 | - cleanUpSensitiveData(edgeInfo); | |
101 | + cleanUpLicenseKey(edgeInfo); | |
102 | 102 | } |
103 | 103 | return edgeInfo; |
104 | 104 | } catch (Exception e) { |
... | ... | @@ -405,7 +405,7 @@ public class EdgeController extends BaseController { |
405 | 405 | } |
406 | 406 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
407 | 407 | for (Edge edge : result.getData()) { |
408 | - cleanUpSensitiveData(edge); | |
408 | + cleanUpLicenseKey(edge); | |
409 | 409 | } |
410 | 410 | } |
411 | 411 | return checkNotNull(result); |
... | ... | @@ -440,7 +440,7 @@ public class EdgeController extends BaseController { |
440 | 440 | } |
441 | 441 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
442 | 442 | for (Edge edge : result.getData()) { |
443 | - cleanUpSensitiveData(edge); | |
443 | + cleanUpLicenseKey(edge); | |
444 | 444 | } |
445 | 445 | } |
446 | 446 | return checkNotNull(result); |
... | ... | @@ -472,7 +472,7 @@ public class EdgeController extends BaseController { |
472 | 472 | List<Edge> edges = edgesFuture.get(); |
473 | 473 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
474 | 474 | for (Edge edge : edges) { |
475 | - cleanUpSensitiveData(edge); | |
475 | + cleanUpLicenseKey(edge); | |
476 | 476 | } |
477 | 477 | } |
478 | 478 | return checkNotNull(edges); |
... | ... | @@ -503,7 +503,7 @@ public class EdgeController extends BaseController { |
503 | 503 | }).collect(Collectors.toList()); |
504 | 504 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
505 | 505 | for (Edge edge : edges) { |
506 | - cleanUpSensitiveData(edge); | |
506 | + cleanUpLicenseKey(edge); | |
507 | 507 | } |
508 | 508 | } |
509 | 509 | return edges; |
... | ... | @@ -583,11 +583,7 @@ public class EdgeController extends BaseController { |
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | - private void cleanUpSensitiveData(Edge edge) { | |
586 | + private void cleanUpLicenseKey(Edge edge) { | |
587 | 587 | edge.setEdgeLicenseKey(null); |
588 | - edge.setRoutingKey(null); | |
589 | - edge.setSecret(null); | |
590 | - edge.setCloudEndpoint(null); | |
591 | - edge.setRootRuleChainId(null); | |
592 | 588 | } |
593 | 589 | } | ... | ... |
... | ... | @@ -626,7 +626,7 @@ public class EntityViewController extends BaseController { |
626 | 626 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
627 | 627 | |
628 | 628 | EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId)); |
629 | - checkEntityViewId(entityViewId, Operation.ASSIGN_TO_EDGE); | |
629 | + checkEntityViewId(entityViewId, Operation.READ); | |
630 | 630 | |
631 | 631 | EntityView savedEntityView = checkNotNull(entityViewService.assignEntityViewToEdge(getTenantId(), entityViewId, edgeId)); |
632 | 632 | logEntityAction(entityViewId, savedEntityView, |
... | ... | @@ -656,7 +656,7 @@ public class EntityViewController extends BaseController { |
656 | 656 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
657 | 657 | |
658 | 658 | EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId)); |
659 | - EntityView entityView = checkEntityViewId(entityViewId, Operation.UNASSIGN_FROM_EDGE); | |
659 | + EntityView entityView = checkEntityViewId(entityViewId, Operation.READ); | |
660 | 660 | |
661 | 661 | EntityView savedEntityView = checkNotNull(entityViewService.unassignEntityViewFromEdge(getTenantId(), entityViewId, edgeId)); |
662 | 662 | logEntityAction(entityViewId, entityView, | ... | ... |
... | ... | @@ -500,7 +500,7 @@ public class RuleChainController extends BaseController { |
500 | 500 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
501 | 501 | |
502 | 502 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
503 | - checkRuleChain(ruleChainId, Operation.ASSIGN_TO_EDGE); | |
503 | + checkRuleChain(ruleChainId, Operation.READ); | |
504 | 504 | |
505 | 505 | RuleChain savedRuleChain = checkNotNull(ruleChainService.assignRuleChainToEdge(getCurrentUser().getTenantId(), ruleChainId, edgeId)); |
506 | 506 | |
... | ... | @@ -532,7 +532,7 @@ public class RuleChainController extends BaseController { |
532 | 532 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
533 | 533 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
534 | 534 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
535 | - RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.UNASSIGN_FROM_EDGE); | |
535 | + RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.READ); | |
536 | 536 | |
537 | 537 | RuleChain savedRuleChain = checkNotNull(ruleChainService.unassignRuleChainFromEdge(getCurrentUser().getTenantId(), ruleChainId, edgeId, false)); |
538 | 538 | ... | ... |
... | ... | @@ -19,6 +19,6 @@ public enum Operation { |
19 | 19 | |
20 | 20 | ALL, CREATE, READ, WRITE, DELETE, ASSIGN_TO_CUSTOMER, UNASSIGN_FROM_CUSTOMER, RPC_CALL, |
21 | 21 | READ_CREDENTIALS, WRITE_CREDENTIALS, READ_ATTRIBUTES, WRITE_ATTRIBUTES, READ_TELEMETRY, WRITE_TELEMETRY, CLAIM_DEVICES, |
22 | - ASSIGN_TO_TENANT, ASSIGN_TO_EDGE, UNASSIGN_FROM_EDGE | |
22 | + ASSIGN_TO_TENANT | |
23 | 23 | |
24 | 24 | } | ... | ... |