PHP Class AuthLDAP, glpi

Inheritance: extends AuthPluginBase
Afficher le fichier Open project: glpi-project/glpi Class Usage Examples

Méthodes publiques

Свойство Type Description
$dohistory From CommonDBTM
$rightname

Méthodes publiques

Méthode Description
addTimestampRestrictions ( $begin_date, $end_date )
canCreate ( )
canPurge ( )
cleanDBonPurge ( )
connect ( ) Open LDAP connexion to current serveur
connectToServer ( $host, $port, $login = "", $password = "", $use_tls = false, $deref_options ) : link Connect to a LDAP serveur
date2ldapTimeStamp ( $date ) : ldap Converts a Unix timestamp to an LDAP timestamps
defineTabs ( $options = [] )
displayLdapFilter ( $target, $users = true ) : nothing Display LDAP filter
displaySizeLimitWarning ( $limitexceeded = false )
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
dnExistsInLdap ( $ldap_infos, $user_dn ) : false Check if a user DN exists in a ldap user search result
dropdownGroupSearchType ( array $options )
dropdownUserDeletedActions ( $value )
getAllGroups ( $auths_id, $filter, $filter2, $entity, &$limitexceeded, $order = 'DESC' ) : array Get all LDAP groups from a ldap server which are not already in an entity
getAllReplicateForAMaster ( $master_id ) : array Get all replicate servers for a master one
getAllUsers ( $options = [], &$results, &$limitexceeded ) : array Get the list of LDAP users to add/synchronize
getDefault ( )
getGroupByDn ( $ds, $group_dn ) : group Get infos for groups
getGroupCNByDn ( $ldap_connection, $group_dn ) : the Get the group's cn by giving his DN
getGroupSearchTypeName ( $val = NULL ) : array Get the possible value for contract alert
getGroupsFromLDAP ( $ldap_connection, $config_ldap, $filter, $search_in_groups = true, $groups = [], &$limitexceeded )
getLdapServers ( )
getNumberOfServers ( )
getObjectByDn ( $ds, $condition, $dn, $attrs = [], $clean = true ) Get an object from LDAP by giving his DN
getSearchOptions ( )
getServersWithImportByEmailActive ( ) : array Return all the ldap servers where email field is configured
getSpecificValueToDisplay ( $field, $values, array $options = [] )
getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] )
getSyncFields ( array $authtype_array ) : array Get LDAP fields to sync to GLPI data from a glpi_authldaps array
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTypeName ( $nb )
getUserByDn ( $ds, $user_dn, $attrs, $clean = true )
get_entries_clean ( $link, $result ) : an Get ldap query results and clean them at the same time
importUserFromServers ( $options = [] ) Import a user from ldap Check all the directories. When the user is found, then import it
isLdapPageSizeAvailable ( $config_ldap, $check_config_value = true ) Check if ldap results can be paged or not This functionnality is available for PHP 5.4 and higer
ldapAuth ( $auth, $login, $password, $ldap_method, $user_dn ) : identification Authentify a user by checking a specific directory
ldapChooseDirectory ( $target ) : nothing Form to choose a ldap server
ldapImportGroup ( $group_dn, $options = [] ) : nothing Converts an array of parameters into a query string to be appended to a URL.
ldapImportUserByServerId ( $params = [], $action, $ldap_server, $display = false ) : array Import a user from a specific ldap server
ldapStamp2UnixStamp ( $ldapstamp, $ldap_time_offset ) : unix Converts LDAP timestamps over to Unix timestamps
local_cmp ( $a, $b )
manageValuesInSession ( $options = [], $delete = false )
post_addItem ( )
post_getEmpty ( )
post_updateItem ( $history = 1 )
preconfig ( $type ) : nothing Preconfig datas for standard system
prepareInputForAdd ( $input )
prepareInputForUpdate ( $input )
processMassiveActionsForOneItemtype ( MassiveAction $ma, CommonDBTM $item, array $ids )
searchForUsers ( $ds, $values, $filter, $attrs, &$limitexceeded, &$user_infos, &$ldap_users, $config_ldap )
searchUser ( AuthLDAP $authldap )
searchUserDn ( $ds, $options = [] ) : dn Get dn for a user
showDateRestrictionForm ( $options = [] )
showForm ( $ID, $options = [] ) : Nothing Print the auth ldap form
showFormAdvancedConfig ( )
showFormEntityConfig ( )
showFormGroupsConfig ( )
showFormReplicatesConfig ( )
showFormTestLDAP ( )
showFormUserConfig ( )
showLdapGroups ( $target, $start, $sync, $filter = '', $filter2 = '', $entity, $order = 'DESC' ) : nothing Show LDAP groups to add or synchronise in an entity
showLdapUsers ( ) : nothing Show LDAP users to add or synchronise
showSystemInformations ( $width )
showUserImportForm ( AuthLDAP $authldap )
testLDAPConnection ( $auths_id, $replicate_id ) : boolean Test a LDAP connection
tryLdapAuth ( $auth, $login, $password, $auths_id, $user_dn = false, $break = true ) : identification Try to authentify a user by checking all the directories
tryToConnectToServer ( $ldap_method, $login, $password ) : link Try to connect to a ldap server
unsetUndisclosedFields ( &$fields )
useAuthLdap ( ) : boolean Is the LDAP authentication used ?

