ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 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
 

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 42 of file class.ilLDAPServer.php.

43 {
44 global $ilDB,$lng;
45
46 $this->db = $ilDB;
47 $this->lng = $lng;
48 $this->server_id = $a_server_id;
49
50 $this->read();
51 }
read()
Read server settings.
global $lng
Definition: privfeed.php:40
global $ilDB

References $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 105 of file class.ilLDAPServer.php.

106 {
107 global $ilDB;
108
109 $query = "SELECT server_id FROM ldap_server_settings ".
110 "WHERE active = 1 AND authentication = 1 ".
111 "ORDER BY name ";
112 $res = $ilDB->query($query);
113 $server_ids = array();
114 while($row = $ilDB->fetchObject($res))
115 {
116 $server_ids[] = $row->server_id;
117 }
118 return $server_ids;
119 }

References $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 241 of file class.ilLDAPServer.php.

242 {
243 global $ilDB;
244
245 $query = "SELECT * FROM ldap_server_settings ORDER BY name";
246
247 $server = array();
248
249 $res = $ilDB->query($query);
250 while($row = $ilDB->fetchAssoc($res))
251 {
252 $server[] = $row;
253 }
254 return $server;
255 }
$server

References $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 126 of file class.ilLDAPServer.php.

127 {
128 global $ilDB;
129
130 $query = "SELECT server_id FROM ldap_server_settings ".
131 "WHERE active = 1 ".
132 "AND sync_per_cron = 1 ".
133 "ORDER BY name";
134
135 $res = $ilDB->query($query);
136 while($row = $ilDB->fetchObject($res))
137 {
138 $server_ids[] = $row->server_id;
139 }
140 return $server_ids ? $server_ids : array();
141 }

References $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 185 of file class.ilLDAPServer.php.

186 {
188 if(count($servers))
189 {
190 return $servers[0];
191 }
192 return 0;
193 }
static _getActiveServerList()
Get active server list.

References _getActiveServerList().

Referenced by ilAuthContainerLDAP\__construct(), ilECSCmsCourseMemberCommandQueueHandler\createMember(), ilAuthLoginPageEditorGUI\initLoginForm(), and ilLDAPRoleAssignmentRule\isGroupMember().

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

◆ _getFirstServer()

static ilLDAPServer::_getFirstServer ( )
static

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

263 {
264 $servers = ilLDAPServer::_getServerList();
265
266 if(count($servers))
267 {
268 return $servers[0];
269 }
270 return 0;
271 }
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 174 of file class.ilLDAPServer.php.

175 {
177 }

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 150 of file class.ilLDAPServer.php.

151 {
152 global $ilDB;
153
154 $query = "SELECT server_id FROM ldap_server_settings ".
155 "WHERE active = 1 ".
156 "AND role_sync_active = 1 ";
157
158 $res = $ilDB->query($query);
159 $server_ids = array();
160 while($row = $ilDB->fetchObject($res))
161 {
162 $server_ids[] = $row->server_id;
163 }
164 return $server_ids;
165 }

References $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 200 of file class.ilLDAPServer.php.

201 {
202 global $ilDB;
203
204 $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
205
206 $res = $ilDB->query($query);
207 while($row = $ilDB->fetchObject($res))
208 {
209 $server_ids[] = $row->server_id;
210 }
211 return $server_ids ? $server_ids : array();
212 }

References $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 95 of file class.ilLDAPServer.php.

96 {
97 return function_exists('ldap_bind');
98 }

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

References $ilDB, $query, $res, 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 976 of file class.ilLDAPServer.php.

977 {
978 if(!$this->getServerId())
979 {
980 return false;
981 }
982
983 include_once 'Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
985
986 include_once 'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
988
989 foreach($rules as $ruleAssigment)
990 {
991 $ruleAssigment->delete();
992 }
993
994 include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
996
997 $query = "DELETE FROM ldap_server_settings ".
998 "WHERE server_id = ".$this->db->quote($this->getServerId(),'integer');
999 $res = $this->db->manipulate($query);
1000
1001 }
static _delete($a_server_id)
Delete mapping rules by server id.
_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 331 of file class.ilLDAPServer.php.

