PHP Класс AuthLDAP, glpi

Наследование: extends AuthPluginBase
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$dohistory From CommonDBTM
$rightname

Открытые методы

Метод Описание
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 ?

Приватные методы

Метод Описание
buildLdapFilter ( AuthLdap $authldap )

Описание методов

addTimestampRestrictions() статический публичный Метод

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 canCreate ( )

canPurge() статический публичный Метод

static public canPurge ( )

cleanDBonPurge() публичный Метод

public cleanDBonPurge ( )

connect() публичный Метод

Open LDAP connexion to current serveur
public connect ( )

connectToServer() статический публичный Метод

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
Результат link to the LDAP server : false if connection failed

date2ldapTimeStamp() статический публичный Метод

Converts a Unix timestamp to an LDAP timestamps
static public date2ldapTimeStamp ( $date ) : ldap
$date datetime
Результат ldap timestamp

defineTabs() публичный Метод

public defineTabs ( $options = [] )

displayLdapFilter() статический публичный Метод

Display LDAP filter
static public displayLdapFilter ( $target, $users = true ) : nothing
$target target for the form
$users boolean for user ? (true by default)
Результат nothing

displaySizeLimitWarning() статический публичный Метод

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

displayTabContentForItem() статический публичный Метод

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

dnExistsInLdap() статический публичный Метод

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
Результат false if the user dn doesn't exist, user ldap infos otherwise

dropdownGroupSearchType() статический публичный Метод

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

dropdownUserDeletedActions() статический публичный Метод

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

getAllGroups() статический публичный Метод

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)
Результат array of the groups

getAllReplicateForAMaster() статический публичный Метод

Get all replicate servers for a master one
static public getAllReplicateForAMaster ( $master_id ) : array
$master_id : master ldap server ID
Результат array of the replicate servers

getAllUsers() статический публичный Метод

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
Результат array of the user

getDefault() статический публичный Метод

static public getDefault ( )

getGroupByDn() статический публичный Метод

Get infos for groups
static public getGroupByDn ( $ds, $group_dn ) : group
$ds LDAP link
$group_dn dn of the group
Результат group infos if found, else false

getGroupCNByDn() статический публичный Метод

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
Результат the group cn

getGroupSearchTypeName() статический публичный Метод

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)
Результат array or string

getGroupsFromLDAP() статический публичный Метод

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 getLdapServers ( )

getNumberOfServers() статический публичный Метод

static public getNumberOfServers ( )

getObjectByDn() статический публичный Метод

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 getSearchOptions ( )

getServersWithImportByEmailActive() статический публичный Метод

Return all the ldap servers where email field is configured
static public getServersWithImportByEmailActive ( ) : array
Результат array of LDAP server's ID

getSpecificValueToDisplay() статический публичный Метод

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

getSpecificValueToSelect() статический публичный Метод

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

getSyncFields() статический публичный Метод

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)
Результат array of "user table field name" => "config value"

getTabNameForItem() публичный Метод

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

getTypeName() статический публичный Метод

static public getTypeName ( $nb )

getUserByDn() статический публичный Метод

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

get_entries_clean() статический публичный Метод

Get ldap query results and clean them at the same time
static public get_entries_clean ( $link, $result ) : an
Результат an array which contains ldap query results

importUserFromServers() статический публичный Метод

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() статический публичный Метод

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

ldapAuth() статический публичный Метод

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
Результат identification object

ldapChooseDirectory() статический публичный Метод

Form to choose a ldap server
static public ldapChooseDirectory ( $target ) : nothing
$target target page for the form
Результат nothing

ldapImportGroup() статический публичный Метод

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
Результат nothing

ldapImportUserByServerId() статический публичный Метод

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)
Результат array with state, else false

ldapStamp2UnixStamp() статический публичный Метод

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)
Результат unix timestamp

local_cmp() публичный Метод

public local_cmp ( $a, $b )

manageValuesInSession() статический публичный Метод

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

post_addItem() публичный Метод

public post_addItem ( )

post_getEmpty() публичный Метод

public post_getEmpty ( )

post_updateItem() публичный Метод

public post_updateItem ( $history = 1 )

preconfig() публичный Метод

Preconfig datas for standard system
public preconfig ( $type ) : nothing
$type type of standard system : AD
Результат nothing

prepareInputForAdd() публичный Метод

public prepareInputForAdd ( $input )

prepareInputForUpdate() публичный Метод

public prepareInputForUpdate ( $input )

processMassiveActionsForOneItemtype() статический публичный Метод

См. также: CommonDBTM::processMassiveActionsForOneItemtype()
static public processMassiveActionsForOneItemtype ( MassiveAction $ma, CommonDBTM $item, array $ids )
$ma MassiveAction
$item CommonDBTM
$ids array

searchForUsers() статический публичный Метод

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

searchUser() статический публичный Метод

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

searchUserDn() статический публичный Метод

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
Результат dn of the user, else false

showDateRestrictionForm() статический публичный Метод

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

showForm() публичный Метод

Print the auth ldap form
public showForm ( $ID, $options = [] ) : Nothing
$ID integer ID of the item
$options array - target for the form
Результат Nothing (display)

showFormAdvancedConfig() публичный Метод

showFormEntityConfig() публичный Метод

showFormGroupsConfig() публичный Метод

showFormReplicatesConfig() публичный Метод

showFormTestLDAP() публичный Метод

public showFormTestLDAP ( )

showFormUserConfig() публичный Метод

public showFormUserConfig ( )

showLdapGroups() статический публичный Метод

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)
Результат nothing

showLdapUsers() статический публичный Метод

Show LDAP users to add or synchronise
static public showLdapUsers ( ) : nothing
Результат nothing

showSystemInformations() публичный Метод

public showSystemInformations ( $width )
$width

showUserImportForm() статический публичный Метод

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

testLDAPConnection() статический публичный Метод

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)
Результат boolean connection succeeded ?

tryLdapAuth() статический публичный Метод

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)
Результат identification object

tryToConnectToServer() статический публичный Метод

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
Результат link to the LDAP server : false if connection failed

unsetUndisclosedFields() публичный статический Метод

public static unsetUndisclosedFields ( &$fields )

useAuthLdap() статический публичный Метод

Is the LDAP authentication used ?
static public useAuthLdap ( ) : boolean
Результат boolean

Описание свойств

$dohistory публичное свойство

From CommonDBTM
public $dohistory

$rightname статическое публичное свойство

static public $rightname