Private Methods

Méthode Description
buildLdapFilter ( AuthLdap $authldap )

Method Details

addTimestampRestrictions() static public méthode

static public addTimestampRestrictions ( $begin_date, $end_date )
$begin_date datetime begin date to search (NULL if not take into account)
$end_date datetime end date to search (NULL if not take into account)

canCreate() static public méthode

static public canCreate ( )

canPurge() static public méthode

static public canPurge ( )

cleanDBonPurge() public méthode

public cleanDBonPurge ( )

connect() public méthode

Open LDAP connexion to current serveur
public connect ( )

connectToServer() static public méthode

Connect to a LDAP serveur
static public connectToServer ( $host, $port, $login = "", $password = "", $use_tls = false, $deref_options ) : link
$host LDAP host to connect
$port port to use
$login login to use (default '')
$password password to use (default '')
$use_tls use a tls connection ? (false by default)
$deref_options deref options used
Résultat link to the LDAP server : false if connection failed

date2ldapTimeStamp() static public méthode

Converts a Unix timestamp to an LDAP timestamps
static public date2ldapTimeStamp ( $date ) : ldap
$date datetime
Résultat ldap timestamp

defineTabs() public méthode

public defineTabs ( $options = [] )

displayLdapFilter() static public méthode

Display LDAP filter
static public displayLdapFilter ( $target, $users = true ) : nothing
$target target for the form
$users boolean for user ? (true by default)
Résultat nothing

displaySizeLimitWarning() static public méthode

static public displaySizeLimitWarning ( $limitexceeded = false )
$limitexceeded (false by default)

displayTabContentForItem() static public méthode

static public displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
$item CommonGLPI

dnExistsInLdap() static public méthode

Check if a user DN exists in a ldap user search result
static public dnExistsInLdap ( $ldap_infos, $user_dn ) : false
$ldap_infos ldap user search result
$user_dn user dn to look for
Résultat false if the user dn doesn't exist, user ldap infos otherwise

dropdownGroupSearchType() static public méthode

static public dropdownGroupSearchType ( array $options )
$options array array

dropdownUserDeletedActions() static public méthode

static public dropdownUserDeletedActions ( $value )
$value (default 0)

getAllGroups() static public méthode

Get all LDAP groups from a ldap server which are not already in an entity
static public getAllGroups ( $auths_id, $filter, $filter2, $entity, &$limitexceeded, $order = 'DESC' ) : array
$auths_id ID of the server to use
$filter ldap filter to use
$filter2 second ldap filter to use if needed
$entity entity to search
$limitexceeded
$order order to use (default DESC)
Résultat array of the groups

getAllReplicateForAMaster() static public méthode

Get all replicate servers for a master one
static public getAllReplicateForAMaster ( $master_id ) : array
$master_id : master ldap server ID
Résultat array of the replicate servers

getAllUsers() static public méthode

Get the list of LDAP users to add/synchronize
static public getAllUsers ( $options = [], &$results, &$limitexceeded ) : array
$options array of possible options: - authldaps_id ID of the server to use - mode user to synchronise or add ? - ldap_filter ldap filter to use - basedn force basedn (default authldaps_id one) - order display order - begin_date begin date to time limit - end_date end date to time limit - script true if called by an external script
Résultat array of the user

getDefault() static public méthode

static public getDefault ( )

getGroupByDn() static public méthode

Get infos for groups
static public getGroupByDn ( $ds, $group_dn ) : group
$ds LDAP link
$group_dn dn of the group
Résultat group infos if found, else false

