Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 7a39fbf

Browse files
rafaelinglukasmittag
authored andcommitted
Only actuactor target value can be set
1 parent 9a4fe30 commit 7a39fbf

File tree

1 file changed

+10
-0
lines changed
  • kuksa_databroker/databroker/src/grpc/kuksa_val_v1

1 file changed

+10
-0
lines changed

kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs

+10
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ impl proto::val_server::Val for broker::DataBroker {
148148
|id| proto::Field::from_i32(*id), // Ignore unknown fields for now
149149
));
150150

151+
if entry.actuator_target.is_some() {
152+
if let Some(metadata) = broker.get_metadata(id).await {
153+
if metadata.entry_type != broker::EntryType::Actuator {
154+
return Err(tonic::Status::invalid_argument(
155+
"Tried to set a target value for a non-actuator. Non-actuators have no target value.".to_string(),
156+
));
157+
}
158+
}
159+
}
160+
151161
let entry = match &request.entry {
152162
Some(entry) => entry,
153163
None => {

0 commit comments

Comments
 (0)