From 352f8ba580f58a706930f7d23f965d587d40570e Mon Sep 17 00:00:00 2001 From: Ingo Date: Fri, 14 Jun 2024 10:39:55 +0200 Subject: [PATCH] fix device and hub owner_id --- config.json | 6 ++++-- lib/annotations_test.go | 1 + lib/modifier_test.go | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index af3d749..c5041d8 100644 --- a/config.json +++ b/config.json @@ -86,7 +86,8 @@ }, {"Name": "device_type_id", "Path": "$.device.device_type_id"}, {"Name": "local_id", "Path": "$.device.local_id"}, - {"Name": "attributes", "Path": "$.device.attributes"} + {"Name": "attributes", "Path": "$.device.attributes"}, + {"Name": "owner_id", "Path": "$.device.owner_id"} ], "annotations": { "device_log": [ @@ -393,7 +394,8 @@ "features": { "name": {"type": "keyword", "copy_to": "feature_search"}, "device_local_ids": {"type": "keyword"}, - "device_ids": {"type": "keyword"} + "device_ids": {"type": "keyword"}, + "owner_id": {"type": "keyword"} }, "annotations": { "connected": {"type":"boolean"} diff --git a/lib/annotations_test.go b/lib/annotations_test.go index e014b9c..29813ef 100644 --- a/lib/annotations_test.go +++ b/lib/annotations_test.go @@ -335,6 +335,7 @@ func getTestDeviceResult(id string, connected *bool) (result map[string]interfac "attributes": nil, "device_type_id": nil, "local_id": nil, + "owner_id": nil, "permissions": map[string]bool{ "a": true, "r": true, diff --git a/lib/modifier_test.go b/lib/modifier_test.go index 31598ee..3a172ea 100644 --- a/lib/modifier_test.go +++ b/lib/modifier_test.go @@ -152,7 +152,7 @@ func TestResultModifiers(t *testing.T) { t.Run("rights not encoded", testRequest(config, "GET", "/v3/administrate/rights/devices/"+dIdWithModify, nil, 200, nil)) expectedRights := map[string]interface{}{} - json.Unmarshal([]byte(`{"creator":"testOwner","features":{"attributes":null,"device_type_id":"urn:infai:ses:device-type:bce1b3a2-8f46-44e7-9077-6d0a721be0a2$service_group_selection=a8ee3b1c-4cda-4f0d-9f55-4ef4882ce0af","display_name":"device-name Left Switch","local_id":null,"name":"device-name Left Switch","nickname":null},"group_rights":{"admin":{"administrate":true,"execute":true,"read":true,"write":true}},"resource_id":"urn:infai:ses:device:a8488d92-891d-4909-88c7-6fd9a2adfa10$service_group_selection=a8ee3b1c-4cda-4f0d-9f55-4ef4882ce0af","user_rights":{"testOwner":{"administrate":true,"execute":true,"read":true,"write":true}}}`), + json.Unmarshal([]byte(`{"creator":"testOwner","features":{"attributes":null,"device_type_id":"urn:infai:ses:device-type:bce1b3a2-8f46-44e7-9077-6d0a721be0a2$service_group_selection=a8ee3b1c-4cda-4f0d-9f55-4ef4882ce0af","display_name":"device-name Left Switch","local_id":null,"name":"device-name Left Switch","nickname":null,"owner_id":null},"group_rights":{"admin":{"administrate":true,"execute":true,"read":true,"write":true}},"resource_id":"urn:infai:ses:device:a8488d92-891d-4909-88c7-6fd9a2adfa10$service_group_selection=a8ee3b1c-4cda-4f0d-9f55-4ef4882ce0af","user_rights":{"testOwner":{"administrate":true,"execute":true,"read":true,"write":true}}}`), &expectedRights) t.Run("rights value", testRequest(config, "GET", "/v3/administrate/rights/devices/"+url.PathEscape(dIdWithModify), nil, 200, expectedRights)) @@ -281,6 +281,7 @@ func getTestDeviceResultWithDeviceTypeIdAndName(id string, name string, deviceTy "attributes": nil, "device_type_id": deviceTypeId, "local_id": nil, + "owner_id": nil, "permissions": map[string]bool{ "a": true, "r": true,