ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLDAPServer Class Reference
+ Collaboration diagram for ilLDAPServer:

Public Member Functions

 __construct ($a_server_id=0)
 
 rotateFallbacks ()
 Rotate fallback urls in case of connect timeouts. More...
 
 getServerId ()
 
 enableAuthentication ($a_status)
 Enable authentication for this ldap server. More...
 
 isAuthenticationEnabled ()
 Check if authentication is enabled. More...
 
 setAuthenticationMapping ($a_map)
 Set mapped authentication mapping. More...
 
 getAuthenticationMapping ()
 Get authentication mode that is mapped. More...
 
 getAuthenticationMappingKey ()
 Get authentication mapping key Default is ldap. More...
 
 toggleActive ($a_status)
 
 isActive ()
 
 getUrl ()
 
 setUrl ($a_url)
 
 getUrlString ()
 
 doConnectionCheck ()
 Check ldap connection and do a fallback to the next server if no connection is possible. More...
 
 getName ()
 
 setName ($a_name)
 
 getVersion ()
 
 setVersion ($a_version)
 
 getBaseDN ()
 
 setBaseDN ($a_base_dn)
 
 isActiveReferrer ()
 
 toggleReferrer ($a_status)
 
 isActiveTLS ()
 
 toggleTLS ($a_status)
 
 getBindingType ()
 
 setBindingType ($a_type)
 
 getBindUser ()
 
 setBindUser ($a_user)
 
 getBindPassword ()
 
 setBindPassword ($a_password)
 
 getSearchBase ()
 
 setSearchBase ($a_search_base)
 
 getUserAttribute ()
 
 setUserAttribute ($a_user_attr)
 
 getFilter ()
 
 setFilter ($a_filter)
 
 getGroupDN ()
 
 setGroupDN ($a_value)
 
 getGroupFilter ()
 
 setGroupFilter ($a_value)
 
 getGroupMember ()
 
 setGroupMember ($a_value)
 
 getGroupName ()
 
 setGroupName ($a_value)
 
 getGroupNames ()
 Get group names as array. More...
 
 getGroupAttribute ()
 
 setGroupAttribute ($a_value)
 
 toggleMembershipOptional ($a_status)
 
 isMembershipOptional ()
 
 setGroupUserFilter ($a_filter)
 
 getGroupUserFilter ()
 
 enabledGroupMemberIsDN ()
 
 enableGroupMemberIsDN ($a_value)
 
 setGroupScope ($a_value)
 
 getGroupScope ()
 
 setUserScope ($a_value)
 
 getUserScope ()
 
 enabledSyncOnLogin ()
 
 enableSyncOnLogin ($a_value)
 
 enabledSyncPerCron ()
 
 enableSyncPerCron ($a_value)
 
 setGlobalRole ($a_role)
 
 getRoleBindDN ()
 
 setRoleBindDN ($a_value)
 
 getRoleBindPassword ()
 
 setRoleBindPassword ($a_value)
 
 enabledRoleSynchronization ()
 
 enableRoleSynchronization ($a_value)
 
 getUsernameFilter ()
 
 setUsernameFilter ($a_value)
 
 enableEscapeDN (bool $a_value)
 
 enabledEscapeDN ()
 
 enableAccountMigration ($a_status)
 Enable account migration. More...
 
 isAccountMigrationEnabled ()
 enabled account migration More...
 
 validate ()
 Validate user input. More...
 
 create ()
 
 update ()
 
 delete ()
 delete More...
 
 toPearAuthArray ()
 Creates an array of options compatible to PEAR Auth. More...
 

Static Public Member Functions

static getInstanceByServerId ($a_server_id)
 Get instance by server id. More...
 
static checkLDAPLib ()
 Check if ldap module is installed. More...
 
static _getActiveServerList ()
 Get active server list. More...
 
static _getCronServerIds ()
 Get list of acticve servers with option 'SyncCron'. More...
 
static _getRoleSyncServerIds ()
 Check whether there if there is an active server with option role_sync_active. More...
 
static _getPasswordServers ()
 Checks whether password synchronistation is enabled for an user. More...
 
static _getFirstActiveServer ()
 Get first active server. More...
 
static _getServerList ()
 Get list of all configured servers. More...
 
static getServerIds ()
 Get all server ids @global ilDB $ilDB. More...
 
static _getAllServer ()
 Get list of all configured servers. More...
 
static _getFirstServer ()
 
static getAvailableDataSources ($a_auth_mode)
 
static isDataSourceActive ($a_auth_mode)
 Check if a data source is active for a specific auth mode @global ilDB $ilDB. More...
 
static getDataSource ($a_auth_mode)
 
static disableDataSourceForAuthMode ($a_authmode)
 Disable data source. More...
 
static toggleDataSource ($a_ldap_server_id, $a_auth_mode, $a_status)
 Toggle Data Source. More...
 
static isAuthModeLDAP ($a_auth_mode)
 Check if user auth mode is LDAP. More...
 
static getServerIdByAuthMode ($a_auth_mode)
 Get auth id by auth mode. More...
 
static getAuthModeByKey ($a_auth_key)
 get auth mode by key More...
 
static getKeyByAuthMode ($a_auth_mode)
 Get auth id by auth mode. More...
 

Data Fields

const DEBUG = false
 
const DEFAULT_VERSION = 3
 
const DEFAULT_NETWORK_TIMEOUT = 5
 

Private Member Functions

 prepareFilter ($a_filter)
 Create brackets for filters if they do not exist. More...
 
 getPearAtributeArray ()
 Get attribute array for pear auth data. More...
 
 read ()
 Read server settings. More...
 

Private Attributes

 $role_bind_dn = ''
 
 $role_bind_pass = ''
 
 $role_sync_active = 0
 
 $server_id = null
 
 $fallback_urls = array()
 
 $enabled_authentication = true
 
 $authentication_mapping = 0
 
 $escape_dn = false
 

Static Private Attributes

static $instances = array()
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls

Definition at line 24 of file class.ilLDAPServer.php.

Constructor & Destructor Documentation

◆ __construct()

ilLDAPServer::__construct (   $a_server_id = 0)

Definition at line 43 of file class.ilLDAPServer.php.

44 {
45 global $DIC;
46
47 $ilDB = $DIC['ilDB'];
48 $lng = $DIC['lng'];
49
50 $this->db = $ilDB;
51 $this->lng = $lng;
52 $this->server_id = $a_server_id;
53
54 $this->read();
55 }
read()
Read server settings.
global $DIC
Definition: saml.php:7
$lng
global $ilDB

References $DIC, $ilDB, $lng, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getActiveServerList()

static ilLDAPServer::_getActiveServerList ( )
static

Get active server list.

Returns
array server ids of active ldap server

Definition at line 109 of file class.ilLDAPServer.php.

110 {
111 global $DIC;
112
113 $ilDB = $DIC['ilDB'];
114
115 $query = "SELECT server_id FROM ldap_server_settings " .
116 "WHERE active = 1 AND authentication = 1 " .
117 "ORDER BY name ";
118 $res = $ilDB->query($query);
119 $server_ids = array();
120 while ($row = $ilDB->fetchObject($res)) {
121 $server_ids[] = $row->server_id;
122 }
123 return $server_ids;
124 }
$row
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilAuthUtils\_getActiveAuthModes(), _getFirstActiveServer(), ilAuthUtils\_getMultipleAuthModeOptions(), _getPasswordServers(), ilAuthUtils\_hasMultipleAuthenticationMethods(), ilAuthUtils\_isExternalAccountEnabled(), ilUserImportParser\importBeginTag(), ilAuthModeDetermination\read(), and ilUserImportParser\verifyBeginTag().

+ Here is the caller graph for this function:

