-
Notifications
You must be signed in to change notification settings - Fork 73
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.
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();
© 2016 IMS Global Learning Consortium Inc. All Rights Reserved. Trademark Policy - (www.imsglobal.org/trademarks)