Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 402] [Versions 400 and 403]
LDAP enrolment plugin implementation.
Author: | Iñaki Arenaza - based on code by Martin Dougiamas, Martin Langhoff and others |
Copyright: | 1999 onwards Martin Dougiamas {@link http://moodle.com} |
Copyright: | 2010 Iñaki Arenaza <iarenaza@eps.mondragon.edu> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1193 lines (58 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
enrol_ldap_plugin:: (18 methods):
__construct()
can_delete_instance()
can_hide_show_instance()
sync_user_enrolments()
sync_enrolments()
ldap_connect()
ldap_close()
find_ext_enrolments()
ldap_find_userdn()
ldap_find_user_groups()
ldap_find_user_groups_recursively()
ldap_explode_group()
create_course()
update_course()
restore_sync_course()
restore_instance()
restore_user_enrolment()
restore_role_assignment()
Class: enrol_ldap_plugin - X-Ref
__construct() X-Ref |
Constructor for the plugin. In addition to calling the parent constructor, we define and 'fix' some settings depending on the real settings the admin defined. |
can_delete_instance($instance) X-Ref |
Is it possible to delete enrol instance via standard UI? return: bool param: object $instance |
can_hide_show_instance($instance) X-Ref |
Is it possible to hide/show enrol instance via standard UI? return: bool param: stdClass $instance |
sync_user_enrolments($user) X-Ref |
Forces synchronisation of user enrolments with LDAP server. It creates courses if the plugin is configured to do so. return: void param: object $user user record |
sync_enrolments(progress_trace $trace, $onecourse = null) X-Ref |
Forces synchronisation of all enrolments with LDAP server. It creates courses if the plugin is configured to do so. return: void param: progress_trace $trace param: int|null $onecourse limit sync to one course->id, null if all courses |
ldap_connect(progress_trace $trace = null) X-Ref |
Connect to the LDAP server, using the plugin configured settings. It's actually a wrapper around ldap_connect_moodle() return: bool success param: progress_trace $trace |
ldap_close() X-Ref |
Disconnects from a LDAP server |
find_ext_enrolments($memberuid, $role) X-Ref |
Return multidimensional array with details of user courses (at least dn and idnumber). return: array param: string $memberuid user idnumber (without magic quotes). param: object role is a record from the mdl_role table. |
ldap_find_userdn($userid) X-Ref |
Search specified contexts for the specified userid and return the user dn like: cn=username,ou=suborg,o=org. It's actually a wrapper around ldap_find_userdn(). return: mixed the user dn or false param: string $userid the userid to search for (in external LDAP encoding, no magic quotes). |
ldap_find_user_groups($memberdn) X-Ref |
Find the groups a given distinguished name belongs to, both directly and indirectly via nested groups membership. return: array with member groups' distinguished names (can be emtpy) param: string $memberdn distinguished name to search |
ldap_find_user_groups_recursively($memberdn, &$membergroups) X-Ref |
Recursively process the groups the given member distinguished name belongs to, adding them to the already processed groups array. param: string $memberdn distinguished name to search param: array reference &$membergroups array with already found |
ldap_explode_group($group, $memberattribute) X-Ref |
Given a group name (either a RDN or a DN), get the list of users belonging to that group. If the group has nested groups, expand all the intermediate groups and return the full list of users that directly or indirectly belong to the group. return: array the list of users belonging to the group. If $group param: string $group the group name to search param: string $memberattibute the attribute that holds the members of the group |
create_course($course_ext, progress_trace $trace) X-Ref |
Will create the moodle course from the template course_ext is an array as obtained from ldap -- flattened somewhat return: mixed false on error, id for the newly created course otherwise. param: array $course_ext param: progress_trace $trace |
update_course($course, $externalcourse, progress_trace $trace) X-Ref |
Will update a moodle course with new values from LDAP A field will be updated only if it is marked to be updated on sync in plugin settings return: bool param: object $course param: array $externalcourse param: progress_trace $trace |
restore_sync_course($course) X-Ref |
Automatic enrol sync executed during restore. Useful for automatic sync by course->idnumber or course category. param: stdClass $course course record |
restore_instance(restore_enrolments_structure_step $step, stdClass $data, $course, $oldid) X-Ref |
Restore instance and map settings. param: restore_enrolments_structure_step $step param: stdClass $data param: stdClass $course param: int $oldid |
restore_user_enrolment(restore_enrolments_structure_step $step, $data, $instance, $userid, $oldinstancestatus) X-Ref |
Restore user enrolment. param: restore_enrolments_structure_step $step param: stdClass $data param: stdClass $instance param: int $oldinstancestatus param: int $userid |
restore_role_assignment($instance, $roleid, $userid, $contextid) X-Ref |
Restore role assignment. param: stdClass $instance param: int $roleid param: int $userid param: int $contextid |