PHP Class auth_plugin_authldap, dokuwiki

Author: Andreas Gohr ([email protected])
Author: Chris Smith ([email protected])
Author: Jan Schumann ([email protected])
Inheritance: extends DokuWiki_Auth_Plugin
Exibir arquivo Open project: splitbrain/dokuwiki

Protected Properties

Property Type Description
$_pattern * @var array $_pattern User filter pattern
$bound * @var int $bound What type of connection does already exist?
$con * @var resource $con holds the LDAP connection
$users * @var array $users User data cache

Public Methods

Method Description
__construct ( ) Constructor
checkPass ( string $user, string $pass ) : boolean Check user+password
getUserData ( string $user, boolean $requireGroups = true ) : array Return user info
isCaseSensitive ( ) : boolean Most values in LDAP are case-insensitive
modifyUser ( string $user, array $changes ) : boolean Definition of the function modifyUser in order to modify the password
retrieveUsers ( integer $start, integer $limit, array $filter = [] ) : array Bulk retrieval of user data

Protected Methods

Method Description
_constructPattern ( $filter ) : void Set the filter pattern
_debug ( string $message, integer $err, integer $line, string $file ) : void Wrapper around msg() but outputs only when debug is enabled
_filter ( string $user, array $info ) : boolean return true if $user + $info match $filter criteria, false otherwise
_filterEscape ( string $string ) : string Escape a string to be used in a LDAP filter
_getUserData ( string $user, boolean $inbind = false ) : array
_ldapsearch ( resource $link_identifier, string $base_dn, string $filter, string $scope = 'sub', null | array $attributes = null, integer $attrsonly, integer $sizelimit ) : resource Wraps around ldap_search, ldap_list or ldap_read depending on $scope
_makeFilter ( string $filter, array $placeholders ) : string Make LDAP filter strings.
_openLDAP ( ) Opens a connection to the configured LDAP server and sets the wanted option on the connection

Method Details

__construct() public method

Constructor
public __construct ( )

_constructPattern() protected method

Set the filter pattern
Author: Chris Smith ([email protected])
protected _constructPattern ( $filter ) : void
$filter
return void

_debug() protected method

Wrapper around msg() but outputs only when debug is enabled
protected _debug ( string $message, integer $err, integer $line, string $file ) : void
$message string
$err integer
$line integer
$file string
return void

_filter() protected method

return true if $user + $info match $filter criteria, false otherwise
Author: Chris Smith ([email protected])
protected _filter ( string $user, array $info ) : boolean
$user string the user's login name
$info array the user's userinfo array
return boolean

_filterEscape() protected method

Ported from Perl's Net::LDAP::Util escape_filter_value
Author: Andreas Gohr
protected _filterEscape ( string $string ) : string
$string string
return string

_getUserData() protected method

protected _getUserData ( string $user, boolean $inbind = false ) : array
$user string
$inbind boolean authldap specific, true if in bind phase
return array containing user data or false

_ldapsearch() protected method

Wraps around ldap_search, ldap_list or ldap_read depending on $scope
Author: Andreas Gohr ([email protected])
protected _ldapsearch ( resource $link_identifier, string $base_dn, string $filter, string $scope = 'sub', null | array $attributes = null, integer $attrsonly, integer $sizelimit ) : resource
$link_identifier resource
$base_dn string
$filter string
$scope string can be 'base', 'one' or 'sub'
$attributes null | array
$attrsonly integer
$sizelimit integer
return resource

_makeFilter() protected method

Used by auth_getUserData to make the filter strings for grouptree and groupfilter
Author: Troels Liebe Bentsen ([email protected])
protected _makeFilter ( string $filter, array $placeholders ) : string
$filter string ldap search filter with placeholders
$placeholders array placeholders to fill in
return string

_openLDAP() protected method

Opens a connection to the configured LDAP server and sets the wanted option on the connection
Author: Andreas Gohr ([email protected])
protected _openLDAP ( )

checkPass() public method

Checks if the given user exists and the given plaintext password is correct by trying to bind to the LDAP server
Author: Andreas Gohr ([email protected])
public checkPass ( string $user, string $pass ) : boolean
$user string
$pass string
return boolean

getUserData() public method

Returns info about the given user needs to contain at least these fields: name string full name of the user mail string email addres of the user grps array list of groups the user is in This LDAP specific function returns the following addional fields: dn string distinguished name (DN) uid string Posix User ID inbind bool for internal use - avoid loop in binding
Author: Andreas Gohr ([email protected])
Author: Trouble
Author: Dan Allen ([email protected])
Author: ([email protected])
Author: Stephane Chazelas ([email protected])
Author: Steffen Schoch ([email protected])
public getUserData ( string $user, boolean $requireGroups = true ) : array
$user string
$requireGroups boolean (optional) - ignored, groups are always supplied by this plugin
return array containing user data or false

isCaseSensitive() public method

Most values in LDAP are case-insensitive
public isCaseSensitive ( ) : boolean
return boolean

modifyUser() public method

Definition of the function modifyUser in order to modify the password
public modifyUser ( string $user, array $changes ) : boolean
$user string nick of the user to be changed
$changes array array of field/value pairs to be changed (password will be clear text)
return boolean true on success, false on error

retrieveUsers() public method

Bulk retrieval of user data
Author: Dominik Eckelmann ([email protected])
public retrieveUsers ( integer $start, integer $limit, array $filter = [] ) : array
$start integer index of first user to be returned
$limit integer max number of users to be returned
$filter array array of field/pattern pairs, null for no filter
return array of userinfo (refer getUserData for internal userinfo details)

Property Details

$_pattern protected_oe property

* @var array $_pattern User filter pattern
protected $_pattern

$bound protected_oe property

* @var int $bound What type of connection does already exist?
protected $bound

$con protected_oe property

* @var resource $con holds the LDAP connection
protected $con

$users protected_oe property

* @var array $users User data cache
protected $users