getGroupCNByDn() static public méthode

Get the group's cn by giving his DN
static public getGroupCNByDn ( $ldap_connection, $group_dn ) : the
$ldap_connection ldap connection to use
$group_dn the group's dn
Résultat the group cn

getGroupSearchTypeName() static public méthode

Get the possible value for contract alert
static public getGroupSearchTypeName ( $val = NULL ) : array
$val if not set, ask for all values, else for 1 value (default NULL)
Résultat array or string

getGroupsFromLDAP() static public méthode

static public getGroupsFromLDAP ( $ldap_connection, $config_ldap, $filter, $search_in_groups = true, $groups = [], &$limitexceeded )
$ldap_connection
$config_ldap
$filter
$search_in_groups (true by default)
$groups array
$limitexceeded

getLdapServers() static public méthode

static public getLdapServers ( )

getNumberOfServers() static public méthode

static public getNumberOfServers ( )

getObjectByDn() static public méthode

Get an object from LDAP by giving his DN
static public getObjectByDn ( $ds, $condition, $dn, $attrs = [], $clean = true )
$dn string DN of the object
$clean (true by default)

getSearchOptions() public méthode

public getSearchOptions ( )

getServersWithImportByEmailActive() static public méthode

Return all the ldap servers where email field is configured
static public getServersWithImportByEmailActive ( ) : array
Résultat array of LDAP server's ID

getSpecificValueToDisplay() static public méthode

static public getSpecificValueToDisplay ( $field, $values, array $options = [] )
$field
$values
$options array array

getSpecificValueToSelect() static public méthode

