File/includes/user-ldap.php

Description

LDAP user functions.

This file is intended to be used instead of the standard user.php file. I have not tested this yet (I do not have an LDAP server running yet), so please provide feedback.

This file contains all the functions for getting information about users. So, if you want to use an authentication scheme other than the webcal_user table, you can just create a new version of each function found below.

Note: this application assumes that usernames (logins) are unique.

Note #2: If you are using HTTP-based authentication, then you still need these functions and you will still need to add users to webcal_user.

  • author: Craig Knudsen <cknudsen@cknudsen.com>
  • copyright: Craig Knudsen, <cknudsen@cknudsen.com>, http://www.k5n.us/cknudsen
  • license: GNU GPL
Functions
connect_and_bind (line 680)

Connects and binds to the LDAP server Tries to connect as $ldap_admin_dn if we set it.

  • return: result or false
bind connect_and_bind ()
get_admins (line 609)

Searches $ldap_admin_group_dn and returns an array of the group members.

Do this search only once per request.

  • return: of admins
array get_admins ()
get_uid_from_dn (line 642)
void get_uid_from_dn ( $dn)
  • $dn
stripdn (line 670)

Strip everything but the username (uid) from a dn.

  • return: - userid ex: stripdn(uid=jeffh,ou=people,dc=example,dc=com) returns jeffh
string stripdn ($dn $dn)
  • $dn $dn: - the dn you want to strip the uid from.
user_is_admin (line 595)

Test if a user is an admin, that is: if the user is a member of a special group in the LDAP Server

  • return: Y if user is admin, N if not
char user_is_admin (string $uid, array $Admins)
  • string $uid: - the login name
  • array $Admins
user_search_dn (line 133)

Function to search the dn of a given user.

the error message will be placed in $error.

  • return: dn if the user is found, bool FALSE in other case
string user_search_dn ($login $login)
  • $login $login: - user login

Documentation generated on Thu, 10 Jun 2010 17:08:38 -0400 by phpDocumentor 1.4.3