Skip to content

Commit

Permalink
fix device and hub owner_id
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoRoessner committed Jun 14, 2024
1 parent 6d76a62 commit 352f8ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"}
Expand Down
1 change: 1 addition & 0 deletions lib/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion lib/modifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 352f8ba

Please sign in to comment.