static public getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] )
$field
$name (default '')
$values (default('')
$options array array

getSyncFields() static public méthode

Get LDAP fields to sync to GLPI data from a glpi_authldaps array
static public getSyncFields ( array $authtype_array ) : array
$authtype_array array array Authentication method config array (from table)
Résultat array of "user table field name" => "config value"

getTabNameForItem() public méthode

public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTypeName() static public méthode

static public getTypeName ( $nb )

getUserByDn() static public méthode

static public getUserByDn ( $ds, $user_dn, $attrs, $clean = true )
$ds
$user_dn
$attrs
$clean (true by default)

get_entries_clean() static public méthode

Get ldap query results and clean them at the same time
static public get_entries_clean ( $link, $result ) : an
Résultat an array which contains ldap query results

importUserFromServers() static public méthode

Import a user from ldap Check all the directories. When the user is found, then import it
static public importUserFromServers ( $options = [] )
$options array containing condition: array('name'=>'glpi') or array('email' => 'test at test.com')

isLdapPageSizeAvailable() static public méthode

Check if ldap results can be paged or not This functionnality is available for PHP 5.4 and higer
Since: 0.84 return true if maxPageSize can be used, false otherwise
static public isLdapPageSizeAvailable ( $config_ldap, $check_config_value = true )

ldapAuth() static public méthode

Authentify a user by checking a specific directory
static public ldapAuth ( $auth, $login, $password, $ldap_method, $user_dn ) : identification
$auth identification object
$login user login
$password user password
$ldap_method ldap_method array to use
$user_dn user LDAP DN if present
Résultat identification object

ldapChooseDirectory() static public méthode

Form to choose a ldap server
static public ldapChooseDirectory ( $target ) : nothing
$target target page for the form
Résultat nothing

ldapImportGroup() static public méthode

Converts an array of parameters into a query string to be appended to a URL.
static public ldapImportGroup ( $group_dn, $options = [] ) : nothing
$group_dn dn of the group to import
$options array for - authldaps_id - entities_id where group must to be imported - is_recursive
Résultat nothing

ldapImportUserByServerId() static public méthode

Import a user from a specific ldap server
static public ldapImportUserByServerId ( $params = [], $action, $ldap_server, $display = false ) : array
$params array of parameters: method (IDENTIFIER_LOGIN or IDENTIFIER_EMAIL) + value
$action synchoronize (true) or import (false)
$ldap_server ID of the LDAP server to use
$display display message information on redirect (false by default)
Résultat array with state, else false

ldapStamp2UnixStamp() static public méthode

Converts LDAP timestamps over to Unix timestamps
static public ldapStamp2UnixStamp ( $ldapstamp, $ldap_time_offset ) : unix
$ldapstamp LDAP timestamp
$ldap_time_offset time offset (default 0)
Résultat unix timestamp

local_cmp() public méthode

public local_cmp ( $a, $b )

manageValuesInSession() static public méthode

static public manageValuesInSession ( $options = [], $delete = false )
$options array
$delete (false by default)

post_addItem() public méthode

public post_addItem ( )

post_getEmpty() public méthode

public post_getEmpty ( )

post_updateItem() public méthode

public post_updateItem ( $history = 1 )

preconfig() public méthode

Preconfig datas for standard system
public preconfig ( $type ) : nothing
$type type of standard system : AD
Résultat nothing

prepareInputForAdd() public méthode

public prepareInputForAdd ( $input )

prepareInputForUpdate() public méthode

public prepareInputForUpdate ( $input )

processMassiveActionsForOneItemtype() static public méthode

See also: CommonDBTM::processMassiveActionsForOneItemtype()
static public processMassiveActionsForOneItemtype ( MassiveAction $ma, CommonDBTM $item, array $ids )
$ma MassiveAction
$item CommonDBTM
$ids array

searchForUsers() static public méthode

static public searchForUsers ( $ds, $values, $filter, $attrs, &$limitexceeded, &$user_infos, &$ldap_users, $config_ldap )

searchUser() static public méthode

static public searchUser ( AuthLDAP $authldap )
$authldap AuthLDAP AuthLDAP object

searchUserDn() static public méthode

Get dn for a user
static public searchUserDn ( $ds, $options = [] ) : dn
$ds LDAP link
$options array of possible options: - basedn : base dn used to search - login_field : attribute to store login - search_parameters array of search parameters - user_params array of parameters : method (IDENTIFIER_LOGIN or IDENTIFIER_EMAIL) + value - condition : ldap condition used
Résultat dn of the user, else false

showDateRestrictionForm() static public méthode

static public showDateRestrictionForm ( $options = [] )
$options array

showForm() public méthode

Print the auth ldap form
public showForm ( $ID, $options = [] ) : Nothing
$ID integer ID of the item
$options array - target for the form
Résultat Nothing (display)

showFormAdvancedConfig() public méthode

showFormEntityConfig() public méthode

showFormGroupsConfig() public méthode

showFormReplicatesConfig() public méthode

showFormTestLDAP() public méthode

public showFormTestLDAP ( )

showFormUserConfig() public méthode

public showFormUserConfig ( )

showLdapGroups() static public méthode

Show LDAP groups to add or synchronise in an entity
static public showLdapGroups ( $target, $start, $sync, $filter = '', $filter2 = '', $entity, $order = 'DESC' ) : nothing
$target target page for the form
$start where to start the list
$sync synchronise or add ? (default 0)
$filter ldap filter to use (default '')
$filter2 second ldap filter to use (which case ?) (default '')
$entity working entity
$order display order (default DESC)
Résultat nothing

showLdapUsers() static public méthode

Show LDAP users to add or synchronise
static public showLdapUsers ( ) : nothing
Résultat nothing

showSystemInformations() public méthode

public showSystemInformations ( $width )
$width

showUserImportForm() static public méthode

static public showUserImportForm ( AuthLDAP $authldap )
$authldap AuthLDAP AuthLDAP object

testLDAPConnection() static public méthode

Test a LDAP connection
static public testLDAPConnection ( $auths_id, $replicate_id ) : boolean
$auths_id ID of the LDAP server
$replicate_id use a replicate if > 0 (default -1)
Résultat boolean connection succeeded ?

tryLdapAuth() static public méthode

Try to authentify a user by checking all the directories
static public tryLdapAuth ( $auth, $login, $password, $auths_id, $user_dn = false, $break = true ) : identification
$auth identification object
$login user login
$password user password
$auths_id auths_id already used for the user (default 0)
$user_dn user LDAP DN if present (false by default)
$break if user is not found in the first directory, stop searching or try the following ones (true by default)
Résultat identification object

tryToConnectToServer() static public méthode

Try to connect to a ldap server
static public tryToConnectToServer ( $ldap_method, $login, $password ) : link
$ldap_method ldap_method array to use
$login User Login
$password User Password
Résultat link to the LDAP server : false if connection failed

unsetUndisclosedFields() public static méthode

public static unsetUndisclosedFields ( &$fields )

useAuthLdap() static public méthode

Is the LDAP authentication used ?
static public useAuthLdap ( ) : boolean
Résultat boolean

Property Details

$dohistory public_oe property

From CommonDBTM
public $dohistory

$rightname static_oe public_oe property

static public $rightname