|
|
@ -104,9 +104,11 @@ public class WidgetTypeController extends AutoCommitController { |
|
|
checkEntity(widgetTypeDetails.getId(), widgetTypeDetails, Resource.WIDGET_TYPE); |
|
|
checkEntity(widgetTypeDetails.getId(), widgetTypeDetails, Resource.WIDGET_TYPE); |
|
|
WidgetTypeDetails savedWidgetTypeDetails = widgetTypeService.saveWidgetType(widgetTypeDetails); |
|
|
WidgetTypeDetails savedWidgetTypeDetails = widgetTypeService.saveWidgetType(widgetTypeDetails); |
|
|
|
|
|
|
|
|
WidgetsBundle widgetsBundle = widgetsBundleService.findWidgetsBundleByTenantIdAndAlias(widgetTypeDetails.getTenantId(), widgetTypeDetails.getBundleAlias()); |
|
|
if (!Authority.SYS_ADMIN.equals(currentUser.getAuthority())) { |
|
|
if (widgetsBundle != null) { |
|
|
WidgetsBundle widgetsBundle = widgetsBundleService.findWidgetsBundleByTenantIdAndAlias(widgetTypeDetails.getTenantId(), widgetTypeDetails.getBundleAlias()); |
|
|
autoCommit(currentUser, widgetsBundle.getId()); |
|
|
if (widgetsBundle != null) { |
|
|
|
|
|
autoCommit(currentUser, widgetsBundle.getId()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sendEntityNotificationMsg(getTenantId(), savedWidgetTypeDetails.getId(), |
|
|
sendEntityNotificationMsg(getTenantId(), savedWidgetTypeDetails.getId(), |
|
|
@ -128,9 +130,17 @@ public class WidgetTypeController extends AutoCommitController { |
|
|
@PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException { |
|
|
@PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException { |
|
|
checkParameter("widgetTypeId", strWidgetTypeId); |
|
|
checkParameter("widgetTypeId", strWidgetTypeId); |
|
|
try { |
|
|
try { |
|
|
|
|
|
var currentUser = getCurrentUser(); |
|
|
WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId)); |
|
|
WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId)); |
|
|
checkWidgetTypeId(widgetTypeId, Operation.DELETE); |
|
|
WidgetTypeDetails wtd = checkWidgetTypeId(widgetTypeId, Operation.DELETE); |
|
|
widgetTypeService.deleteWidgetType(getCurrentUser().getTenantId(), widgetTypeId); |
|
|
widgetTypeService.deleteWidgetType(currentUser.getTenantId(), widgetTypeId); |
|
|
|
|
|
|
|
|
|
|
|
if (wtd != null && !Authority.SYS_ADMIN.equals(currentUser.getAuthority())) { |
|
|
|
|
|
WidgetsBundle widgetsBundle = widgetsBundleService.findWidgetsBundleByTenantIdAndAlias(wtd.getTenantId(), wtd.getBundleAlias()); |
|
|
|
|
|
if (widgetsBundle != null) { |
|
|
|
|
|
autoCommit(currentUser, widgetsBundle.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
sendEntityNotificationMsg(getTenantId(), widgetTypeId, EdgeEventActionType.DELETED); |
|
|
sendEntityNotificationMsg(getTenantId(), widgetTypeId, EdgeEventActionType.DELETED); |
|
|
|
|
|
|
|
|
|