◆ _getAllServer()

static ilLDAPServer::_getAllServer ( )
static

Get list of all configured servers.

Returns
array list of server

Definition at line 249 of file class.ilLDAPServer.php.

250 {
251 global $DIC;
252
253 $ilDB = $DIC['ilDB'];
254
255 $query = "SELECT * FROM ldap_server_settings ORDER BY name";
256
257 $server = array();
258
259 $res = $ilDB->query($query);
260 while ($row = $ilDB->fetchAssoc($res)) {
261 $server[] = $row;
262 }
263 return $server;
264 }
$server
Definition: sabredav.php:48

References $DIC, $ilDB, $query, $res, $row, and $server.

Referenced by ilLDAPServerTableGUI\importData().

+ Here is the caller graph for this function:

◆ _getCronServerIds()

static ilLDAPServer::_getCronServerIds ( )
static

Get list of acticve servers with option 'SyncCron'.

Returns
array server ids of active ldap server

Definition at line 131 of file class.ilLDAPServer.php.

132 {
133 global $DIC;
134
135 $ilDB = $DIC['ilDB'];
136
137 $query = "SELECT server_id FROM ldap_server_settings " .
138 "WHERE active = 1 " .
139 "AND sync_per_cron = 1 " .
140 "ORDER BY name";
141
142 $res = $ilDB->query($query);
143 while ($row = $ilDB->fetchObject($res)) {
144 $server_ids[] = $row->server_id;
145 }
146 return $server_ids ? $server_ids : array();
147 }

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilLDAPCronSynchronization\run().

+ Here is the caller graph for this function:

◆ _getFirstActiveServer()

static ilLDAPServer::_getFirstActiveServer ( )
static

Get first active server.

Returns
int first active server

Definition at line 192 of file class.ilLDAPServer.php.

193 {
195 if (count($servers)) {
196 return $servers[0];
197 }
198 return 0;
199 }
static _getActiveServerList()
Get active server list.

References _getActiveServerList().

Referenced by ilECSCmsCourseMemberCommandQueueHandler\createMember(), and ilAuthLoginPageEditorGUI\initLoginForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFirstServer()

static ilLDAPServer::_getFirstServer ( )
static

Definition at line 271 of file class.ilLDAPServer.php.

272 {
273 $servers = ilLDAPServer::_getServerList();
274
275 if (count($servers)) {
276 return $servers[0];
277 }
278 return 0;
279 }
static _getServerList()
Get list of all configured servers.

References _getServerList().

+ Here is the call graph for this function:

◆ _getPasswordServers()

static ilLDAPServer::_getPasswordServers ( )
static

Checks whether password synchronistation is enabled for an user.

@access public

Parameters
intuser_id

Definition at line 181 of file class.ilLDAPServer.php.

182 {
184 }

References _getActiveServerList().

+ Here is the call graph for this function:

◆ _getRoleSyncServerIds()

static ilLDAPServer::_getRoleSyncServerIds ( )
static

Check whether there if there is an active server with option role_sync_active.

@access public

Parameters

Definition at line 156 of file class.ilLDAPServer.php.

157 {
158 global $DIC;
159
160 $ilDB = $DIC['ilDB'];
161
162 $query = "SELECT server_id FROM ldap_server_settings " .
163 "WHERE active = 1 " .
164 "AND role_sync_active = 1 ";
165
166 $res = $ilDB->query($query);
167 $server_ids = array();
168 while ($row = $ilDB->fetchObject($res)) {
169 $server_ids[] = $row->server_id;
170 }
171 return $server_ids;
172 }

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilLDAPRoleGroupMapping\initServers().

+ Here is the caller graph for this function:

◆ _getServerList()

static ilLDAPServer::_getServerList ( )
static

Get list of all configured servers.

Returns
array list of server ids

Definition at line 206 of file class.ilLDAPServer.php.

207 {
208 global $DIC;
209
210 $ilDB = $DIC['ilDB'];
211
212 $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
213
214 $res = $ilDB->query($query);
215 while ($row = $ilDB->fetchObject($res)) {
216 $server_ids[] = $row->server_id;
217 }
218 return $server_ids ? $server_ids : array();
219 }

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilAuthUtils\_getAllAuthModes(), _getFirstServer(), and ilLDAPSettingsGUI\setSubTabs().

+ Here is the caller graph for this function:

◆ checkLDAPLib()

static ilLDAPServer::checkLDAPLib ( )
static

Check if ldap module is installed.

Returns

Definition at line 99 of file class.ilLDAPServer.php.

100 {
101 return function_exists('ldap_bind');
102 }

Referenced by ilLDAPSettingsGUI\serverList().

+ Here is the caller graph for this function:

◆ create()

ilLDAPServer::create ( )

Definition at line 872 of file class.ilLDAPServer.php.

873 {
874 global $DIC;
875
876 $ilDB = $DIC['ilDB'];
877 $next_id = $ilDB->nextId('ldap_server_settings');
878
879 $query = 'INSERT INTO ldap_server_settings (server_id,active,name,url,version,base_dn,referrals,tls,bind_type,bind_user,bind_pass,' .
880 'search_base,user_scope,user_attribute,filter,group_dn,group_scope,group_filter,group_member,group_memberisdn,group_name,' .
881 'group_attribute,group_optional,group_user_filter,sync_on_login,sync_per_cron,role_sync_active,role_bind_dn,role_bind_pass,migration, ' .
882 'authentication,authentication_type,username_filter, escape_dn) ' .
883 'VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)';
884 $res = $ilDB->queryF(
885 $query,
886 array(
887 'integer','integer','text','text','integer','text','integer','integer','integer','text','text','text','integer',
888 'text','text','text','integer','text','text','integer','text','text','integer','text','integer','integer','integer',
889 'text','text', 'integer','integer','integer',"text", 'integer'),
890 array(
891 $next_id,
892 $this->isActive(),
893 $this->getName(),
894 $this->getUrlString(),
895 $this->getVersion(),
896 $this->getBaseDN(),
897 $this->isActiveReferrer(),
898 $this->isActiveTLS(),
899 $this->getBindingType(),
900 $this->getBindUser(),
901 $this->getBindPassword(),
902 $this->getSearchBase(),
903 $this->getUserScope(),
904 $this->getUserAttribute(),
905 $this->getFilter(),
906 $this->getGroupDN(),
907 $this->getGroupScope(),
908 $this->getGroupFilter(),
909 $this->getGroupMember(),
910 $this->enabledGroupMemberIsDN(),
911 $this->getGroupName(),
912 $this->getGroupAttribute(),
913 $this->isMembershipOptional(),
914 $this->getGroupUserFilter(),
915 $this->enabledSyncOnLogin(),
916 $this->enabledSyncPerCron(),
918 $this->getRoleBindDN(),
919 $this->getRoleBindPassword(),
923 $this->getUsernameFilter(),
924 (int) $this->enabledEscapeDN()
925 )
926 );
927 // end Patch Name Filter
928 $this->server_id = $next_id;
929 return $next_id;
930 }
isAuthenticationEnabled()
Check if authentication is enabled.
getAuthenticationMapping()
Get authentication mode that is mapped.
isAccountMigrationEnabled()
enabled account migration

References $DIC, $ilDB, $query, $res, enabledEscapeDN(), enabledGroupMemberIsDN(), enabledRoleSynchronization(), enabledSyncOnLogin(), enabledSyncPerCron(), getAuthenticationMapping(), getBaseDN(), getBindingType(), getBindPassword(), getBindUser(), getFilter(), getGroupAttribute(), getGroupDN(), getGroupFilter(), getGroupMember(), getGroupName(), getGroupScope(), getGroupUserFilter(), getName(), getRoleBindDN(), getRoleBindPassword(), getSearchBase(), getUrlString(), getUserAttribute(), getUsernameFilter(), getUserScope(), getVersion(), isAccountMigrationEnabled(), isActive(), isActiveReferrer(), isActiveTLS(), isAuthenticationEnabled(), and isMembershipOptional().

