[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/auth/ldap/ -> auth.php (summary)

(no description)

Author: Martin Dougiamas
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 2205 lines (89 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 auth/ldap/config.html

Defines 1 class

auth_plugin_ldap:: (44 methods):
  auth_plugin_ldap()
  user_login()
  get_userinfo()
  get_userinfo_asobj()
  get_userlist()
  user_exists()
  user_create()
  can_reset_password()
  can_signup()
  user_signup()
  can_confirm()
  user_confirm()
  password_expire()
  sync_users()
  update_user_record()
  ldap_bulk_insert()
  user_activate()
  iscreator()
  user_update()
  user_update_password()
  ldap_suppported_usertypes()
  ldap_getdefaults()
  ldap_getbinaryfields()
  ldap_isbinary()
  ldap_expirationtime2unix()
  ldap_unix2expirationtime()
  ldap_isgroupmember()
  ldap_connect()
  ldap_find_userdn()
  ldap_attributes()
  ldap_get_userlist()
  ldap_get_entries()
  is_internal()
  can_change_password()
  change_password_url()
  loginpage_hook()
  ntlmsso_magic()
  ntlmsso_finish()
  sync_roles()
  config_form()
  process_config()
  filter_addslashes()
  ldap_addslashes()
  ldap_get_ad_pwdexpire()


Class: auth_plugin_ldap  - X-Ref

LDAP authentication plugin.

auth_plugin_ldap()   X-Ref
Constructor with initialisation.


user_login($username, $password)   X-Ref
Returns true if the username and password work and false if they are
wrong or don't exist.

param: string $username The username (with system magic quotes)
param: string $password The password (with system magic quotes)
return: bool Authentication success or failure.

get_userinfo($username)   X-Ref
reads userinformation from ldap and return it in array()

Read user information from external database and returns it as array().
Function should return all information available. If you are saving
this information to moodle user-table you should honor syncronization flags

param: string $username username (with system magic quotes)
return: mixed array with no magic quotes or false on error

get_userinfo_asobj($username)   X-Ref
reads userinformation from ldap and return it in an object

param: string $username username (with system magic quotes)
return: mixed object or false on error

get_userlist()   X-Ref
returns all usernames from external database

get_userlist returns all usernames from external database

return: array

user_exists($username)   X-Ref
checks if user exists on external db

param: string $username (with system magic quotes)

user_create($userobject, $plainpass)   X-Ref
Creates a new user on external database.
By using information in userobject
Use user_exists to prevent dublicate usernames

param: mixed $userobject  Moodle userobject  (with system magic quotes)
param: mixed $plainpass   Plaintext password (with system magic quotes)

can_reset_password()   X-Ref
No description

can_signup()   X-Ref
No description

user_signup($user, $notify=true)   X-Ref
Sign up a new user ready for confirmation.
Password is passed in plaintext.

param: object $user new user object (with system magic quotes)
param: boolean $notify print notice with link and terminate

can_confirm()   X-Ref
Returns true if plugin allows confirming of new users.

return: bool

user_confirm($username, $confirmsecret)   X-Ref
Confirm the new user as registered.

param: string $username (with system magic quotes)
param: string $confirmsecret (with system magic quotes)

password_expire($username)   X-Ref
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.

param: mixed $username username (with system magic quotes)
return: integer

sync_users($bulk_insert_records = 1000, $do_updates = true)   X-Ref
syncronizes user fron external db to moodle user table

Sync is now using username attribute.

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

param: int $bulk_insert_records will insert $bulkinsert_records per insert statement
param: bool $do_updates will do pull in data updates from ldap if relevant

update_user_record($username, $updatekeys = false)   X-Ref
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.

param: string $username username (with system magic quotes)

ldap_bulk_insert($users, $temptable)   X-Ref
Bulk insert in SQL's temp table

param: array $users is an array of usernames

user_activate($username)   X-Ref
Activates (enables) user in external db so user can login to external db

param: mixed $username    username (with system magic quotes)
return: boolen result

iscreator($username)   X-Ref
Returns true if user should be coursecreator.

param: mixed $username    username (without system magic quotes)
return: boolean result

user_update($olduser, $newuser)   X-Ref
Called when the user record is updated.
Modifies user in external database. It takes olduser (before changes) and newuser (after changes)
conpares information saved modified information to external db.

param: mixed $olduser     Userobject before modifications    (without system magic quotes)
param: mixed $newuser     Userobject new modified userobject (without system magic quotes)
return: boolean result

user_update_password($user, $newpassword)   X-Ref
changes userpassword in external db

called when the user password is updated.
changes userpassword in external db

param: object  $user        User table object  (with system magic quotes)
param: string  $newpassword Plaintext password (with system magic quotes)
return: boolean result

ldap_suppported_usertypes()   X-Ref
returns predefined usertypes

return: array of predefined usertypes

ldap_getdefaults()   X-Ref
Initializes needed variables for ldap-module

Uses names defined in ldap_supported_usertypes.
$default is first defined as:
$default['pseudoname'] = array(
'typename1' => 'value',
'typename2' => 'value'
....
);

return: array of default values

ldap_getbinaryfields()   X-Ref
return binaryfields of selected usertype

return: array

ldap_isbinary($field)   X-Ref
No description

ldap_expirationtime2unix($time, $ldapconnection, $user_dn)   X-Ref
take expirationtime and return it as unixseconds

takes expriration timestamp as readed from ldap
returns it as unix seconds
depends on $this->config->user_type variable

param: mixed time   Time stamp readed from ldap as it is.
param: string $ldapconnection Just needed for Active Directory.
param: string $user_dn User distinguished name for the user we are checking password expiration (just needed for Active Directory).
return: timestamp

ldap_unix2expirationtime($time)   X-Ref
takes unixtime and return it formated for storing in ldap

param: integer unix time stamp

ldap_isgroupmember($extusername='', $groupdns='')   X-Ref
checks if user belong to specific group(s)
or is in a subtree.

Returns true if user belongs group in grupdns string OR
if the DN of the user is in a subtree pf the DN provided
as "group"

param: mixed $username    username
param: mixed $groupdns    string of group dn separated by ;

ldap_connect($binddn='',$bindpwd='')   X-Ref
connects to ldap server

Tries connect to specified ldap servers.
Returns connection result or error.

return: connection result

ldap_find_userdn($ldapconnection, $extusername)   X-Ref
retuns dn of username

Search specified contexts for username and return user dn
like: cn=username,ou=suborg,o=org

param: mixed $ldapconnection  $ldapconnection result
param: mixed $username username (external encoding no slashes)

ldap_attributes()   X-Ref
retuns user attribute mappings between moodle and ldap

return: array

ldap_get_userlist($filter="*")   X-Ref
return all usernames from ldap

return: array

ldap_get_entries($conn, $searchresult)   X-Ref
return entries from ldap

Returns values like ldap_get_entries but is
binary compatible and return all attributes as array

return: array ldap-entries

is_internal()   X-Ref
Returns true if this authentication plugin is 'internal'.

return: bool

can_change_password()   X-Ref
Returns true if this authentication plugin can change the user's
password.

return: bool

change_password_url()   X-Ref
Returns the URL for changing the user's pw, or empty if the default can
be used.

return: string url

loginpage_hook()   X-Ref
Will get called before the login page is shown, if NTLM SSO
is enabled, and the user is in the right network, we'll redirect
to the magic NTLM page for SSO...


ntlmsso_magic($sesskey)   X-Ref
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 "auth/ldap/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 set $nomoodlecookie before including config.php)


ntlmsso_finish()   X-Ref
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.


sync_roles($user)   X-Ref
Sync roles for this user

param: $user object user object (without system magic quotes)

config_form($config, $err, $user_fields)   X-Ref
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.

param: array $page An object containing all the data for this page.

process_config($config)   X-Ref
Processes and stores configuration data for this authentication plugin.


filter_addslashes($text)   X-Ref
Quote control characters in texts used in ldap filters - see rfc2254.txt

param: string

ldap_addslashes($text)   X-Ref
Quote control characters in quoted "texts" used in ldap

param: string

ldap_get_ad_pwdexpire($pwdlastset, $ldapconn, $user_dn)   X-Ref
Get password expiration time for a given user from Active Directory

param: string $pwdlastset The time last time we changed the password.
param: resource $lcapconn The open LDAP connection.
param: string $user_dn The distinguished name of the user we are checking.
return: string $unixtime



Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7