Can anyone provide an example of using data from a related object in the
entity mapping using the demo data set for USER and PRINTER?
I can't seem to figure out how to use attributes from a related object in a
resource mapping. I can add the internal attribute and it will save with no
errors, but when i run a push task, the logs indicate no relationship exists
and populates a null value on the connector. Either I'm not referencing the
other objects correctly, or I don't actually understand how relationships
work.
I'm following the documentation here
<https://github.com/apache/syncope/blob/master/src/main/asciidoc/reference-guide/concepts/externalresources.adoc>
for the mapping
I'm using this
<https://github.com/apache/syncope/blob/master/src/main/asciidoc/reference-guide/concepts/typemanagement.adoc>
for relationships.
I'm using the demo data set. If I understand the relationship correctly,
the user "bellini" has a relationship to a printer defined via
neighborhood.This is the REST response for bellini:
{ "@class": "org.apache.syncope.common.lib.to.UserTO", "key":
"c9b2dec2-00a7-4855-97c0-d854842b4b24", "type": "USER", "realm": "/",
"username": "bellini", "creator": "admin", "creationDate":
"2010-10-20T16:00:00.000+0000", "lastModifier": "admin", "lastChangeDate":
"2010-10-20T16:00:00.000+0000", "status": "active", "password": null,
"token": null, "tokenExpireTime": null, "lastLoginDate": null,
"changePwdDate": null, "failedLogins": 0, "securityQuestion": null,
"securityAnswer": null, "suspended": false, "mustChangePassword": false,
"dynRealms": [], "auxClasses": [], "plainAttrs": [ { "schema":
"cool", "values": [ "true" ] }, { "schema":
"gender", "values": [ "M" ] }, { "schema":
"userId", "values": [ "[email protected]" ] }, {
"schema": "loginDate", "values": [ "2009-06-24" ] },
{ "schema": "firstname", "values": [ "Vincenzo" ]
}, { "schema": "surname", "values": [ "Bellini" ]
}, { "schema": "fullname", "values": [ "Vincenzo
Bellini" ] } ], "derAttrs": [ { "schema": "info",
"values": [ "bellini - 2010-10-20T11:00:00-0500[0]" ] }, {
"schema": "noschema", "values": [ "Bellini, Vincenzo" ]
}, { "schema": "cn", "values": [ "Bellini, Vincenzo"
] } ], "virAttrs": [], "resources": [
"ws-target-resource-nopropagation" ], "roles": [ "User manager",
"User reviewer" ], "dynRoles": [], "privileges": [], "relationships": [
{ "type": "neighborhood", "otherEndType": "PRINTER",
"otherEndKey": "fc6dbc3a-6c07-4965-8781-921e7401a4a5", "otherEndName":
"HP LJ 1300n" } ], "memberships": [ { "groupKey":
"bf825fe1-7320-4a54-bd64-143b5c18ab97", "groupName":
"managingDirector", "plainAttrs": [], "derAttrs": [],
"virAttrs": [] } ], "dynMemberships": []}
I created a new resource on the H2 connector based on a simple table I
created in the H2/testdb called PRINTERS with columns: USERNAME, MODEL. I
mapped userId to USERNAME and anyObjects[PRINTER].model to MODEL, set both
to propagate only and then ran a reconciliation push task for the user
bellini.In the core log I see these entries:
15:03:46.948 DEBUG org.apache.syncope.core.provisioning.api.MappingManager -
Processing expression 'anyObjects[PRINTER].model'15:03:46.948 DEBUG
org.apache.syncope.core.provisioning.api.MappingManager - Get internal
values for JPAUser[c9b2dec2-00a7-4855-97c0-d854842b4b24] as
'anyObjects[PRINTER].model' on JPAExternalResource[Printers]15:03:46.950
WARN org.apache.syncope.core.provisioning.api.MappingManager - No
relationship for PRINTER in JPAUser[c9b2dec2-00a7-4855-97c0-d854842b4b24],
ignoring15:03:46.950 WARN
org.apache.syncope.core.provisioning.api.MappingManager - Could not
determine the reference instance for anyObjects[PRINTER].model
I also attempted to use the following values for internal attributes in the
mapping:
anyObjects[neighborhood].model - same no relationship warning in logs
relationships[neighborhood][PRINTER].model - will not let me save - error is
that it's not allowed.
anyObjects["PRINTER"].model - will not let me save - error does not exist
anyObjects['PRINTER'].model - will not let me save - error does not exist
Here is my resource json:
{ "key": "Printers", "connector": "5aa5b8be-7521-481a-9651-c557aea078c1",
"connectorDisplayName": "H2", "orgUnit": null, "propagationPriority":
null, "randomPwdIfNotProvided": false, "enforceMandatoryCondition": false,
"createTraceLevel": "ALL", "updateTraceLevel": "ALL", "deleteTraceLevel":
"ALL", "provisioningTraceLevel": "ALL", "passwordPolicy": null,
"accountPolicy": null, "pullPolicy": null, "pushPolicy": null,
"overrideCapabilities": false, "provisions": [ { "key":
"2c090bbd-41e6-4b23-890b-bd41e6fb2363", "anyType": "USER",
"objectClass": "__ACCOUNT__", "syncToken": null,
"ignoreCaseMatch": false, "uidOnCreate": null, "mapping": {
"connObjectLink": null, "connObjectKeyItem": { "key":
"d2811a05-8595-4315-811a-0585951315ab", "intAttrName": "userId",
"extAttrName": "USERNAME", "connObjectKey": true,
"password": false, "mandatoryCondition": "true",
"purpose": "PROPAGATION", "propagationJEXLTransformer": null,
"pullJEXLTransformer": null, "transformers": [] },
"items": [ { "key":
"c4e79639-79c6-46d0-a796-3979c6d6d033", "intAttrName":
"anyObjects[PRINTER].model", "extAttrName": "MODEL",
"connObjectKey": false, "password": false,
"mandatoryCondition": "false", "purpose": "PROPAGATION",
"propagationJEXLTransformer": null, "pullJEXLTransformer": null,
"transformers": [] }, { "key":
"d2811a05-8595-4315-811a-0585951315ab", "intAttrName": "userId",
"extAttrName": "USERNAME", "connObjectKey": true,
"password": false, "mandatoryCondition": "true",
"purpose": "PROPAGATION", "propagationJEXLTransformer": null,
"pullJEXLTransformer": null, "transformers": [] }
], "linkingItems": [] }, "auxClasses": [],
"virSchemas": [] } ], "confOverride": [ { "schema": {
"name": "table", "displayName": "Table", "helpMessage": "Enter
the name of the table in the database that contains the accounts.",
"type": "java.lang.String", "required": true, "order": 7,
"confidential": false, "defaultValues": [ "" ]
}, "overridable": true, "values": [ "PRINTERS" ] },
{ "schema": { "name": "keyColumn", "displayName": "Key
Column", "helpMessage": "This mandatory column value will be used as
the unique identifier for rows in the table.", "type":
"java.lang.String", "required": true, "order": 8,
"confidential": false, "defaultValues": [ "" ]
}, "overridable": true, "values": [ "USERNAME" ] }
], "capabilitiesOverride": [ "AUTHENTICATE", "CREATE", "UPDATE",
"DELETE", "SEARCH", "SYNC" ], "propagationActions": []}
--
Sent from: http://syncope-user.1051894.n5.nabble.com/