332 {
333 global $ilDB;
334
335 $query = 'UPDATE ldap_server_settings '.
336 'SET authentication_type = '. $ilDB->quote(0,'integer').' '.
337 'WHERE authentication_type = '.$ilDB->quote($a_authmode,'integer');
338 $ilDB->manipulate($query);
339 return true;
340 }

References $ilDB, and $query.

Referenced by 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 532 of file class.ilLDAPServer.php.

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

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 819 of file class.ilLDAPServer.php.

820 {
821 $this->account_migration = $a_status;
822 }

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 438 of file class.ilLDAPServer.php.

439 {
440 $this->enabled_authentication = (bool) $a_status;
441 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enabledGroupMemberIsDN()

ilLDAPServer::enabledGroupMemberIsDN ( )

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

735 {
736 return (bool) $this->memberisdn;
737 }

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

+ Here is the caller graph for this function:

◆ enabledRoleSynchronization()

ilLDAPServer::enabledRoleSynchronization ( )

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

795 {
797 }

References $role_sync_active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ enabledSyncOnLogin()

ilLDAPServer::enabledSyncOnLogin ( )

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

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

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

+ Here is the caller graph for this function:

◆ enabledSyncPerCron()

ilLDAPServer::enabledSyncPerCron ( )

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

767 {
768 return $this->sync_per_cron;
769 }

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

+ Here is the caller graph for this function:

◆ enableGroupMemberIsDN()

ilLDAPServer::enableGroupMemberIsDN (   $a_value)

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

739 {
740 $this->memberisdn = (bool) $a_value;
741 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableRoleSynchronization()

ilLDAPServer::enableRoleSynchronization (   $a_value)

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

799 {
800 $this->role_sync_active = $a_value;
801 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncOnLogin()

ilLDAPServer::enableSyncOnLogin (   $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncPerCron()

ilLDAPServer::enableSyncPerCron (   $a_value)

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

771 {
772 $this->sync_per_cron = (int) $a_value;
773 }

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 465 of file class.ilLDAPServer.php.

466 {
468 }

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 475 of file class.ilLDAPServer.php.

476 {
477 if($this->isAuthenticationEnabled() or !$this->getAuthenticationMapping())
478 {
479 // begin-patch ldap_multiple
480 return 'ldap_'.$this->getServerId();
481 #return 'ldap';
482 // end-patch ldap_multiple
483 }
485 }
static _getAuthModeName($a_auth_key)

References ilAuthUtils\_getAuthModeName(), getAuthenticationMapping(), 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 401 of file class.ilLDAPServer.php.

402 {
403 $auth_arr = explode('_', $a_auth_key);
404 if(count((array) $auth_arr) > 1)
405 {
406 return 'ldap_'.$auth_arr[1];
407 }
408 return 'ldap';
409 }

Referenced by ilAuthUtils\_getAuthModeName().

+ Here is the caller graph for this function:

◆ getAvailableDataSources()

static ilLDAPServer::getAvailableDataSources (   $a_auth_mode)
static

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

275 {
276 global $ilDB;
277
278 $query = "SELECT server_id FROM ldap_server_settings ".
279 "WHERE active = ".$ilDB->quote(1,'integer')." ".
280 "AND authentication = ".$ilDB->quote(0,'integer')." ".
281 "AND ( authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
282 "OR authentication_type = ".$ilDB->quote(0,'integer').")";
283 $res = $ilDB->query($query);
284
285 $server_ids = array();
286 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
287 {
288 $server_ids[] = $row->server_id;
289 }
290 return $server_ids;
291 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

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

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

+ Here is the caller graph for this function:

◆ getBaseDN()

ilLDAPServer::getBaseDN ( )

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

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

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

+ Here is the caller graph for this function:

◆ getBindingType()

ilLDAPServer::getBindingType ( )

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

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

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

+ Here is the caller graph for this function:

◆ getBindPassword()

ilLDAPServer::getBindPassword ( )

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

622 {
623 return $this->bind_password;
624 }

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

+ Here is the caller graph for this function:

◆ getBindUser()

ilLDAPServer::getBindUser ( )

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

614 {
615 return $this->bind_user;
616 }

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 314 of file class.ilLDAPServer.php.

315 {
316 global $ilDB;
317
318 $query = "SELECT server_id FROM ldap_server_settings ".
319 "WHERE authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ";
320 $res = $ilDB->query($query);
321 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
322 {
323 return $row->server_id;
324 }
325 return 0;
326 }

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

Referenced by ilObjAuthSettingsGUI\getApacheAuthSettingsForm(), ilAuthContainerCAS\handleLDAPDataSource(), ilAuthContainerRadius\handleLDAPDataSource(), and ilRadiusSettingsGUI\settings().

+ Here is the caller graph for this function:

◆ getFilter()

ilLDAPServer::getFilter ( )

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

646 {
647 return $this->prepareFilter($this->filter);
648 }
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 708 of file class.ilLDAPServer.php.

709 {
710 return $this->group_attribute;
711 }

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

+ Here is the caller graph for this function:

◆ getGroupDN()

ilLDAPServer::getGroupDN ( )

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

654 {
655 return $this->group_dn;
656 }

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

+ Here is the caller graph for this function:

◆ getGroupFilter()

ilLDAPServer::getGroupFilter ( )

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

662 {
663 return $this->prepareFilter($this->group_filter);
664 }

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 669 of file class.ilLDAPServer.php.

670 {
671 return $this->group_member;
672 }

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

+ Here is the caller graph for this function:

◆ getGroupName()

ilLDAPServer::getGroupName ( )

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

678 {
679 return $this->group_name;
680 }

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

+ Here is the caller graph for this function:

◆ getGroupNames()

ilLDAPServer::getGroupNames ( )

Get group names as array.

@access public

Parameters

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

693 {
694 $names = explode(',',$this->getGroupName());
695
696 if(!is_array($names))
697 {
698 return array();
699 }
700 foreach($names as $name)
701 {
702 $new_names[] = trim($name);
703 }
704 return $new_names;
705 }

References getGroupName().

+ Here is the call graph for this function:

◆ getGroupScope()

ilLDAPServer::getGroupScope ( )

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

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

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

+ Here is the caller graph for this function:

◆ getGroupUserFilter()

ilLDAPServer::getGroupUserFilter ( )

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

730 {
731 return $this->group_user_filter;
732 }

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 416 of file class.ilLDAPServer.php.

417 {
418 $auth_arr = explode('_', $a_auth_mode);
419 if(count((array) $auth_arr) > 1)
420 {
421 return AUTH_LDAP.'_'.$auth_arr[1];
422 }
423 return AUTH_LDAP;
424 }
const AUTH_LDAP

References AUTH_LDAP.

Referenced by ilAuthUtils\_getAuthMode().

+ Here is the caller graph for this function:

◆ getName()

ilLDAPServer::getName ( )

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

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

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 1102 of file class.ilLDAPServer.php.

1103 {
1104 if($this->enabledSyncOnLogin())
1105 {
1106 include_once('Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
1107 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
1109 return array_merge(
1110 array($this->getUserAttribute()),
1111 $mapping->getFields(),
1112 array('dn'),
1114 );
1115 }
1116 else
1117 {
1118 return array($this->getUserAttribute());
1119 }
1120 }
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 778 of file class.ilLDAPServer.php.

779 {
780 return $this->role_bind_dn;
781 }

References $role_bind_dn.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getRoleBindPassword()

ilLDAPServer::getRoleBindPassword ( )

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

787 {
789 }

References $role_bind_pass.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getSearchBase()

ilLDAPServer::getSearchBase ( )

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

630 {
631 return $this->search_base;
632 }

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

+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPServer::getServerId ( )

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

430 {
431 return $this->server_id;
432 }

References $server_id.

Referenced by delete(), 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 387 of file class.ilLDAPServer.php.

388 {
389 if(self::isAuthModeLDAP($a_auth_mode))
390 {
391 $auth_arr = explode('_', $a_auth_mode);
392 return $auth_arr[1];
393 }
394 return NULL;
395 }

Referenced by ilAuthUtils\_initAuth(), ilObjAuthSettingsGUI\authSettingsObject(), ilAuthContainerMultiple\fetchData(), 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 219 of file class.ilLDAPServer.php.

220 {
221 global $ilDB;
222
223 $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
224
225
226 $res = $ilDB->query($query);
227
228 $server = array();
229 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
230 {
231 $server[] = $row->server_id;
232 }
233 return $server;
234 }

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

Referenced by ilObjAuthSettingsGUI\getApacheAuthSettingsForm().

+ Here is the caller graph for this function:

◆ getUrl()

ilLDAPServer::getUrl ( )

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

496 {
497 return $this->url;
498 }

References $url.

Referenced by ilLDAPQuery\__construct(), rotateFallbacks(), toPearAuthArray(), and validate().

+ Here is the caller graph for this function:

◆ getUrlString()

ilLDAPServer::getUrlString ( )

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

521 {
522 return $this->url_string;
523 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserAttribute()

ilLDAPServer::getUserAttribute ( )

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

638 {
639 return $this->user_attribute;
640 }

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

+ Here is the caller graph for this function:

◆ getUsernameFilter()

ilLDAPServer::getUsernameFilter ( )

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

804 {
805 return $this->username_filter;
806 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserScope()

ilLDAPServer::getUserScope ( )

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

755 {
756 return $this->user_scope;
757 }

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

+ Here is the caller graph for this function:

◆ getVersion()

ilLDAPServer::getVersion ( )

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

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

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 830 of file class.ilLDAPServer.php.

831 {
832 return $this->account_migration ? true : false;
833 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActive()

ilLDAPServer::isActive ( )

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

492 {
493 return $this->active;
494 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActiveReferrer()

ilLDAPServer::isActiveReferrer ( )

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

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

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

+ Here is the caller graph for this function:

◆ isActiveTLS()

ilLDAPServer::isActiveTLS ( )

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

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

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 447 of file class.ilLDAPServer.php.

448 {
449 return (bool) $this->enabled_authentication;
450 }

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 371 of file class.ilLDAPServer.php.

372 {
373 if(!$a_auth_mode)
374 {
375 $GLOBALS['ilLog']->write(__METHOD__.': No auth mode given..............');
376 return false;
377 }
378 $auth_arr = explode('_', $a_auth_mode);
379 return ($auth_arr[0] == AUTH_LDAP) and $auth_arr[1];
380 }
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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 299 of file class.ilLDAPServer.php.

300 {
301 global $ilDB;
302
303 $query = "SELECT server_id FROM ldap_server_settings ".
304 "WHERE authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
305 "AND authentication = ".$ilDB->quote(0,'integer');
306 $res = $ilDB->query($query);
307 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
308 {
309 return true;
310 }
311 return false;
312 }

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

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

+ Here is the caller graph for this function:

◆ isMembershipOptional()

ilLDAPServer::isMembershipOptional ( )

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

722 {
723 return (bool) $this->group_optional;
724 }

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 1075 of file class.ilLDAPServer.php.

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

Referenced by getFilter(), and getGroupFilter().

+ Here is the caller graph for this function:

◆ read()

ilLDAPServer::read ( )
private

Read server settings.

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

1129 {
1130 if(!$this->server_id)
1131 {
1132 return true;
1133 }
1134 $query = "SELECT * FROM ldap_server_settings WHERE server_id = ".$this->db->quote($this->server_id)."";
1135
1136 $res = $this->db->query($query);
1137 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1138 {
1139 $this->toggleActive($row->active);
1140 $this->setName($row->name);
1141 $this->setUrl($row->url);
1142 $this->setVersion($row->version);
1143 $this->setBaseDN($row->base_dn);
1144 $this->toggleReferrer($row->referrals);
1145 $this->toggleTLS($row->tls);
1146 $this->setBindingType($row->bind_type);
1147 $this->setBindUser($row->bind_user);
1148 $this->setBindPassword($row->bind_pass);
1149 $this->setSearchBase($row->search_base);
1150 $this->setUserScope($row->user_scope);
1151 $this->setUserAttribute($row->user_attribute);
1152 $this->setFilter($row->filter);
1153 $this->setGroupDN($row->group_dn);
1154 $this->setGroupScope($row->group_scope);
1155 $this->setGroupFilter($row->group_filter);
1156 $this->setGroupMember($row->group_member);
1157 $this->setGroupAttribute($row->group_attribute);
1158 $this->toggleMembershipOptional($row->group_optional);
1159 $this->setGroupUserFilter($row->group_user_filter);
1160 $this->enableGroupMemberIsDN($row->group_memberisdn);
1161 $this->setGroupName($row->group_name);
1162 $this->enableSyncOnLogin($row->sync_on_login);
1163 $this->enableSyncPerCron($row->sync_per_cron);
1164 $this->enableRoleSynchronization($row->role_sync_active);
1165 $this->setRoleBindDN($row->role_bind_dn);
1166 $this->setRoleBindPassword($row->role_bind_pass);
1167 $this->enableAccountMigration($row->migration);
1168 $this->enableAuthentication($row->authentication);
1169 $this->setAuthenticationMapping($row->authentication_type);
1170 // start Patch Name Filter
1171 $this->setUsernameFilter($row->username_filter);
1172 // end Patch Name Filter
1173 }
1174 }
setGroupScope($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, DB_FETCHMODE_OBJECT, enableAccountMigration(), enableAuthentication(), enableGroupMemberIsDN(), enableRoleSynchronization(), enableSyncOnLogin(), enableSyncPerCron(), 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 71 of file class.ilLDAPServer.php.

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

References $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 456 of file class.ilLDAPServer.php.

457 {
458 $this->authentication_mapping = $a_map;
459 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBaseDN()

ilLDAPServer::setBaseDN (   $a_base_dn)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindingType()

ilLDAPServer::setBindingType (   $a_type)

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

603 {
604 if($a_type == IL_LDAP_BIND_USER)
605 {
606 $this->binding_type = IL_LDAP_BIND_USER;
607 }
608 else
609 {
610 $this->binding_type = IL_LDAP_BIND_ANONYMOUS;
611 }
612 }
const IL_LDAP_BIND_USER
const IL_LDAP_BIND_ANONYMOUS

References 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 625 of file class.ilLDAPServer.php.

626 {
627 $this->bind_password = $a_password;
628 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindUser()

ilLDAPServer::setBindUser (   $a_user)

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

618 {
619 $this->bind_user = $a_user;
620 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setFilter()

ilLDAPServer::setFilter (   $a_filter)

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

650 {
651 $this->filter = $a_filter;
652 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGlobalRole()

ilLDAPServer::setGlobalRole (   $a_role)

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

775 {
776 $this->global_role = $a_role;
777 }

◆ setGroupAttribute()

ilLDAPServer::setGroupAttribute (   $a_value)

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

713 {
714 $this->group_attribute = $a_value;
715 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupDN()

ilLDAPServer::setGroupDN (   $a_value)

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

658 {
659 $this->group_dn = $a_value;
660 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupFilter()

ilLDAPServer::setGroupFilter (   $a_value)

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

666 {
667 $this->group_filter = $a_value;
668 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupMember()

ilLDAPServer::setGroupMember (   $a_value)

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

674 {
675 $this->group_member = $a_value;
676 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupName()

ilLDAPServer::setGroupName (   $a_value)

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

682 {
683 $this->group_name = $a_value;
684 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupScope()

ilLDAPServer::setGroupScope (   $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupUserFilter()

ilLDAPServer::setGroupUserFilter (   $a_filter)

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

726 {
727 $this->group_user_filter = $a_filter;
728 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setName()

ilLDAPServer::setName (   $a_name)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindDN()

ilLDAPServer::setRoleBindDN (   $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindPassword()

ilLDAPServer::setRoleBindPassword (   $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setSearchBase()

ilLDAPServer::setSearchBase (   $a_search_base)

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

634 {
635 $this->search_base = $a_search_base;
636 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUrl()

ilLDAPServer::setUrl (   $a_url)

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

500 {
501 $this->url_string = $a_url;
502
503 // Maybe there are more than one url's (comma seperated).
504 $urls = explode(',',$a_url);
505
506 $counter = 0;
507 foreach($urls as $url)
508 {
509 $url = trim($url);
510 if(!$counter++)
511 {
512 $this->url = $url;
513 }
514 else
515 {
516 $this->fallback_urls[] = $url;
517 }
518 }
519 }

References $url.

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserAttribute()

ilLDAPServer::setUserAttribute (   $a_user_attr)

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

642 {
643 $this->user_attribute = $a_user_attr;
644 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUsernameFilter()

ilLDAPServer::setUsernameFilter (   $a_value)

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

808 {
809 $this->username_filter = $a_value;
810 }// end Patch Name Filter

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserScope()

ilLDAPServer::setUserScope (   $a_value)

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

751 {
752 $this->user_scope = $a_value;
753 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion()

ilLDAPServer::setVersion (   $a_version)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleActive()

ilLDAPServer::toggleActive (   $a_status)

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

488 {
489 $this->active = $a_status;
490 }

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 350 of file class.ilLDAPServer.php.

351 {
352 global $ilDB;
353
355
356 if($a_status)
357 {
358 $query = "UPDATE ldap_server_settings ".
359 'SET authentication_type = '.$ilDB->quote($a_auth_mode,'integer')." ".
360 'WHERE server_id = '.$ilDB->quote($a_ldap_server_id,'integer');
361 $ilDB->manipulate($query);
362 }
363 return true;
364 }
static disableDataSourceForAuthMode($a_authmode)
Disable data source.

References $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 717 of file class.ilLDAPServer.php.

718 {
719 $this->group_optional = (bool) $a_status;
720 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleReferrer()

ilLDAPServer::toggleReferrer (   $a_status)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleTLS()

ilLDAPServer::toggleTLS (   $a_status)

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

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

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 1008 of file class.ilLDAPServer.php.

1009 {
1010 $options = array(
1011 'url' => $this->getUrl(),
1012 'version' => (int) $this->getVersion(),
1013 'referrals' => (bool) $this->isActiveReferrer());
1014
1015 if($this->getBindingType() == IL_LDAP_BIND_USER)
1016 {
1017 $options['binddn'] = $this->getBindUser();
1018 $options['bindpw'] = $this->getBindPassword();
1019 }
1020 $options['basedn'] = $this->getBaseDN();
1021 $options['start_tls'] = (bool) $this->isActiveTLS();
1022 $options['userdn'] = $this->getSearchBase();
1023 switch($this->getUserScope())
1024 {
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 {
1040 if(@include_once('Log/observer.php'))
1041 {
1042 $options['enableLogging'] = true;
1043 }
1044 }
1045 switch($this->getGroupScope())
1046 {
1047 case IL_LDAP_SCOPE_BASE:
1048 $options['groupscope'] = 'base';
1049 break;
1050 case IL_LDAP_SCOPE_ONE:
1051 $options['groupscope'] = 'one';
1052 break;
1053 default:
1054 $options['groupscope'] = 'sub';
1055 break;
1056 }
1057 $options['groupdn'] = $this->getGroupDN();
1058 $options['groupattr'] = $this->getGroupAttribute();
1059 $options['groupfilter'] = $this->getGroupFilter();
1060 $options['memberattr'] = $this->getGroupMember();
1061 $options['memberisdn'] = $this->enabledGroupMemberIsDN();
1062 $options['group'] = $this->getGroupName();
1063
1064
1065 return $options;
1066 }
const IL_LDAP_SCOPE_BASE
const IL_LDAP_SCOPE_ONE
getPearAtributeArray()
Get attribute array for pear auth data.
if(!is_array($argv)) $options

References $options, DEBUG, 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 928 of file class.ilLDAPServer.php.

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

References $ilDB, $query, $res, 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 841 of file class.ilLDAPServer.php.

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

References $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().

◆ $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

◆ 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: