Moodle  2.2.1
http://www.collinsharper.com
auth_plugin_ldap Class Reference
Inheritance diagram for auth_plugin_ldap:
Collaboration diagram for auth_plugin_ldap:

Public Member Functions

 init_plugin ($authtype)
 auth_plugin_ldap ()
 user_login ($username, $password)
 get_userinfo ($username)
 get_userinfo_asobj ($username)
 get_userlist ()
 user_exists ($username)
 user_create ($userobject, $plainpass)
 can_reset_password ()
 can_signup ()
 user_signup ($user, $notify=true)
 can_confirm ()
 user_confirm ($username, $confirmsecret)
 password_expire ($username)
 sync_users ($do_updates=true)
 update_user_record ($username, $updatekeys=false)
 ldap_bulk_insert ($username)
 user_activate ($username)
 iscreator ($username)
 user_update ($olduser, $newuser)
 user_update_password ($user, $newpassword)
 ldap_expirationtime2unix ($time, $ldapconnection, $user_dn)
 ldap_unix2expirationtime ($time)
 ldap_attributes ()
 ldap_get_userlist ($filter='*')
 prevent_local_passwords ()
 is_internal ()
 can_change_password ()
 change_password_url ()
 loginpage_hook ()
 ntlmsso_magic ($sesskey)
 ntlmsso_finish ()
 sync_roles ($user)
 config_form ($config, $err, $user_fields)
 process_config ($config)
 ldap_get_ad_pwdexpire ($pwdlastset, $ldapconn, $user_dn)
 ldap_connect ()
 ldap_close ()
 ldap_find_userdn ($ldapconnection, $extusername)

Detailed Description

LDAP authentication plugin.

Definition at line 50 of file auth.php.


Member Function Documentation

Constructor with initialisation.

Definition at line 110 of file auth.php.

Returns true if this authentication plugin can change the user's password.

Returns:
bool

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 1474 of file auth.php.

Returns true if plugin allows confirming of new users.

Returns:
bool

Reimplemented from auth_plugin_base.

Definition at line 526 of file auth.php.

Returns true if plugin allows resetting of password from moodle.

Returns:
bool

Reimplemented from auth_plugin_base.

Definition at line 457 of file auth.php.

Returns true if plugin allows signup and user creation.

Returns:
bool

Reimplemented from auth_plugin_base.

Definition at line 466 of file auth.php.

Returns the URL for changing the user's password, or empty if the default can be used.

Returns:
moodle_url

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 1484 of file auth.php.

config_form ( config,
err,
user_fields 
)

Prints a form for configuring this authentication plugin.

This function is called from admin/auth.php, and outputs a full page with a form for configuring this plugin.

Parameters:
array$pageAn object containing all the data for this page.

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 1683 of file auth.php.

get_userinfo ( username)

Reads user information from ldap and returns it in array()

Function should return all information available. If you are saving this information to moodle user-table you should honor syncronization flags

Parameters:
string$usernameusername
Returns:
mixed array with no magic quotes or false on error

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 201 of file auth.php.

Here is the call graph for this function:

get_userinfo_asobj ( username)

Reads user information from ldap and returns it in an object

Parameters:
string$usernameusername (with system magic quotes)
Returns:
mixed object or false on error

Definition at line 271 of file auth.php.

Here is the call graph for this function:

Returns all usernames from LDAP

get_userlist returns all usernames from LDAP

Returns:
array

Definition at line 291 of file auth.php.

init_plugin ( authtype)

Init plugin config from database settings depending on the plugin auth type.

Definition at line 55 of file auth.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if this authentication plugin is 'internal'.

Returns:
bool

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 1464 of file auth.php.

iscreator ( username)

Returns true if user should be coursecreator.

Parameters:
mixed$usernameusername (without system magic quotes)
Returns:
mixed result null if course creators is not configured, boolean otherwise.

Reimplemented in auth_plugin_cas.

Definition at line 996 of file auth.php.

Here is the call graph for this function:

Returns user attribute mappings between moodle and LDAP

Returns:
array

Definition at line 1379 of file auth.php.

Here is the call graph for this function:

ldap_bulk_insert ( username)

Bulk insert in SQL's temp table

Definition at line 934 of file auth.php.

Here is the call graph for this function:

Disconnects from a LDAP server

Definition at line 1998 of file auth.php.

Connect to the LDAP server, using the plugin configured settings. It's actually a wrapper around ldap_connect_moodle()

Returns:
resource A valid LDAP connection (or dies if it can't connect)

Definition at line 1971 of file auth.php.

Here is the call graph for this function:

ldap_expirationtime2unix ( time,
ldapconnection,
user_dn 
)

Take expirationtime and return it as unix timestamp in seconds

Takes expiration timestamp as read from LDAP and returns it as unix timestamp in seconds Depends on $this->config->user_type variable

Parameters:
mixedtime Time stamp read from LDAP as it is.
string$ldapconnectionOnly needed for Active Directory.
string$user_dnUser distinguished name for the user we are checking password expiration (only needed for Active Directory).
Returns:
timestamp

Definition at line 1326 of file auth.php.

Here is the call graph for this function:

ldap_find_userdn ( ldapconnection,
extusername 
)

Search specified contexts for username and return the user dn like: cn=username,ou=suborg,o=org. It's actually a wrapper around ldap_find_userdn().

Parameters:
resource$ldapconnectiona valid LDAP connection
string$extusernamethe username to search (in external LDAP encoding, no db slashes)
Returns:
mixed the user dn (external LDAP encoding) or false

Definition at line 2015 of file auth.php.

Here is the call graph for this function:

Here is the caller graph for this function:

ldap_get_ad_pwdexpire ( pwdlastset,
ldapconn,
user_dn 
)

Get password expiration time for a given user from Active Directory

Parameters:
string$pwdlastsetThe time last time we changed the password.
resource$lcapconnThe open LDAP connection.
string$user_dnThe distinguished name of the user we are checking.
Returns:
string $unixtime

Definition at line 1838 of file auth.php.

Here is the call graph for this function:

ldap_get_userlist ( filter = '*')

Returns all usernames from LDAP

Parameters:
$filterAn LDAP search filter to select desired users
Returns:
array of LDAP user names converted to UTF-8

Definition at line 1399 of file auth.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Takes unix timestamp and returns it formated for storing in LDAP

Parameters:
integerunix time stamp

Definition at line 1356 of file auth.php.

Here is the call graph for this function:

Will get called before the login page is shownr. Ff NTLM SSO is enabled, and the user is in the right network, we'll redirect to the magic NTLM page for SSO...

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 1498 of file auth.php.

Here is the call graph for this function:

Find the session set by ntlmsso_magic(), validate it and call authenticate_user_login() to authenticate the user through the auth machinery.

It is complemented by a similar check in user_login().

If it succeeds, it never returns.

Definition at line 1612 of file auth.php.

Here is the call graph for this function:

ntlmsso_magic ( sesskey)

To be called from a page running under NTLM's "Integrated Windows Authentication".

If successful, it will set a special "cookie" (not an HTTP cookie!) in cache_flags under the $this->pluginconfig/ntlmsess "plugin" and return true. The "cookie" will be picked up by ntlmsso_finish() to complete the process.

On failure it will return false for the caller to display an appropriate error message (probably saying that Integrated Windows Auth isn't enabled!)

NOTE that this code will execute under the OS user credentials, so we MUST avoid dealing with files -- such as session files. (The caller should define('NO_MOODLE_COOKIES', true) before including config.php)

Definition at line 1571 of file auth.php.

Here is the call graph for this function:

password_expire ( username)

Return number of days to user password expires

If userpassword does not expire it should return 0. If password is already expired it should return negative value.

Parameters:
mixed$usernameusername
Returns:
integer

Reimplemented from auth_plugin_base.

Definition at line 570 of file auth.php.

Here is the call graph for this function:

Indicates if password hashes should be stored in local moodle database.

Returns:
bool true means flag 'not_cached' stored instead of password hash

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 1455 of file auth.php.

process_config ( config)

Processes and stores configuration data for this authentication plugin.

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 1697 of file auth.php.

Here is the call graph for this function:

sync_roles ( user)

Sync roles for this user

Parameters:
$userobject user object (without system magic quotes)

Reimplemented from auth_plugin_base.

Definition at line 1656 of file auth.php.

Here is the call graph for this function:

sync_users ( do_updates = true)

Syncronizes user fron external LDAP server to moodle user table

Sync is now using username attribute.

Syncing users removes or suspends users that dont exists anymore in external LDAP. Creates new users and updates coursecreator status of users.

Parameters:
bool$do_updateswill do pull in data updates from LDAP if relevant

Define table user to be created

preserve our user database if the temp table is empty, it probably means that something went wrong, exit so as to avoid mass deletion of users; which is hard to undo

User removal

Revive suspended users

User Updates - time-consuming (optional)

User Additions

Reimplemented in auth_plugin_cas.

Definition at line 613 of file auth.php.

Here is the call graph for this function:

update_user_record ( username,
updatekeys = false 
)

Update a local user record from an external source. This is a lighter version of the one in moodlelib -- won't do expensive ops such as enrolment.

If you don't pass $updatekeys, there is a performance hit and values removed from LDAP won't be removed from moodle.

Parameters:
string$usernameusername
boolean$updatekeystrue to update the local record with the external LDAP values.

Definition at line 888 of file auth.php.

Here is the call graph for this function:

user_activate ( username)

Activates (enables) user in external LDAP so user can login

Parameters:
mixed$username
Returns:
boolean result

Definition at line 949 of file auth.php.

Here is the call graph for this function:

user_confirm ( username,
confirmsecret 
)

Confirm the new user as registered.

Parameters:
string$username
string$confirmsecret

Reimplemented from auth_plugin_base.

Definition at line 536 of file auth.php.

Here is the call graph for this function:

user_create ( userobject,
plainpass 
)

Creates a new user on LDAP. By using information in userobject Use user_exists to prevent duplicate usernames

Parameters:
mixed$userobjectMoodle userobject
mixed$plainpassPlaintext password

Definition at line 317 of file auth.php.

Here is the call graph for this function:

user_exists ( username)

Checks if user exists on LDAP

Parameters:
string$username

Reimplemented from auth_plugin_base.

Definition at line 300 of file auth.php.

Here is the call graph for this function:

user_login ( username,
password 
)

Returns true if the username and password work and false if they are wrong or don't exist.

Parameters:
string$usernameThe username (without system magic quotes)
string$passwordThe password (without system magic quotes)
Returns:
bool Authentication success or failure.

Reimplemented from auth_plugin_base.

Reimplemented in auth_plugin_cas.

Definition at line 126 of file auth.php.

Here is the call graph for this function:

user_signup ( user,
notify = true 
)

Sign up a new user ready for confirmation. Password is passed in plaintext.

Parameters:
object$usernew user object
boolean$notifyprint notice with link and terminate

Reimplemented from auth_plugin_base.

Definition at line 477 of file auth.php.

Here is the call graph for this function:

user_update ( olduser,
newuser 
)

Called when the user record is updated.

Modifies user in external LDAP server. It takes olduser (before changes) and newuser (after changes) compares information and saves modified information to external LDAP server.

Parameters:
mixed$olduserUserobject before modifications (without system magic quotes)
mixed$newuserUserobject new modified userobject (without system magic quotes)
Returns:
boolean result

Reimplemented from auth_plugin_base.

Definition at line 1034 of file auth.php.

user_update_password ( user,
newpassword 
)

Changes userpassword in LDAP

Called when the user password is updated. It assumes it is called by an admin or that you've otherwise checked the user's credentials

Parameters:
object$userUser table object
string$newpasswordPlaintext password (not crypted/md5'ed)
Returns:
boolean result

Reimplemented from auth_plugin_base.

Definition at line 1207 of file auth.php.

Here is the call graph for this function:


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations