Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

This file contains a class definition for the Memberships service

Author: Stephen Vickers
Copyright: 2015 Vital Source Technologies http://vitalsource.com
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 554 lines (26 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: memberships  - X-Ref

A service implementing Memberships.

__construct()   X-Ref
Class constructor.


get_resources()   X-Ref
Get the resources for this service.

return: array

get_permitted_scopes()   X-Ref
Get the scope(s) permitted for the tool relevant to this service.

return: array

get_scopes()   X-Ref
Get the scope(s) defined by this service.

return: array

get_users_json($resource, $context, $contextid, $tool, $role, $limitfrom, $limitnum, $lti, $info)   X-Ref
Get the JSON for members.

param: \mod_lti\local\ltiservice\resource_base $resource       Resource handling the request
param: \context_course   $context    Course context
param: string            $contextid  Course ID
param: object            $tool       Tool instance object
param: string            $role       User role requested (empty if none)
param: int               $limitfrom  Position of first record to be returned
param: int               $limitnum   Maximum number of records to be returned
param: object            $lti        LTI instance record
param: \core_availability\info_module $info Conditional availability information
return: string

get_members_json($resource, $context, $course, $role, $limitfrom, $limitnum, $lti, $info, $response)   X-Ref
Get the JSON for members.

param: \mod_lti\local\ltiservice\resource_base $resource       Resource handling the request
param: \context_course   $context    Course context
param: \course           $course     Course
param: string            $role       User role requested (empty if none)
param: int               $limitfrom  Position of first record to be returned
param: int               $limitnum   Maximum number of records to be returned
param: object            $lti        LTI instance record
param: \core_availability\info_module $info Conditional availability information
param: \mod_lti\local\ltiservice\response $response       Response object for the request
return: string

users_to_jsonld($resource, $users, $contextid, $exclude, $limitfrom, $limitnum,$lti, $info, $response)   X-Ref
Get the JSON-LD representation of the users.

Note that when a limit is set and the exclude array is not empty, then the number of memberships
returned may be less than the limit.

param: \mod_lti\local\ltiservice\resource_base $resource       Resource handling the request
param: array  $users               Array of user records
param: string $contextid           Course ID
param: array  $exclude             Array of user records to be excluded from the response
param: int    $limitfrom           Position of first record to be returned
param: int    $limitnum            Maximum number of records to be returned
param: object $lti                 LTI instance record
param: \core_availability\info_module $info Conditional availability information
param: \mod_lti\local\ltiservice\response $response       Response object for the request
return: string

users_to_json($resource, $users, $course, $exclude, $limitfrom, $limitnum,$lti, $info, $response)   X-Ref
Get the NRP service JSON representation of the users.

Note that when a limit is set and the exclude array is not empty, then the number of memberships
returned may be less than the limit.

param: \mod_lti\local\ltiservice\resource_base $resource       Resource handling the request
param: array   $users               Array of user records
param: \course $course              Course
param: array   $exclude             Array of user records to be excluded from the response
param: int     $limitfrom           Position of first record to be returned
param: int     $limitnum            Maximum number of records to be returned
param: object  $lti                 LTI instance record
param: \core_availability\info_module  $info     Conditional availability information for LTI instance
param: \mod_lti\local\ltiservice\response $response       Response object for the request
return: string

is_allowed_field_set($toolconfig, $instanceconfig, $fields)   X-Ref
Determines whether a user attribute may be used as part of LTI membership

param: array             $toolconfig      Tool config
param: object            $instanceconfig  Tool instance config
param: array             $fields          Set of fields to return if allowed or not
return: array Verification which associates an attribute with a boolean (allowed or not)

get_configuration_options(&$mform)   X-Ref
Adds form elements for membership add/edit page.

param: \MoodleQuickForm $mform

get_launch_parameters($messagetype, $courseid, $user, $typeid, $modlti = null)   X-Ref
Return an array of key/values to add to the launch parameters.

param: string $messagetype 'basic-lti-launch-request' or 'ContentItemSelectionRequest'.
param: string $courseid The course id.
param: string $user The user id.
param: string $typeid The tool lti type id.
param: string $modlti The id of the lti activity.
return: array of key/value pairs to add as launch parameters.