+ Here is the call graph for this function:

◆ delete()

ilLDAPServer::delete ( )

delete

Definition at line 981 of file class.ilLDAPServer.php.

982 {
983 if (!$this->getServerId()) {
984 return false;
985 }
986
987 include_once 'Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
989
990 include_once 'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
992
993 foreach ($rules as $ruleAssigment) {
994 $ruleAssigment->delete();
995 }
996
997 include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
999
1000 $query = "DELETE FROM ldap_server_settings " .
1001 "WHERE server_id = " . $this->db->quote($this->getServerId(), 'integer');
1002 $res = $this->db->manipulate($query);
1003 }
static _delete($a_server_id)
Delete mapping rules by server id.
static _getRules($a_server_id)
Get all rules.

References $query, $res, ilLDAPAttributeMapping\_delete(), ilLDAPRoleGroupMappingSettings\_deleteByServerId(), ilLDAPRoleAssignmentRule\_getRules(), and getServerId().

+ Here is the call graph for this function:

◆ disableDataSourceForAuthMode()

static ilLDAPServer::disableDataSourceForAuthMode (   $a_authmode)
static

Disable data source.

Definition at line 342 of file class.ilLDAPServer.php.

343 {
344 global $DIC;
345
346 $ilDB = $DIC['ilDB'];
347
348 $query = 'UPDATE ldap_server_settings ' .
349 'SET authentication_type = ' . $ilDB->quote(0, 'integer') . ' ' .
350 'WHERE authentication_type = ' . $ilDB->quote($a_authmode, 'integer');
351 $ilDB->manipulate($query);
352 return true;
353 }

References $DIC, $ilDB, and $query.

Referenced by ilCASSettingsGUI\save(), ilRadiusSettingsGUI\save(), and toggleDataSource().

+ Here is the caller graph for this function:

◆ doConnectionCheck()

ilLDAPServer::doConnectionCheck ( )

Check ldap connection and do a fallback to the next server if no connection is possible.

@access public

Definition at line 537 of file class.ilLDAPServer.php.

538 {
539 include_once('Services/LDAP/classes/class.ilLDAPQuery.php');
540
541 foreach (array_merge(array(0 => $this->url), $this->fallback_urls) as $url) {
542 try {
543 ilLoggerFactory::getLogger('auth')->debug('Using url: ' . $url);
544 // Need to do a full bind, since openldap return valid connection links for invalid hosts
545 $query = new ilLDAPQuery($this, $url);
547 $this->url = $url;
548 return true;
549 } catch (ilLDAPQueryException $exc) {
550 $this->rotateFallbacks();
551 ilLoggerFactory::getLogger('auth')->error('Cannot connect to LDAP server: ' . $url . ' ' . $exc->getCode() . ' ' . $exc->getMessage());
552 }
553 }
554 ilLoggerFactory::getLogger('auth')->warning('No valid LDAP server found');
555 return false;
556 }
const IL_LDAP_BIND_TEST
rotateFallbacks()
Rotate fallback urls in case of connect timeouts.
static getLogger($a_component_id)
Get component logger.
$url

References $query, $url, ilLoggerFactory\getLogger(), IL_LDAP_BIND_TEST, and rotateFallbacks().

+ Here is the call graph for this function:

◆ enableAccountMigration()

ilLDAPServer::enableAccountMigration (   $a_status)

Enable account migration.

@access public

Parameters
boolstatus

Definition at line 821 of file class.ilLDAPServer.php.

