Commit 21dde24c4854b4c477ee829d981d866f5a8344ce
Merge branch 'master' of github.com:thingsboard/thingsboard
Showing
11 changed files
with
30 additions
and
42 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 | ... | ... |
... | ... | @@ -80,7 +80,7 @@ public class EdgeController extends BaseController { |
80 | 80 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
81 | 81 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
82 | 82 | if (Authority.CUSTOMER_USER.equals(getCurrentUser().getAuthority())) { |
83 | - cleanUpSensitiveData(edge); | |
83 | + cleanUpLicenseKey(edge); | |
84 | 84 | } |
85 | 85 | return edge; |
86 | 86 | } catch (Exception e) { |
... | ... | @@ -97,7 +97,7 @@ public class EdgeController extends BaseController { |
97 | 97 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
98 | 98 | EdgeInfo edgeInfo = checkEdgeInfoId(edgeId, Operation.READ); |
99 | 99 | if (Authority.CUSTOMER_USER.equals(getCurrentUser().getAuthority())) { |
100 | - cleanUpSensitiveData(edgeInfo); | |
100 | + cleanUpLicenseKey(edgeInfo); | |
101 | 101 | } |
102 | 102 | return edgeInfo; |
103 | 103 | } catch (Exception e) { |
... | ... | @@ -404,7 +404,7 @@ public class EdgeController extends BaseController { |
404 | 404 | } |
405 | 405 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
406 | 406 | for (Edge edge : result.getData()) { |
407 | - cleanUpSensitiveData(edge); | |
407 | + cleanUpLicenseKey(edge); | |
408 | 408 | } |
409 | 409 | } |
410 | 410 | return checkNotNull(result); |
... | ... | @@ -439,7 +439,7 @@ public class EdgeController extends BaseController { |
439 | 439 | } |
440 | 440 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
441 | 441 | for (Edge edge : result.getData()) { |
442 | - cleanUpSensitiveData(edge); | |
442 | + cleanUpLicenseKey(edge); | |
443 | 443 | } |
444 | 444 | } |
445 | 445 | return checkNotNull(result); |
... | ... | @@ -471,7 +471,7 @@ public class EdgeController extends BaseController { |
471 | 471 | List<Edge> edges = edgesFuture.get(); |
472 | 472 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
473 | 473 | for (Edge edge : edges) { |
474 | - cleanUpSensitiveData(edge); | |
474 | + cleanUpLicenseKey(edge); | |
475 | 475 | } |
476 | 476 | } |
477 | 477 | return checkNotNull(edges); |
... | ... | @@ -502,7 +502,7 @@ public class EdgeController extends BaseController { |
502 | 502 | }).collect(Collectors.toList()); |
503 | 503 | if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { |
504 | 504 | for (Edge edge : edges) { |
505 | - cleanUpSensitiveData(edge); | |
505 | + cleanUpLicenseKey(edge); | |
506 | 506 | } |
507 | 507 | } |
508 | 508 | return edges; |
... | ... | @@ -580,11 +580,7 @@ public class EdgeController extends BaseController { |
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
583 | - private void cleanUpSensitiveData(Edge edge) { | |
583 | + private void cleanUpLicenseKey(Edge edge) { | |
584 | 584 | edge.setEdgeLicenseKey(null); |
585 | - edge.setRoutingKey(null); | |
586 | - edge.setSecret(null); | |
587 | - edge.setCloudEndpoint(null); | |
588 | - edge.setRootRuleChainId(null); | |
589 | 585 | } |
590 | 586 | } | ... | ... |
... | ... | @@ -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, | ... | ... |
... | ... | @@ -506,7 +506,7 @@ public class RuleChainController extends BaseController { |
506 | 506 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
507 | 507 | |
508 | 508 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
509 | - checkRuleChain(ruleChainId, Operation.ASSIGN_TO_EDGE); | |
509 | + checkRuleChain(ruleChainId, Operation.READ); | |
510 | 510 | |
511 | 511 | RuleChain savedRuleChain = checkNotNull(ruleChainService.assignRuleChainToEdge(getCurrentUser().getTenantId(), ruleChainId, edgeId)); |
512 | 512 | |
... | ... | @@ -538,7 +538,7 @@ public class RuleChainController extends BaseController { |
538 | 538 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
539 | 539 | Edge edge = checkEdgeId(edgeId, Operation.READ); |
540 | 540 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
541 | - RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.UNASSIGN_FROM_EDGE); | |
541 | + RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.READ); | |
542 | 542 | |
543 | 543 | RuleChain savedRuleChain = checkNotNull(ruleChainService.unassignRuleChainFromEdge(getCurrentUser().getTenantId(), ruleChainId, edgeId, false)); |
544 | 544 | ... | ... |
... | ... | @@ -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 | } | ... | ... |
... | ... | @@ -86,7 +86,6 @@ |
86 | 86 | [matAutocompleteDisabled]="isEntityCountDatasource" |
87 | 87 | [matChipInputFor]="chipList" |
88 | 88 | [matChipInputSeparatorKeyCodes]="separatorKeysCodes" |
89 | - matChipInputAddOnBlur | |
90 | 89 | (matChipInputTokenEnd)="add($event)"> |
91 | 90 | </mat-chip-list> |
92 | 91 | <mat-autocomplete #keyAutocomplete="matAutocomplete" | ... | ... |
... | ... | @@ -40,12 +40,6 @@ |
40 | 40 | </fieldset> |
41 | 41 | </div> |
42 | 42 | <div mat-dialog-actions fxLayoutAlign="end center"> |
43 | - <button mat-raised-button color="primary" | |
44 | - type="submit" | |
45 | - [disabled]="(isLoading$ | async) || addEntitiesToEdgeFormGroup.invalid | |
46 | - || !addEntitiesToEdgeFormGroup.dirty"> | |
47 | - {{ 'action.assign' | translate }} | |
48 | - </button> | |
49 | 43 | <button mat-button color="primary" |
50 | 44 | style="margin-right: 20px;" |
51 | 45 | type="button" |
... | ... | @@ -53,5 +47,11 @@ |
53 | 47 | (click)="cancel()"> |
54 | 48 | {{ 'action.cancel' | translate }} |
55 | 49 | </button> |
50 | + <button mat-raised-button color="primary" | |
51 | + type="submit" | |
52 | + [disabled]="(isLoading$ | async) || addEntitiesToEdgeFormGroup.invalid | |
53 | + || !addEntitiesToEdgeFormGroup.dirty"> | |
54 | + {{ 'action.assign' | translate }} | |
55 | + </button> | |
56 | 56 | </div> |
57 | 57 | </form> | ... | ... |
... | ... | @@ -69,7 +69,7 @@ export class AddEntitiesToEdgeDialogComponent extends |
69 | 69 | public dialogRef: MatDialogRef<AddEntitiesToEdgeDialogComponent, boolean>, |
70 | 70 | public fb: FormBuilder) { |
71 | 71 | super(store, router, dialogRef); |
72 | - this.entityType = data.entityType; | |
72 | + this.entityType = this.data.entityType; | |
73 | 73 | } |
74 | 74 | |
75 | 75 | ngOnInit(): void { |
... | ... | @@ -77,7 +77,7 @@ export class AddEntitiesToEdgeDialogComponent extends |
77 | 77 | entityIds: [null, [Validators.required]] |
78 | 78 | }); |
79 | 79 | this.subType = ''; |
80 | - switch (this.data.entityType) { | |
80 | + switch (this.entityType) { | |
81 | 81 | case EntityType.DEVICE: |
82 | 82 | this.assignToEdgeTitle = 'device.assign-device-to-edge-title'; |
83 | 83 | this.assignToEdgeText = 'device.assign-device-to-edge-text'; |
... | ... | @@ -118,7 +118,7 @@ export class AddEntitiesToEdgeDialogComponent extends |
118 | 118 | const tasks: Observable<any>[] = []; |
119 | 119 | entityIds.forEach( |
120 | 120 | (entityId) => { |
121 | - tasks.push(this.getAssignToEdgeTask(this.data.edgeId, entityId)); | |
121 | + tasks.push(this.getAssignToEdgeTask(this.data.edgeId, entityId, this.entityType)); | |
122 | 122 | } |
123 | 123 | ); |
124 | 124 | forkJoin(tasks).subscribe( |
... | ... | @@ -128,8 +128,8 @@ export class AddEntitiesToEdgeDialogComponent extends |
128 | 128 | ); |
129 | 129 | } |
130 | 130 | |
131 | - private getAssignToEdgeTask(edgeId: string, entityId: string): Observable<any> { | |
132 | - switch (this.data.entityType) { | |
131 | + private getAssignToEdgeTask(edgeId: string, entityId: string, entityType: EntityType): Observable<any> { | |
132 | + switch (entityType) { | |
133 | 133 | case EntityType.DEVICE: |
134 | 134 | return this.deviceService.assignDeviceToEdge(edgeId, entityId); |
135 | 135 | case EntityType.ASSET: | ... | ... |
... | ... | @@ -121,14 +121,7 @@ export class WidgetsBundlesTableConfigResolver implements Resolve<EntityTableCon |
121 | 121 | this.config.entitySelectionEnabled = (widgetsBundle) => this.isWidgetsBundleEditable(widgetsBundle, authUser.authority); |
122 | 122 | this.config.detailsReadonly = (widgetsBundle) => !this.isWidgetsBundleEditable(widgetsBundle, authUser.authority); |
123 | 123 | const authState = getCurrentAuthState(this.store); |
124 | - this.config.entitiesFetchFunction = pageLink => this.widgetsService.getWidgetBundles(pageLink).pipe( | |
125 | - map((widgetBundles) => { | |
126 | - if (!authState.edgesSupportEnabled) { | |
127 | - widgetBundles.data = widgetBundles.data.filter(widgetBundle => widgetBundle.alias !== 'edge_widgets'); | |
128 | - } | |
129 | - return widgetBundles; | |
130 | - }) | |
131 | - ); | |
124 | + this.config.entitiesFetchFunction = pageLink => this.widgetsService.getWidgetBundles(pageLink); | |
132 | 125 | return this.config; |
133 | 126 | } |
134 | 127 | ... | ... |