-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Module - Repository DS, Module - Repository JDBC
-
Labels:None
-
Target Version/s:
When creating a relationships to a resource not in the repository the relationship and its expansion will always come back as null.
Steps to reproduce:
1) Create a relationships in managed.json to an external resource. Using the sync with csv sample you add an entry like this to managed.json
"systemRelationship" : { "title" : null, "type" : "relationship", "viewable" : true, "searchable" : false, "userEditable" : false, "returnByDefault" : false, "reverseRelationship" : false, "reversePropertyName" : null, "validate" : false, "properties" : { "_ref" : { "type" : "string" }, "_refProperties" : { "type" : "object", "properties" : { "_id" : { "type" : "string", "required" : false, "propName" : "_id" } } } }, "resourceCollection" : [ { "path" : "system/csvfile/account", "query" : { "queryFilter" : "true", "fields" : [ ], "sortKeys" : [ ] } } ], "description" : null }
2) Patch a user to add the relationship.
curl --location --request PATCH 'http://localhost:8080/openidm/managed/user/4bf8c648-5a72-4bc3-b675-2650b74bc8d5' \ --header 'Content-Type: application/json' \ --header 'X-OpenIDM-Username: openidm-admin' \ --header 'X-OpenIDM-Password: openidm-admin' \ --data-raw ' [{ "operation": "add", "field": "/systemRelationship", "value": { "_ref": "system/csvfile/bjensen", "_refProperties" : { "key" : "value" } } }]'
3) Get the users expanding the relaitonship fields and notice the /systemRelationship field is null
curl --location --request GET 'http://localhost:8080/openidm/managed/user?_queryFilter=true&_fields=*_ref/*' \ --header 'X-OpenIDM-Username: openidm-admin' \ --header 'X-OpenIDM-Password: openidm-admin' \ --header 'Content-Type: application/json' { "result": [ { "_id": "4bf8c648-5a72-4bc3-b675-2650b74bc8d5", "_rev": "1", "manager": null, "systemRelationship": null, "_meta": { "_ref": "internal/usermeta/c95f9e27-0fc2-4e10-92d1-e1c7e8f443b6", "_refResourceCollection": "internal/usermeta", "_refResourceId": "c95f9e27-0fc2-4e10-92d1-e1c7e8f443b6", "_refProperties": { "_id": "33aaab04-55d4-4c20-8c70-fbf8e1a19b37", "_rev": "0" }, "createDate": "2020-06-01T20:37:56.196531Z", "lastChanged": { "date": "2020-06-01T20:38:12.277252Z" }, "loginCount": 0, "_id": "c95f9e27-0fc2-4e10-92d1-e1c7e8f443b6", "_rev": "1" }, "reports": [], "roles": [], "authzRoles": [ { "_ref": "internal/role/openidm-authorized", "_refResourceCollection": "internal/role", "_refResourceId": "openidm-authorized", "_refProperties": { "_id": "d51b22a2-fb45-4770-9249-4375461094d3", "_rev": "0" }, "_id": "openidm-authorized", "_rev": "0", "name": "openidm-authorized", "description": "Basic minimum user", "temporalConstraints": null, "condition": null, "privileges": null } ], "_notifications": [] } ], "resultCount": 1, "pagedResultsCookie": null, "totalPagedResultsPolicy": "NONE", "totalPagedResults": -1, "remainingPagedResults": -1 }