Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Names and Role Provisioning Service

Mark Ramon edited this page Oct 25, 2017 · 1 revision

Names and Role Provisioning Service

The Names and Role Provisioning Service allows a tool provider to obtain a list of users enrolled in a context. The response is returned as an array of User objects. The context may be obtained by using its primary key, its context ID or via a resource link ID which is known to belong to that context:

$context = ToolProvider\Context::fromRecordId($context_pk);
$consumer = new ToolProvider\ToolConsumer($consumer_key, $db_connector);
$context = ToolProvider\Context::fromConsumer($consumer, $context_id);
$consumer = new ToolProvider\ToolConsumer($consumer_key, $db_connector);
$resource_link = ToolProvider\ResourceLink::fromConsumer($consumer, $resource_link_id);
$context = $resource_link->getContext();

The memberships for the context can then be obtained by a simple call to the getMembership method.

$users = $context->getMembership();

Similarly, use the resource link instance to get a list of users with acces to the resource link:

$users = $resource_link->getMembership();

Note that the role and limit options of this service are not yet supported.

Memberships extension service

The doMembershipsService() method allows a tool provider to request a list of users with access to the resource link from the tool consumer. The method returns an array of User objects.

$users = $resource_link->doMembershipsService();