822 {
823 $this->account_migration = $a_status;
824 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableAuthentication()

ilLDAPServer::enableAuthentication (   $a_status)

Enable authentication for this ldap server.

Parameters
bool$a_status

Definition at line 448 of file class.ilLDAPServer.php.

449 {
450 $this->enabled_authentication = (bool) $a_status;
451 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enabledEscapeDN()

ilLDAPServer::enabledEscapeDN ( )

Definition at line 809 of file class.ilLDAPServer.php.

809 : bool
810 {
811 return $this->escape_dn;
812 }

References $escape_dn.

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ enabledGroupMemberIsDN()

ilLDAPServer::enabledGroupMemberIsDN ( )

Definition at line 726 of file class.ilLDAPServer.php.

727 {
728 return (bool) $this->memberisdn;
729 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ enabledRoleSynchronization()

ilLDAPServer::enabledRoleSynchronization ( )

Definition at line 786 of file class.ilLDAPServer.php.

787 {
789 }

References $role_sync_active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ enabledSyncOnLogin()

ilLDAPServer::enabledSyncOnLogin ( )

Definition at line 750 of file class.ilLDAPServer.php.

751 {
752 return $this->sync_on_login;
753 }

Referenced by create(), getPearAtributeArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ enabledSyncPerCron()

ilLDAPServer::enabledSyncPerCron ( )

Definition at line 758 of file class.ilLDAPServer.php.

759 {
760 return $this->sync_per_cron;
761 }

Referenced by create(), update(), and validate().

+ Here is the caller graph for this function:

◆ enableEscapeDN()

ilLDAPServer::enableEscapeDN ( bool  $a_value)

Definition at line 804 of file class.ilLDAPServer.php.

805 {
806 $this->escape_dn = $a_value;
807 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableGroupMemberIsDN()

ilLDAPServer::enableGroupMemberIsDN (   $a_value)

Definition at line 730 of file class.ilLDAPServer.php.

731 {
732 $this->memberisdn = (bool) $a_value;
733 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableRoleSynchronization()

ilLDAPServer::enableRoleSynchronization (   $a_value)

Definition at line 790 of file class.ilLDAPServer.php.

791 {
792 $this->role_sync_active = $a_value;
793 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncOnLogin()

ilLDAPServer::enableSyncOnLogin (   $a_value)

Definition at line 754 of file class.ilLDAPServer.php.

755 {
756 $this->sync_on_login = (int) $a_value;
757 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncPerCron()

ilLDAPServer::enableSyncPerCron (   $a_value)

Definition at line 762 of file class.ilLDAPServer.php.

763 {
764 $this->sync_per_cron = (int) $a_value;
765 }

Referenced by read().

+ Here is the caller graph for this function:

◆ getAuthenticationMapping()

ilLDAPServer::getAuthenticationMapping ( )

Get authentication mode that is mapped.

Returns
int

Definition at line 475 of file class.ilLDAPServer.php.

476 {
478 }

References $authentication_mapping.

Referenced by create(), getAuthenticationMappingKey(), and update().

+ Here is the caller graph for this function:

◆ getAuthenticationMappingKey()

ilLDAPServer::getAuthenticationMappingKey ( )

Get authentication mapping key Default is ldap.

Returns
string

Definition at line 485 of file class.ilLDAPServer.php.

486 {
487 if ($this->isAuthenticationEnabled() or !$this->getAuthenticationMapping()) {
488 // begin-patch ldap_multiple
489 return 'ldap_' . $this->getServerId();
490 #return 'ldap';
491 // end-patch ldap_multiple
492 }
494 }
static _getAuthModeName($a_auth_key)

References ilAuthUtils\_getAuthModeName(), getAuthenticationMapping(), getServerId(), and isAuthenticationEnabled().

+ Here is the call graph for this function:

◆ getAuthModeByKey()

static ilLDAPServer::getAuthModeByKey (   $a_auth_key)
static

get auth mode by key

Parameters
type$a_auth_key

Definition at line 413 of file class.ilLDAPServer.php.

414 {
415 $auth_arr = explode('_', $a_auth_key);
416 if (count((array) $auth_arr) > 1) {
417 return 'ldap_' . $auth_arr[1];
418 }
419 return 'ldap';
420 }

Referenced by ilAuthUtils\_getAuthModeName().

+ Here is the caller graph for this function:

◆ getAvailableDataSources()

static ilLDAPServer::getAvailableDataSources (   $a_auth_mode)
static

Definition at line 282 of file class.ilLDAPServer.php.

283 {
284 global $DIC;
285
286 $ilDB = $DIC['ilDB'];
287
288 $query = "SELECT server_id FROM ldap_server_settings " .
289 "WHERE active = " . $ilDB->quote(1, 'integer') . " " .
290 "AND authentication = " . $ilDB->quote(0, 'integer') . " " .
291 "AND ( authentication_type = " . $ilDB->quote($a_auth_mode, 'integer') . " " .
292 "OR authentication_type = " . $ilDB->quote(0, 'integer') . ")";
293 $res = $ilDB->query($query);
294
295 $server_ids = array();
296 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
297 $server_ids[] = $row->server_id;
298 }
299 return $server_ids;
300 }

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilCASSettingsGUI\initFormSettings(), and ilRadiusSettingsGUI\settings().

+ Here is the caller graph for this function:

◆ getBaseDN()

ilLDAPServer::getBaseDN ( )

Definition at line 575 of file class.ilLDAPServer.php.

576 {
577 return $this->base_dn;
578 }

Referenced by create(), toPearAuthArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ getBindingType()

ilLDAPServer::getBindingType ( )

Definition at line 599 of file class.ilLDAPServer.php.

600 {
601 return $this->binding_type;
602 }

Referenced by create(), toPearAuthArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ getBindPassword()

ilLDAPServer::getBindPassword ( )

Definition at line 619 of file class.ilLDAPServer.php.

620 {
621 return $this->bind_password;
622 }

Referenced by create(), toPearAuthArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ getBindUser()

ilLDAPServer::getBindUser ( )

Definition at line 611 of file class.ilLDAPServer.php.

612 {
613 return $this->bind_user;
614 }

Referenced by create(), toPearAuthArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ getDataSource()

static ilLDAPServer::getDataSource (   $a_auth_mode)
static

Definition at line 324 of file class.ilLDAPServer.php.

325 {
326 global $DIC;
327
328 $ilDB = $DIC['ilDB'];
329
330 $query = "SELECT server_id FROM ldap_server_settings " .
331 "WHERE authentication_type = " . $ilDB->quote($a_auth_mode, 'integer') . " ";
332 $res = $ilDB->query($query);
333 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
334 return $row->server_id;
335 }
336 return 0;
337 }

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjAuthSettingsGUI\getApacheAuthSettingsForm(), ilAuthContainerCAS\handleLDAPDataSource(), ilAuthProviderCAS\handleLDAPDataSource(), ilCASSettingsGUI\initFormSettings(), and ilRadiusSettingsGUI\settings().

+ Here is the caller graph for this function:

◆ getFilter()

ilLDAPServer::getFilter ( )

Definition at line 643 of file class.ilLDAPServer.php.

644 {
645 return $this->prepareFilter($this->filter);
646 }
prepareFilter($a_filter)
Create brackets for filters if they do not exist.

References prepareFilter().

Referenced by create(), toPearAuthArray(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroupAttribute()

ilLDAPServer::getGroupAttribute ( )

Definition at line 700 of file class.ilLDAPServer.php.

701 {
702 return $this->group_attribute;
703 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ getGroupDN()

ilLDAPServer::getGroupDN ( )

Definition at line 651 of file class.ilLDAPServer.php.

652 {
653 return $this->group_dn;
654 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ getGroupFilter()

ilLDAPServer::getGroupFilter ( )

Definition at line 659 of file class.ilLDAPServer.php.

660 {
661 return $this->prepareFilter($this->group_filter);
662 }

References prepareFilter().

Referenced by create(), toPearAuthArray(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroupMember()

ilLDAPServer::getGroupMember ( )

Definition at line 667 of file class.ilLDAPServer.php.

668 {
669 return $this->group_member;
670 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ getGroupName()

ilLDAPServer::getGroupName ( )

Definition at line 675 of file class.ilLDAPServer.php.

676 {
677 return $this->group_name;
678 }

Referenced by create(), getGroupNames(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ getGroupNames()

ilLDAPServer::getGroupNames ( )

Get group names as array.

Returns
string[]

Definition at line 688 of file class.ilLDAPServer.php.

689 {
690 $names = explode(',', $this->getGroupName());
691
692 if (!is_array($names)) {
693 return array();
694 }
695
696 return array_filter(array_map('trim', $names));
697 }

References getGroupName().

+ Here is the call graph for this function:

◆ getGroupScope()

ilLDAPServer::getGroupScope ( )

Definition at line 738 of file class.ilLDAPServer.php.

739 {
740 return $this->group_scope;
741 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ getGroupUserFilter()

ilLDAPServer::getGroupUserFilter ( )

Definition at line 721 of file class.ilLDAPServer.php.

722 {
723 return $this->group_user_filter;
724 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getInstanceByServerId()

static ilLDAPServer::getInstanceByServerId (   $a_server_id)
static

◆ getKeyByAuthMode()

static ilLDAPServer::getKeyByAuthMode (   $a_auth_mode)
static

Get auth id by auth mode.

Parameters
string$a_auth_mode
Returns
int auth_mode

Definition at line 427 of file class.ilLDAPServer.php.

428 {
429 $auth_arr = explode('_', $a_auth_mode);
430 if (count((array) $auth_arr) > 1) {
431 return AUTH_LDAP . '_' . $auth_arr[1];
432 }
433 return AUTH_LDAP;
434 }
const AUTH_LDAP

References AUTH_LDAP.

Referenced by ilAuthUtils\_getAuthMode().

+ Here is the caller graph for this function:

◆ getName()

ilLDAPServer::getName ( )

Definition at line 559 of file class.ilLDAPServer.php.

560 {
561 return $this->name;
562 }

References $name.

Referenced by create(), update(), and validate().

+ Here is the caller graph for this function:

◆ getPearAtributeArray()

ilLDAPServer::getPearAtributeArray ( )
private

Get attribute array for pear auth data.

@access private

Parameters

Definition at line 1097 of file class.ilLDAPServer.php.

1098 {
1099 if ($this->enabledSyncOnLogin()) {
1100 include_once('Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
1101 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
1103 return array_merge(
1104 array($this->getUserAttribute()),
1105 $mapping->getFields(),
1106 array('dn'),
1108 );
1109 } else {
1110 return array($this->getUserAttribute());
1111 }
1112 }
static _getInstanceByServerId($a_server_id)
Get instance of class.
static getAttributeNames($a_server_id)
get all possible attribute names

References ilLDAPAttributeMapping\_getInstanceByServerId(), enabledSyncOnLogin(), ilLDAPRoleAssignmentRules\getAttributeNames(), getServerId(), and getUserAttribute().

Referenced by toPearAuthArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleBindDN()

ilLDAPServer::getRoleBindDN ( )

Definition at line 770 of file class.ilLDAPServer.php.

771 {
772 return $this->role_bind_dn;
773 }

References $role_bind_dn.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getRoleBindPassword()

ilLDAPServer::getRoleBindPassword ( )

Definition at line 778 of file class.ilLDAPServer.php.

779 {
781 }

References $role_bind_pass.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getSearchBase()

ilLDAPServer::getSearchBase ( )

Definition at line 627 of file class.ilLDAPServer.php.

628 {
629 return $this->search_base;
630 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPServer::getServerId ( )

Definition at line 439 of file class.ilLDAPServer.php.

440 {
441 return $this->server_id;
442 }

References $server_id.

Referenced by delete(), getAuthenticationMappingKey(), getPearAtributeArray(), rotateFallbacks(), and update().

+ Here is the caller graph for this function:

◆ getServerIdByAuthMode()

static ilLDAPServer::getServerIdByAuthMode (   $a_auth_mode)
static

Get auth id by auth mode.

Parameters
type$a_auth_mode
Returns
null

Definition at line 400 of file class.ilLDAPServer.php.

401 {
402 if (self::isAuthModeLDAP($a_auth_mode)) {
403 $auth_arr = explode('_', $a_auth_mode);
404 return $auth_arr[1];
405 }
406 return null;
407 }

Referenced by ilObjAuthSettingsGUI\authSettingsObject(), ilAuthModeDetermination\getAuthModeSequence(), ilAuthUtils\getAuthModeTranslation(), ilObjAuthSettingsGUI\initAuthModeDetermination(), and ilAuthModeDetermination\read().

+ Here is the caller graph for this function:

◆ getServerIds()

static ilLDAPServer::getServerIds ( )
static

Get all server ids @global ilDB $ilDB.

Returns
array int

Definition at line 226 of file class.ilLDAPServer.php.

227 {
228 global $DIC;
229
230 $ilDB = $DIC['ilDB'];
231
232 $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
233
234
235 $res = $ilDB->query($query);
236
237 $server = array();
238 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
239 $server[] = $row->server_id;
240 }
241 return $server;
242 }

References $DIC, $ilDB, $query, $res, $row, $server, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjAuthSettingsGUI\getApacheAuthSettingsForm(), and ilECSMappingUtils\getAuthModeSelection().

+ Here is the caller graph for this function:

◆ getUrl()

ilLDAPServer::getUrl ( )

Definition at line 504 of file class.ilLDAPServer.php.

505 {
506 return $this->url;
507 }

References $url.

Referenced by rotateFallbacks(), toPearAuthArray(), and validate().

+ Here is the caller graph for this function:

◆ getUrlString()

ilLDAPServer::getUrlString ( )

Definition at line 525 of file class.ilLDAPServer.php.

526 {
527 return $this->url_string;
528 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserAttribute()

ilLDAPServer::getUserAttribute ( )

Definition at line 635 of file class.ilLDAPServer.php.

636 {
637 return $this->user_attribute;
638 }

Referenced by create(), getPearAtributeArray(), toPearAuthArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ getUsernameFilter()

ilLDAPServer::getUsernameFilter ( )

Definition at line 795 of file class.ilLDAPServer.php.

796 {
797 return $this->username_filter;
798 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserScope()

ilLDAPServer::getUserScope ( )

Definition at line 746 of file class.ilLDAPServer.php.

747 {
748 return $this->user_scope;
749 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ getVersion()

ilLDAPServer::getVersion ( )

Definition at line 567 of file class.ilLDAPServer.php.

568 {
569 return $this->version ? $this->version : self::DEFAULT_VERSION;
570 }

References DEFAULT_VERSION.

Referenced by create(), toPearAuthArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ isAccountMigrationEnabled()

ilLDAPServer::isAccountMigrationEnabled ( )

enabled account migration

@access public

Definition at line 832 of file class.ilLDAPServer.php.

833 {
834 return $this->account_migration ? true : false;
835 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActive()

ilLDAPServer::isActive ( )

Definition at line 500 of file class.ilLDAPServer.php.

501 {
502 return $this->active;
503 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActiveReferrer()

ilLDAPServer::isActiveReferrer ( )

Definition at line 583 of file class.ilLDAPServer.php.

584 {
585 return $this->referrals ? true : false;
586 }

Referenced by create(), toPearAuthArray(), and update().

+ Here is the caller graph for this function:

◆ isActiveTLS()

ilLDAPServer::isActiveTLS ( )

Definition at line 591 of file class.ilLDAPServer.php.

592 {
593 return $this->tls ? true : false;
594 }

Referenced by create(), toPearAuthArray(), update(), and validate().

+ Here is the caller graph for this function:

◆ isAuthenticationEnabled()

ilLDAPServer::isAuthenticationEnabled ( )

Check if authentication is enabled.

Returns
bool

Definition at line 457 of file class.ilLDAPServer.php.

458 {
459 return (bool) $this->enabled_authentication;
460 }

References $enabled_authentication.

Referenced by create(), getAuthenticationMappingKey(), and update().

+ Here is the caller graph for this function:

◆ isAuthModeLDAP()

static ilLDAPServer::isAuthModeLDAP (   $a_auth_mode)
static

Check if user auth mode is LDAP.

Parameters
type$a_auth_mode

Definition at line 385 of file class.ilLDAPServer.php.

386 {
387 if (!$a_auth_mode) {
388 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': No auth mode given..............');
389 return false;
390 }
391 $auth_arr = explode('_', $a_auth_mode);
392 return ($auth_arr[0] == AUTH_LDAP) and $auth_arr[1];
393 }
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

References $GLOBALS, and AUTH_LDAP.

Referenced by ilObjAuthSettingsGUI\authSettingsObject(), and ilObjAuthSettingsGUI\initAuthModeDetermination().

+ Here is the caller graph for this function:

◆ isDataSourceActive()

static ilLDAPServer::isDataSourceActive (   $a_auth_mode)
static

Check if a data source is active for a specific auth mode @global ilDB $ilDB.

Parameters
int$a_auth_mode
Returns
bool

Definition at line 308 of file class.ilLDAPServer.php.

309 {
310 global $DIC;
311
312 $ilDB = $DIC['ilDB'];
313
314 $query = "SELECT server_id FROM ldap_server_settings " .
315 "WHERE authentication_type = " . $ilDB->quote($a_auth_mode, 'integer') . " " .
316 "AND authentication = " . $ilDB->quote(0, 'integer');
317 $res = $ilDB->query($query);
318 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
319 return true;
320 }
321 return false;
322 }

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAuthProviderCAS\doAuthentication(), ilCASSettingsGUI\initFormSettings(), ilAuthContainerCAS\loginObserver(), and ilRadiusSettingsGUI\settings().

+ Here is the caller graph for this function:

◆ isMembershipOptional()

ilLDAPServer::isMembershipOptional ( )

Definition at line 713 of file class.ilLDAPServer.php.

714 {
715 return (bool) $this->group_optional;
716 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ prepareFilter()

ilLDAPServer::prepareFilter (   $a_filter)
private

Create brackets for filters if they do not exist.

@access private

Parameters
stringfilter

Definition at line 1073 of file class.ilLDAPServer.php.

1074 {
1075 $filter = trim($a_filter);
1076
1077 if (!strlen($filter)) {
1078 return $filter;
1079 }
1080
1081 if (strpos($filter, '(') !== 0) {
1082 $filter = ('(' . $filter);
1083 }
1084 if (substr($filter, -1) != ')') {
1085 $filter = ($filter . ')');
1086 }
1087 return $filter;
1088 }

Referenced by getFilter(), and getGroupFilter().

+ Here is the caller graph for this function:

◆ read()

ilLDAPServer::read ( )
private

Read server settings.

Definition at line 1120 of file class.ilLDAPServer.php.

1121 {
1122 if (!$this->server_id) {
1123 return true;
1124 }
1125 $query = "SELECT * FROM ldap_server_settings WHERE server_id = " . $this->db->quote($this->server_id) . "";
1126
1127 $res = $this->db->query($query);
1128 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1129 $this->toggleActive($row->active);
1130 $this->setName($row->name);
1131 $this->setUrl($row->url);
1132 $this->setVersion($row->version);
1133 $this->setBaseDN($row->base_dn);
1134 $this->toggleReferrer($row->referrals);
1135 $this->toggleTLS($row->tls);
1136 $this->setBindingType($row->bind_type);
1137 $this->setBindUser($row->bind_user);
1138 $this->setBindPassword($row->bind_pass);
1139 $this->setSearchBase($row->search_base);
1140 $this->setUserScope($row->user_scope);
1141 $this->setUserAttribute($row->user_attribute);
1142 $this->setFilter($row->filter);
1143 $this->setGroupDN($row->group_dn);
1144 $this->setGroupScope($row->group_scope);
1145 $this->setGroupFilter($row->group_filter);
1146 $this->setGroupMember($row->group_member);
1147 $this->setGroupAttribute($row->group_attribute);
1148 $this->toggleMembershipOptional($row->group_optional);
1149 $this->setGroupUserFilter($row->group_user_filter);
1150 $this->enableGroupMemberIsDN($row->group_memberisdn);
1151 $this->setGroupName($row->group_name);
1152 $this->enableSyncOnLogin($row->sync_on_login);
1153 $this->enableSyncPerCron($row->sync_per_cron);
1154 $this->enableRoleSynchronization($row->role_sync_active);
1155 $this->setRoleBindDN($row->role_bind_dn);
1156 $this->setRoleBindPassword($row->role_bind_pass);
1157 $this->enableAccountMigration($row->migration);
1158 $this->enableAuthentication($row->authentication);
1159 $this->setAuthenticationMapping($row->authentication_type);
1160 $this->setUsernameFilter($row->username_filter);
1161 $this->enableEscapeDN($row->escape_dn);
1162 }
1163 }
setGroupScope($a_value)
enableEscapeDN(bool $a_value)
setGroupName($a_value)
setGroupAttribute($a_value)
setAuthenticationMapping($a_map)
Set mapped authentication mapping.
setSearchBase($a_search_base)
enableSyncOnLogin($a_value)
toggleTLS($a_status)
setRoleBindDN($a_value)
enableGroupMemberIsDN($a_value)
setUsernameFilter($a_value)
enableSyncPerCron($a_value)
toggleReferrer($a_status)
setUserScope($a_value)
setGroupUserFilter($a_filter)
enableRoleSynchronization($a_value)
setFilter($a_filter)
toggleMembershipOptional($a_status)
setRoleBindPassword($a_value)
setBindPassword($a_password)
toggleActive($a_status)
setGroupMember($a_value)
setVersion($a_version)
setGroupFilter($a_value)
setBaseDN($a_base_dn)
setUserAttribute($a_user_attr)
enableAccountMigration($a_status)
Enable account migration.
enableAuthentication($a_status)
Enable authentication for this ldap server.

References $query, $res, $row, enableAccountMigration(), enableAuthentication(), enableEscapeDN(), enableGroupMemberIsDN(), enableRoleSynchronization(), enableSyncOnLogin(), enableSyncPerCron(), ilDBConstants\FETCHMODE_OBJECT, setAuthenticationMapping(), setBaseDN(), setBindingType(), setBindPassword(), setBindUser(), setFilter(), setGroupAttribute(), setGroupDN(), setGroupFilter(), setGroupMember(), setGroupName(), setGroupScope(), setGroupUserFilter(), setName(), setRoleBindDN(), setRoleBindPassword(), setSearchBase(), setUrl(), setUserAttribute(), setUsernameFilter(), setUserScope(), setVersion(), toggleActive(), toggleMembershipOptional(), toggleReferrer(), and toggleTLS().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rotateFallbacks()

ilLDAPServer::rotateFallbacks ( )

Rotate fallback urls in case of connect timeouts.

Returns
boolean

Definition at line 74 of file class.ilLDAPServer.php.

75 {
76 global $DIC;
77
78 $ilDB = $DIC['ilDB'];
79
80 if (!$this->fallback_urls) {
81 return false;
82 }
83
84 $all_urls = array_merge($this->fallback_urls);
85 $all_urls[] = $this->getUrl();
86
87 $query = 'UPDATE ldap_server_settings SET ' .
88 'url = ' . $ilDB->quote(implode(',', $all_urls), 'text') . ' ' .
89 'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer');
90 $ilDB->manipulate($query);
91 return true;
92 }

References $DIC, $ilDB, $query, getServerId(), and getUrl().

Referenced by doConnectionCheck().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAuthenticationMapping()

ilLDAPServer::setAuthenticationMapping (   $a_map)

Set mapped authentication mapping.

Parameters
int$a_map

Definition at line 466 of file class.ilLDAPServer.php.

467 {
468 $this->authentication_mapping = $a_map;
469 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBaseDN()

ilLDAPServer::setBaseDN (   $a_base_dn)

Definition at line 579 of file class.ilLDAPServer.php.

580 {
581 $this->base_dn = $a_base_dn;
582 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindingType()

ilLDAPServer::setBindingType (   $a_type)

Definition at line 603 of file class.ilLDAPServer.php.

604 {
605 if ($a_type == IL_LDAP_BIND_USER) {
606 $this->binding_type = IL_LDAP_BIND_USER;
607 } else {
608 $this->binding_type = IL_LDAP_BIND_ANONYMOUS;
609 }
610 }
const IL_LDAP_BIND_USER
const IL_LDAP_BIND_ANONYMOUS
$a_type
Definition: workflow.php:92

References $a_type, IL_LDAP_BIND_ANONYMOUS, and IL_LDAP_BIND_USER.

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindPassword()

ilLDAPServer::setBindPassword (   $a_password)

Definition at line 623 of file class.ilLDAPServer.php.

624 {
625 $this->bind_password = $a_password;
626 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindUser()

ilLDAPServer::setBindUser (   $a_user)

Definition at line 615 of file class.ilLDAPServer.php.

616 {
617 $this->bind_user = $a_user;
618 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setFilter()

ilLDAPServer::setFilter (   $a_filter)

Definition at line 647 of file class.ilLDAPServer.php.

648 {
649 $this->filter = $a_filter;
650 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGlobalRole()

ilLDAPServer::setGlobalRole (   $a_role)

Definition at line 766 of file class.ilLDAPServer.php.

767 {
768 $this->global_role = $a_role;
769 }

◆ setGroupAttribute()

ilLDAPServer::setGroupAttribute (   $a_value)

Definition at line 704 of file class.ilLDAPServer.php.

705 {
706 $this->group_attribute = $a_value;
707 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupDN()

ilLDAPServer::setGroupDN (   $a_value)

Definition at line 655 of file class.ilLDAPServer.php.

656 {
657 $this->group_dn = $a_value;
658 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupFilter()

ilLDAPServer::setGroupFilter (   $a_value)

Definition at line 663 of file class.ilLDAPServer.php.

664 {
665 $this->group_filter = $a_value;
666 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupMember()

ilLDAPServer::setGroupMember (   $a_value)

Definition at line 671 of file class.ilLDAPServer.php.

672 {
673 $this->group_member = $a_value;
674 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupName()

ilLDAPServer::setGroupName (   $a_value)

Definition at line 679 of file class.ilLDAPServer.php.

680 {
681 $this->group_name = $a_value;
682 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupScope()

ilLDAPServer::setGroupScope (   $a_value)

Definition at line 734 of file class.ilLDAPServer.php.

735 {
736 $this->group_scope = $a_value;
737 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupUserFilter()

ilLDAPServer::setGroupUserFilter (   $a_filter)

Definition at line 717 of file class.ilLDAPServer.php.

718 {
719 $this->group_user_filter = $a_filter;
720 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setName()

ilLDAPServer::setName (   $a_name)

Definition at line 563 of file class.ilLDAPServer.php.

564 {
565 $this->name = $a_name;
566 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindDN()

ilLDAPServer::setRoleBindDN (   $a_value)

Definition at line 774 of file class.ilLDAPServer.php.

775 {
776 $this->role_bind_dn = $a_value;
777 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindPassword()

ilLDAPServer::setRoleBindPassword (   $a_value)

Definition at line 782 of file class.ilLDAPServer.php.

783 {
784 $this->role_bind_pass = $a_value;
785 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSearchBase()

ilLDAPServer::setSearchBase (   $a_search_base)

Definition at line 631 of file class.ilLDAPServer.php.

632 {
633 $this->search_base = $a_search_base;
634 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUrl()

ilLDAPServer::setUrl (   $a_url)

Definition at line 508 of file class.ilLDAPServer.php.

509 {
510 $this->url_string = $a_url;
511
512 // Maybe there are more than one url's (comma seperated).
513 $urls = explode(',', $a_url);
514
515 $counter = 0;
516 foreach ($urls as $url) {
517 $url = trim($url);
518 if (!$counter++) {
519 $this->url = $url;
520 } else {
521 $this->fallback_urls[] = $url;
522 }
523 }
524 }
$urls
Definition: croninfo.php:28

References $url, and $urls.

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserAttribute()

ilLDAPServer::setUserAttribute (   $a_user_attr)

Definition at line 639 of file class.ilLDAPServer.php.

640 {
641 $this->user_attribute = $a_user_attr;
642 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUsernameFilter()

ilLDAPServer::setUsernameFilter (   $a_value)

Definition at line 799 of file class.ilLDAPServer.php.

800 {
801 $this->username_filter = $a_value;
802 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserScope()

ilLDAPServer::setUserScope (   $a_value)

Definition at line 742 of file class.ilLDAPServer.php.

743 {
744 $this->user_scope = $a_value;
745 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion()

ilLDAPServer::setVersion (   $a_version)

Definition at line 571 of file class.ilLDAPServer.php.

572 {
573 $this->version = $a_version;
574 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleActive()

ilLDAPServer::toggleActive (   $a_status)

Definition at line 496 of file class.ilLDAPServer.php.

497 {
498 $this->active = $a_status;
499 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleDataSource()

static ilLDAPServer::toggleDataSource (   $a_ldap_server_id,
  $a_auth_mode,
  $a_status 
)
static

Toggle Data Source.

Todo:
handle multiple ldap servers
Parameters
int$a_auth_mode
int$a_status

Definition at line 363 of file class.ilLDAPServer.php.

364 {
365 global $DIC;
366
367 $ilDB = $DIC['ilDB'];
368
370
371 if ($a_status) {
372 $query = "UPDATE ldap_server_settings " .
373 'SET authentication_type = ' . $ilDB->quote($a_auth_mode, 'integer') . " " .
374 'WHERE server_id = ' . $ilDB->quote($a_ldap_server_id, 'integer');
375 $ilDB->manipulate($query);
376 }
377 return true;
378 }
static disableDataSourceForAuthMode($a_authmode)
Disable data source.

References $DIC, $ilDB, $query, and disableDataSourceForAuthMode().

Referenced by ilCASSettingsGUI\save(), and ilRadiusSettingsGUI\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggleMembershipOptional()

ilLDAPServer::toggleMembershipOptional (   $a_status)

Definition at line 709 of file class.ilLDAPServer.php.

710 {
711 $this->group_optional = (bool) $a_status;
712 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleReferrer()

ilLDAPServer::toggleReferrer (   $a_status)

Definition at line 587 of file class.ilLDAPServer.php.

588 {
589 $this->referrals = $a_status;
590 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleTLS()

ilLDAPServer::toggleTLS (   $a_status)

Definition at line 595 of file class.ilLDAPServer.php.

596 {
597 $this->tls = $a_status;
598 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toPearAuthArray()

ilLDAPServer::toPearAuthArray ( )

Creates an array of options compatible to PEAR Auth.

Returns
array auth settings

Definition at line 1010 of file class.ilLDAPServer.php.

1011 {
1012 $options = array(
1013 'url' => $this->getUrl(),
1014 'version' => (int) $this->getVersion(),
1015 'referrals' => (bool) $this->isActiveReferrer());
1016
1017 if ($this->getBindingType() == IL_LDAP_BIND_USER) {
1018 $options['binddn'] = $this->getBindUser();
1019 $options['bindpw'] = $this->getBindPassword();
1020 }
1021 $options['basedn'] = $this->getBaseDN();
1022 $options['start_tls'] = (bool) $this->isActiveTLS();
1023 $options['userdn'] = $this->getSearchBase();
1024 switch ($this->getUserScope()) {
1025 case IL_LDAP_SCOPE_ONE:
1026 $options['userscope'] = 'one';
1027 break;
1028 default:
1029 $options['userscope'] = 'sub';
1030 break;
1031 }
1032
1033 $options['userattr'] = $this->getUserAttribute();
1034 $options['userfilter'] = $this->getFilter();
1035 $options['attributes'] = $this->getPearAtributeArray();
1036 $options['debug'] = self::DEBUG;
1037
1038 if (@include_once('Log.php')) {
1039 if (@include_once('Log/observer.php')) {
1040 $options['enableLogging'] = true;
1041 }
1042 }
1043 switch ($this->getGroupScope()) {
1044 case IL_LDAP_SCOPE_BASE:
1045 $options['groupscope'] = 'base';
1046 break;
1047 case IL_LDAP_SCOPE_ONE:
1048 $options['groupscope'] = 'one';
1049 break;
1050 default:
1051 $options['groupscope'] = 'sub';
1052 break;
1053 }
1054 $options['escape_dn'] = $this->enabledEscapeDN();
1055 $options['groupdn'] = $this->getGroupDN();
1056 $options['groupattr'] = $this->getGroupAttribute();
1057 $options['groupfilter'] = $this->getGroupFilter();
1058 $options['memberattr'] = $this->getGroupMember();
1059 $options['memberisdn'] = $this->enabledGroupMemberIsDN();
1060 $options['group'] = $this->getGroupName();
1061
1062
1063 return $options;
1064 }
const IL_LDAP_SCOPE_BASE
const IL_LDAP_SCOPE_ONE
getPearAtributeArray()
Get attribute array for pear auth data.

References PHPMailer\PHPMailer\$options, DEBUG, enabledEscapeDN(), enabledGroupMemberIsDN(), getBaseDN(), getBindingType(), getBindPassword(), getBindUser(), getFilter(), getGroupAttribute(), getGroupDN(), getGroupFilter(), getGroupMember(), getGroupName(), getGroupScope(), getPearAtributeArray(), getSearchBase(), getUrl(), getUserAttribute(), getUserScope(), getVersion(), IL_LDAP_BIND_USER, IL_LDAP_SCOPE_BASE, IL_LDAP_SCOPE_ONE, isActiveReferrer(), and isActiveTLS().

+ Here is the call graph for this function:

◆ update()

ilLDAPServer::update ( )

Definition at line 932 of file class.ilLDAPServer.php.

933 {
934 global $DIC;
935
936 $ilDB = $DIC['ilDB'];
937
938 $query = "UPDATE ldap_server_settings SET " .
939 "active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
940 "name = " . $this->db->quote($this->getName(), 'text') . ", " .
941 "url = " . $this->db->quote($this->getUrlString(), 'text') . ", " .
942 "version = " . $this->db->quote($this->getVersion(), 'integer') . ", " .
943 "base_dn = " . $this->db->quote($this->getBaseDN(), 'text') . ", " .
944 "referrals = " . $this->db->quote($this->isActiveReferrer(), 'integer') . ", " .
945 "tls = " . $this->db->quote($this->isActiveTLS(), 'integer') . ", " .
946 "bind_type = " . $this->db->quote($this->getBindingType(), 'integer') . ", " .
947 "bind_user = " . $this->db->quote($this->getBindUser(), 'text') . ", " .
948 "bind_pass = " . $this->db->quote($this->getBindPassword(), 'text') . ", " .
949 "search_base = " . $this->db->quote($this->getSearchBase(), 'text') . ", " .
950 "user_scope = " . $this->db->quote($this->getUserScope(), 'integer') . ", " .
951 "user_attribute = " . $this->db->quote($this->getUserAttribute(), 'text') . ", " .
952 "filter = " . $this->db->quote($this->getFilter(), 'text') . ", " .
953 "group_dn = " . $this->db->quote($this->getGroupDN(), 'text') . ", " .
954 "group_scope = " . $this->db->quote($this->getGroupScope(), 'integer') . ", " .
955 "group_filter = " . $this->db->quote($this->getGroupFilter(), 'text') . ", " .
956 "group_member = " . $this->db->quote($this->getGroupMember(), 'text') . ", " .
957 "group_memberisdn =" . $this->db->quote((int) $this->enabledGroupMemberIsDN(), 'integer') . ", " .
958 "group_name = " . $this->db->quote($this->getGroupName(), 'text') . ", " .
959 "group_attribute = " . $this->db->quote($this->getGroupAttribute(), 'text') . ", " .
960 "group_optional = " . $this->db->quote((int) $this->isMembershipOptional(), 'integer') . ", " .
961 "group_user_filter = " . $this->db->quote($this->getGroupUserFilter(), 'text') . ", " .
962 "sync_on_login = " . $this->db->quote(($this->enabledSyncOnLogin() ? 1 : 0), 'integer') . ", " .
963 "sync_per_cron = " . $this->db->quote(($this->enabledSyncPerCron() ? 1 : 0), 'integer') . ", " .
964 "role_sync_active = " . $this->db->quote($this->enabledRoleSynchronization(), 'integer') . ", " .
965 "role_bind_dn = " . $this->db->quote($this->getRoleBindDN(), 'text') . ", " .
966 "role_bind_pass = " . $this->db->quote($this->getRoleBindPassword(), 'text') . ", " .
967 "migration = " . $this->db->quote((int) $this->isAccountMigrationEnabled(), 'integer') . ", " .
968 'authentication = ' . $this->db->quote((int) $this->isAuthenticationEnabled(), 'integer') . ', ' .
969 'authentication_type = ' . $this->db->quote((int) $this->getAuthenticationMapping(), 'integer') . ' ' .
970 ", username_filter = " . $this->db->quote($this->getUsernameFilter(), "text") . " " .
971 ", escape_dn = " . $this->db->quote($this->enabledEscapeDN() ? 1 : 0, 'integer') . " " .
972 "WHERE server_id = " . $this->db->quote($this->getServerId(), 'integer');
973
974 $res = $ilDB->manipulate($query);
975 return true;
976 }

References $DIC, $ilDB, $query, $res, enabledEscapeDN(), enabledGroupMemberIsDN(), enabledRoleSynchronization(), enabledSyncOnLogin(), enabledSyncPerCron(), getAuthenticationMapping(), getBaseDN(), getBindingType(), getBindPassword(), getBindUser(), getFilter(), getGroupAttribute(), getGroupDN(), getGroupFilter(), getGroupMember(), getGroupName(), getGroupScope(), getGroupUserFilter(), getName(), getRoleBindDN(), getRoleBindPassword(), getSearchBase(), getServerId(), getUrlString(), getUserAttribute(), getUsernameFilter(), getUserScope(), getVersion(), isAccountMigrationEnabled(), isActive(), isActiveReferrer(), isActiveTLS(), isAuthenticationEnabled(), and isMembershipOptional().

+ Here is the call graph for this function:

◆ validate()

ilLDAPServer::validate ( )

Validate user input.

Parameters

return boolean

Definition at line 843 of file class.ilLDAPServer.php.

844 {
845 global $DIC;
846
847 $ilErr = $DIC['ilErr'];
848
849 $ilErr->setMessage('');
850 if (!strlen($this->getName()) ||
851 !strlen($this->getUrl()) ||
852 !strlen($this->getBaseDN()) ||
853 !strlen($this->getUserAttribute())) {
854 $ilErr->setMessage($this->lng->txt('fill_out_all_required_fields'));
855 }
856
857 if ($this->getBindingType() == IL_LDAP_BIND_USER
858 && (!strlen($this->getBindUser()) || !strlen($this->getBindPassword()))) {
859 $ilErr->appendMessage($this->lng->txt('ldap_missing_bind_user'));
860 }
861
862 if (($this->enabledSyncPerCron() or $this->enabledSyncOnLogin()) and !$this->global_role) {
863 $ilErr->appendMessage($this->lng->txt('ldap_missing_role_assignment'));
864 }
865 if ($this->getVersion() == 2 and $this->isActiveTLS()) {
866 $ilErr->appendMessage($this->lng->txt('ldap_tls_conflict'));
867 }
868
869 return strlen($ilErr->getMessage()) ? false : true;
870 }
$ilErr
Definition: raiseError.php:18

References $DIC, $ilErr, enabledSyncOnLogin(), enabledSyncPerCron(), getBaseDN(), getBindingType(), getBindPassword(), getBindUser(), getName(), getUrl(), getUserAttribute(), getVersion(), IL_LDAP_BIND_USER, and isActiveTLS().

+ Here is the call graph for this function:

Field Documentation

◆ $authentication_mapping

ilLDAPServer::$authentication_mapping = 0
private

Definition at line 40 of file class.ilLDAPServer.php.

Referenced by getAuthenticationMapping().

◆ $enabled_authentication

ilLDAPServer::$enabled_authentication = true
private

Definition at line 39 of file class.ilLDAPServer.php.

Referenced by isAuthenticationEnabled().

◆ $escape_dn

ilLDAPServer::$escape_dn = false
private

Definition at line 41 of file class.ilLDAPServer.php.

Referenced by enabledEscapeDN().

◆ $fallback_urls

ilLDAPServer::$fallback_urls = array()
private

Definition at line 37 of file class.ilLDAPServer.php.

◆ $instances

ilLDAPServer::$instances = array()
staticprivate

Definition at line 26 of file class.ilLDAPServer.php.

◆ $role_bind_dn

ilLDAPServer::$role_bind_dn = ''
private

Definition at line 32 of file class.ilLDAPServer.php.

Referenced by getRoleBindDN().

◆ $role_bind_pass

ilLDAPServer::$role_bind_pass = ''
private

Definition at line 33 of file class.ilLDAPServer.php.

Referenced by getRoleBindPassword().

◆ $role_sync_active

ilLDAPServer::$role_sync_active = 0
private

Definition at line 34 of file class.ilLDAPServer.php.

Referenced by enabledRoleSynchronization().

◆ $server_id

ilLDAPServer::$server_id = null
private

Definition at line 36 of file class.ilLDAPServer.php.

Referenced by getServerId().

◆ DEBUG

const ilLDAPServer::DEBUG = false

Definition at line 28 of file class.ilLDAPServer.php.

Referenced by toPearAuthArray().

◆ DEFAULT_NETWORK_TIMEOUT

const ilLDAPServer::DEFAULT_NETWORK_TIMEOUT = 5

Definition at line 30 of file class.ilLDAPServer.php.

Referenced by ilLDAPQuery\bind().

◆ DEFAULT_VERSION

const ilLDAPServer::DEFAULT_VERSION = 3

Definition at line 29 of file class.ilLDAPServer.php.

Referenced by getVersion().


The documentation for this class was generated from the following file: