Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

(no description)

File Size: 353 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: user_repository  - X-Ref

Class user_repository.

This class encapsulates persistence logic for \enrol_lti\local\entity\user type objects.

user_from_record(\stdClass $userrecord)   X-Ref
Convert a record into a user object and return it.

return: user a user object.
param: \stdClass $userrecord the raw data from relevant tables required to instantiate a user.

users_from_records(array $records)   X-Ref
Create a list of user instances from a list of records.

return: array of user instances.
param: array $records the array of records.

user_record_from_user(user $user)   X-Ref
Get a stdClass object ready for persisting, based on the supplied user object.

return: \stdClass the record.
param: user $user the user instance.

lti_user_record_from_user(user $user)   X-Ref
Create the corresponding enrol_lti_user record from a user instance.

return: \stdClass the record.
param: user $user the user instance.

user_exists_for_tool(user $user)   X-Ref
Helper to validate user:tool uniqueness across a deployment.

The DB cannot be relied on to do this uniqueness check, since the table is shared by LTI 1.1/2.0 data.

return: bool true if found, false otherwise.
param: user $user the user instance.

save(user $user)   X-Ref
Save a user instance in the store.

return: user the saved object.
param: user $user the object to save.

find(int $id)   X-Ref
Find and return a user by id.

return: user|null the user object, or null if the object cannot be found.
param: int $id the id of the user object.

find_single_user_by_resource(int $userid, int $resourceid)   X-Ref
Find an lti user instance by resource.

return: user|null the lti user instance, or null if not found.
param: int $userid the id of the moodle user to look for.
param: int $resourceid the id of the published resource.

find_by_resource(int $resourceid)   X-Ref
Find all users for a particular shared resource.

return: array the array of users, empty if none were found.
param: int $resourceid the id of the shared resource.

find_by_resource_link(int $resourcelinkid)   X-Ref
Get a list of users associated with the given resource link.

return: array the array of users, empty if none were found.
param: int $resourcelinkid the id of the resource_link instance with which the users are associated.

exists(int $id)   X-Ref
Check whether or not the given user object exists.

return: bool true if found, false otherwise.
param: int $id the unique id the user.

delete(int $id)   X-Ref
Delete a user based on id.

param: int $id the id of the user to remove.

delete_by_deployment(int $deploymentid)   X-Ref
Delete all lti user instances based on a given local deployment instance id.

param: int $deploymentid the local id of the deployment instance to which the users belong.