Commit fdd126303a115423f2583edb976aafb0909def65
Committed by
Andrew Shvayka
1 parent
d4718ae3
Validate more entities' fields
Showing
10 changed files
with
27 additions
and
1 deletions
... | ... | @@ -19,14 +19,18 @@ import com.fasterxml.jackson.annotation.JsonProperty; |
19 | 19 | import org.thingsboard.server.common.data.id.CustomerId; |
20 | 20 | import org.thingsboard.server.common.data.id.DashboardId; |
21 | 21 | import org.thingsboard.server.common.data.id.TenantId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | |
22 | 23 | |
24 | +import javax.validation.Valid; | |
23 | 25 | import java.util.HashSet; |
24 | 26 | import java.util.Set; |
25 | 27 | |
26 | 28 | public class DashboardInfo extends SearchTextBased<DashboardId> implements HasName, HasTenantId { |
27 | 29 | |
28 | 30 | private TenantId tenantId; |
31 | + @NoXss | |
29 | 32 | private String title; |
33 | + @Valid | |
30 | 34 | private Set<ShortCustomerInfo> assignedCustomers; |
31 | 35 | |
32 | 36 | public DashboardInfo() { | ... | ... |
... | ... | @@ -19,6 +19,7 @@ import lombok.AllArgsConstructor; |
19 | 19 | import lombok.Getter; |
20 | 20 | import lombok.Setter; |
21 | 21 | import org.thingsboard.server.common.data.id.CustomerId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | |
22 | 23 | |
23 | 24 | /** |
24 | 25 | * Created by igor on 2/27/18. |
... | ... | @@ -31,6 +32,7 @@ public class ShortCustomerInfo { |
31 | 32 | private CustomerId customerId; |
32 | 33 | |
33 | 34 | @Getter @Setter |
35 | + @NoXss | |
34 | 36 | private String title; |
35 | 37 | |
36 | 38 | @Getter @Setter | ... | ... |
... | ... | @@ -19,6 +19,7 @@ import lombok.Data; |
19 | 19 | import lombok.EqualsAndHashCode; |
20 | 20 | import lombok.extern.slf4j.Slf4j; |
21 | 21 | import org.thingsboard.server.common.data.id.TbResourceId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | |
22 | 23 | |
23 | 24 | @Slf4j |
24 | 25 | @Data |
... | ... | @@ -27,6 +28,7 @@ public class TbResource extends TbResourceInfo { |
27 | 28 | |
28 | 29 | private static final long serialVersionUID = 7379609705527272306L; |
29 | 30 | |
31 | + @NoXss | |
30 | 32 | private String fileName; |
31 | 33 | |
32 | 34 | private String data; | ... | ... |
... | ... | @@ -20,6 +20,7 @@ import lombok.EqualsAndHashCode; |
20 | 20 | import lombok.extern.slf4j.Slf4j; |
21 | 21 | import org.thingsboard.server.common.data.id.TbResourceId; |
22 | 22 | import org.thingsboard.server.common.data.id.TenantId; |
23 | +import org.thingsboard.server.common.data.validation.NoXss; | |
23 | 24 | |
24 | 25 | @Slf4j |
25 | 26 | @Data |
... | ... | @@ -27,6 +28,7 @@ import org.thingsboard.server.common.data.id.TenantId; |
27 | 28 | public class TbResourceInfo extends SearchTextBased<TbResourceId> implements HasTenantId { |
28 | 29 | |
29 | 30 | private TenantId tenantId; |
31 | + @NoXss | |
30 | 32 | private String title; |
31 | 33 | private ResourceType resourceType; |
32 | 34 | private String resourceKey; | ... | ... |
... | ... | @@ -25,6 +25,7 @@ import java.util.List; |
25 | 25 | public class DeviceProfileData implements Serializable { |
26 | 26 | |
27 | 27 | private DeviceProfileConfiguration configuration; |
28 | + @Valid | |
28 | 29 | private DeviceProfileTransportConfiguration transportConfiguration; |
29 | 30 | private DeviceProfileProvisionConfiguration provisionConfiguration; |
30 | 31 | @Valid | ... | ... |
... | ... | @@ -17,11 +17,14 @@ package org.thingsboard.server.common.data.device.profile; |
17 | 17 | |
18 | 18 | import lombok.Data; |
19 | 19 | import org.thingsboard.server.common.data.DeviceTransportType; |
20 | +import org.thingsboard.server.common.data.validation.NoXss; | |
20 | 21 | |
21 | 22 | @Data |
22 | 23 | public class MqttDeviceProfileTransportConfiguration implements DeviceProfileTransportConfiguration { |
23 | 24 | |
25 | + @NoXss | |
24 | 26 | private String deviceTelemetryTopic = MqttTopics.DEVICE_TELEMETRY_TOPIC; |
27 | + @NoXss | |
25 | 28 | private String deviceAttributesTopic = MqttTopics.DEVICE_ATTRIBUTES_TOPIC; |
26 | 29 | private TransportPayloadTypeConfiguration transportPayloadTypeConfiguration; |
27 | 30 | ... | ... |
... | ... | @@ -20,6 +20,7 @@ import org.thingsboard.server.common.data.BaseData; |
20 | 20 | import org.thingsboard.server.common.data.HasTenantId; |
21 | 21 | import org.thingsboard.server.common.data.id.TenantId; |
22 | 22 | import org.thingsboard.server.common.data.id.WidgetTypeId; |
23 | +import org.thingsboard.server.common.data.validation.NoXss; | |
23 | 24 | |
24 | 25 | @Data |
25 | 26 | public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantId { |
... | ... | @@ -27,8 +28,11 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantI |
27 | 28 | private static final long serialVersionUID = 8388684344603660756L; |
28 | 29 | |
29 | 30 | private TenantId tenantId; |
31 | + @NoXss | |
30 | 32 | private String bundleAlias; |
33 | + @NoXss | |
31 | 34 | private String alias; |
35 | + @NoXss | |
32 | 36 | private String name; |
33 | 37 | |
34 | 38 | public BaseWidgetType() { | ... | ... |
... | ... | @@ -15,14 +15,15 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.common.data.widget; |
17 | 17 | |
18 | -import com.fasterxml.jackson.databind.JsonNode; | |
19 | 18 | import lombok.Data; |
20 | 19 | import org.thingsboard.server.common.data.id.WidgetTypeId; |
20 | +import org.thingsboard.server.common.data.validation.NoXss; | |
21 | 21 | |
22 | 22 | @Data |
23 | 23 | public class WidgetTypeDetails extends WidgetType { |
24 | 24 | |
25 | 25 | private String image; |
26 | + @NoXss | |
26 | 27 | private String description; |
27 | 28 | |
28 | 29 | public WidgetTypeDetails() { | ... | ... |
... | ... | @@ -17,12 +17,15 @@ package org.thingsboard.server.common.data.widget; |
17 | 17 | |
18 | 18 | import lombok.Data; |
19 | 19 | import org.thingsboard.server.common.data.id.WidgetTypeId; |
20 | +import org.thingsboard.server.common.data.validation.NoXss; | |
20 | 21 | |
21 | 22 | @Data |
22 | 23 | public class WidgetTypeInfo extends BaseWidgetType { |
23 | 24 | |
24 | 25 | private String image; |
26 | + @NoXss | |
25 | 27 | private String description; |
28 | + @NoXss | |
26 | 29 | private String widgetType; |
27 | 30 | |
28 | 31 | public WidgetTypeInfo() { | ... | ... |
... | ... | @@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.HasTenantId; |
19 | 19 | import org.thingsboard.server.common.data.SearchTextBased; |
20 | 20 | import org.thingsboard.server.common.data.id.TenantId; |
21 | 21 | import org.thingsboard.server.common.data.id.WidgetsBundleId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | |
22 | 23 | |
23 | 24 | import java.util.Arrays; |
24 | 25 | |
... | ... | @@ -27,9 +28,12 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H |
27 | 28 | private static final long serialVersionUID = -7627368878362410489L; |
28 | 29 | |
29 | 30 | private TenantId tenantId; |
31 | + @NoXss | |
30 | 32 | private String alias; |
33 | + @NoXss | |
31 | 34 | private String title; |
32 | 35 | private String image; |
36 | + @NoXss | |
33 | 37 | private String description; |
34 | 38 | |
35 | 39 | public WidgetsBundle() { | ... | ... |