relationship("UserOrganizationMembership") {
subject("User") {
attribute("organization") {
resolver {
resolutionType PER_OBJECT
search {
attributeFilter("member").eq(value)
}
}
}
}
object("Organization") {
attribute("member") {
resolver {
resolutionType PER_OBJECT
search {
attributeFilter("organization").eq(value)
}
}
}
}
}
relationship Concept
ConnID & schema for Connector allows you to specify some attributes as
reference to other objects.
The relationship describes connection between such objects, allows you
to specify subject and object in simple relationships.
Example
relationship definition
This example defines named relationship UserOrganizationMembership.
-
Useris subject of relationship, will contains virtual attributeorganizationwhich will list all organizations user is member of. -
Organizationis object of the relationship, and the list of allUserwho are members of that organization, will be available in virtual attributememberof Organization. -
The attributes
organizationandmemberare added to the object class schemas automatically - no need to define them also in schemas. -
They are virtual (
emulated) because they specifiedsearchresolverin order to determine their values. -
Example assumes filter support for searching using
organizationandmemberis also declared and specified.
Supporting implementations
To dynamically resolve values for virtual (emulated) attributes,
corresponding search support must be defined. If the systems does not
have general purpose search, you may need to determine REST endpoints
and add them to search support. This can be done in separate file eg.
User.Organization.support.search.groovy.
objectClass("Organization") {
search {
endpoint("users/{username}/orgs") {
responseFormat JSON_ARRAY
pagingSupport { // IDEA: lambda may delegate also to RequestBuilder
request.queryParameter("limit", paging.pageSize)
.queryParameter("page", paging.pageOffset)
}
supportedFilter(attribute("member").eq().anySingleValue()) {
request.pathParameter("username", value.value.name)
}
}
}
}
objectClass("User") {
search {
endpoint("orgs/{org}/members") {
responseFormat JSON_ARRAY
pagingSupport { // IDEA: lambda may delegate also to RequestBuilder
request.queryParameter("limit", paging.pageSize)
.queryParameter("page", paging.pageOffset)
}
supportedFilter(attribute("organization").eq().anySingleValue()) {
request.pathParameter("org", value.value.uid)
}
}
}
}