ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 enableAccountMigration ($a_status)
 Enable account migration. More...
 
 isAccountMigrationEnabled ()
 enabled account migration More...
 
 validate ()
 Validate user input. More...
 
 create ()
 
 update ()
 
 toPearAuthArray ()
 Creates an array of options compatible to PEAR Auth. More...
 

Static Public Member Functions

static getInstanceByServerId ($a_server_id)
 
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 _getFirstServer ()
 
static getAvailableDataSources ($a_auth_mode)
 
static isDataSourceActive ($a_auth_mode)
 Check if a data source is active for a specific auth mode ilDB $ilDB. More...
 
static getDataSource ($a_auth_mode)
 
static toggleDataSource ($a_auth_mode, $a_status)
 Toggle Data Source. 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$

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.

References $lng, and read().

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

References $query, $res, and $row.

Referenced by ilAuthUtils\_getActiveAuthModes(), _getFirstActiveServer(), _getPasswordServers(), ilAuthUtils\_hasMultipleAuthenticationMethods(), ilAuthUtils\_isExternalAccountEnabled(), and ilObjAuthSettingsGUI\authSettingsObject().

101  {
102  global $ilDB;
103 
104  $query = "SELECT server_id FROM ldap_server_settings ".
105  "WHERE active = 1 AND authentication = 1 ".
106  "ORDER BY name ";
107  $res = $ilDB->query($query);
108  $server_ids = array();
109  while($row = $ilDB->fetchObject($res))
110  {
111  $server_ids[] = $row->server_id;
112  }
113  return $server_ids;
114  }
+ 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 121 of file class.ilLDAPServer.php.

References $query, $res, and $row.

Referenced by ilLDAPCronSynchronization\run().

122  {
123  global $ilDB;
124 
125  $query = "SELECT server_id FROM ldap_server_settings ".
126  "WHERE active = 1 ".
127  "AND sync_per_cron = 1 ".
128  "ORDER BY name";
129 
130  $res = $ilDB->query($query);
131  while($row = $ilDB->fetchObject($res))
132  {
133  $server_ids[] = $row->server_id;
134  }
135  return $server_ids ? $server_ids : array();
136  }
+ 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 180 of file class.ilLDAPServer.php.

References _getActiveServerList().

Referenced by ilAuthContainerLDAP\__construct(), ilAuthUtils\_getMultipleAuthModeOptions(), ilECSCmsCourseMemberCommandQueueHandler\createMember(), ilAuthContainerApache\forceCreation(), ilLDAPRoleAssignmentRules\getDefaultRole(), ilAuthLoginPageEditorGUI\initLoginForm(), ilLDAPRoleAssignmentRule\isGroupMember(), and ilAuthModeDetermination\read().

181  {
183  if(count($servers))
184  {
185  return $servers[0];
186  }
187  return 0;
188  }
static _getActiveServerList()
Get active server list.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFirstServer()

static ilLDAPServer::_getFirstServer ( )
static

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

References _getServerList().

Referenced by ilLDAPSettingsGUI\initServer().

215  {
216  $servers = ilLDAPServer::_getServerList();
217 
218  if(count($servers))
219  {
220  return $servers[0];
221  }
222  return 0;
223  }
static _getServerList()
Get list of all configured servers.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getPasswordServers()

static ilLDAPServer::_getPasswordServers ( )
static

Checks whether password synchronistation is enabled for an user.

public

Parameters
intuser_id

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

References _getActiveServerList().

170  {
172  }
static _getActiveServerList()
Get active server list.
+ 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.

public

Parameters

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

References $query, $res, and $row.

Referenced by ilLDAPRoleGroupMapping\initServers().

146  {
147  global $ilDB;
148 
149  $query = "SELECT server_id FROM ldap_server_settings ".
150  "WHERE active = 1 ".
151  "AND role_sync_active = 1 ";
152 
153  $res = $ilDB->query($query);
154  $server_ids = array();
155  while($row = $ilDB->fetchObject($res))
156  {
157  $server_ids[] = $row->server_id;
158  }
159  return $server_ids;
160  }
+ 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 195 of file class.ilLDAPServer.php.

References $query, $res, and $row.

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

196  {
197  global $ilDB;
198 
199  $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
200 
201  $res = $ilDB->query($query);
202  while($row = $ilDB->fetchObject($res))
203  {
204  $server_ids[] = $row->server_id;
205  }
206  return $server_ids ? $server_ids : array();
207  }
+ Here is the caller graph for this function:

◆ checkLDAPLib()

static ilLDAPServer::checkLDAPLib ( )
static

Check if ldap module is installed.

Returns

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

Referenced by ilLDAPSettingsGUI\serverList().

91  {
92  return function_exists('ldap_bind');
93  }
+ Here is the caller graph for this function:

◆ create()

ilLDAPServer::create ( )

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

References $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(), getUserScope(), getVersion(), isAccountMigrationEnabled(), isActive(), isActiveReferrer(), isActiveTLS(), isAuthenticationEnabled(), and isMembershipOptional().

743  {
744  global $ilDB;
745 
746  $next_id = $ilDB->nextId('ldap_server_settings');
747 
748  $query = 'INSERT INTO ldap_server_settings (server_id,active,name,url,version,base_dn,referrals,tls,bind_type,bind_user,bind_pass,'.
749  'search_base,user_scope,user_attribute,filter,group_dn,group_scope,group_filter,group_member,group_memberisdn,group_name,'.
750  'group_attribute,group_optional,group_user_filter,sync_on_login,sync_per_cron,role_sync_active,role_bind_dn,role_bind_pass,migration, '.
751  'authentication,authentication_type) '.
752  '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)';
753  $res = $ilDB->queryF($query,
754  array(
755  'integer','integer','text','text','integer','text','integer','integer','integer','text','text','text','integer',
756  'text','text','text','integer','text','text','integer','text','text','integer','text','integer','integer','integer',
757  'text','text', 'integer','integer','integer'),
758  array(
759  $next_id,
760  $this->isActive(),
761  $this->getName(),
762  $this->getUrlString(),
763  $this->getVersion(),
764  $this->getBaseDN(),
765  $this->isActiveReferrer(),
766  $this->isActiveTLS(),
767  $this->getBindingType(),
768  $this->getBindUser(),
769  $this->getBindPassword(),
770  $this->getSearchBase(),
771  $this->getUserScope(),
772  $this->getUserAttribute(),
773  $this->getFilter(),
774  $this->getGroupDN(),
775  $this->getGroupScope(),
776  $this->getGroupFilter(),
777  $this->getGroupMember(),
778  $this->enabledGroupMemberIsDN(),
779  $this->getGroupName(),
780  $this->getGroupAttribute(),
781  $this->isMembershipOptional(),
782  $this->getGroupUserFilter(),
783  $this->enabledSyncOnLogin(),
784  $this->enabledSyncPerCron(),
786  $this->getRoleBindDN(),
787  $this->getRoleBindPassword(),
788  $this->isAccountMigrationEnabled(),
789  $this->isAuthenticationEnabled(),
790  $this->getAuthenticationMapping()
791  ));
792 
793  return $next_id;
794  }
getAuthenticationMapping()
Get authentication mode that is mapped.
isAuthenticationEnabled()
Check if authentication is enabled.
isAccountMigrationEnabled()
enabled account migration
+ Here is the call graph for this function:

◆ doConnectionCheck()

ilLDAPServer::doConnectionCheck ( )

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

public

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

References $ilLog, $query, IL_LDAP_BIND_TEST, and rotateFallbacks().

410  {
411  global $ilLog;
412 
413  include_once('Services/LDAP/classes/class.ilLDAPQuery.php');
414 
415  foreach(array_merge(array(0 => $this->url),$this->fallback_urls) as $url)
416  {
417  try
418  {
419  // Need to do a full bind, since openldap return valid connection links for invalid hosts
420  $query = new ilLDAPQuery($this,$url);
421  $query->bind(IL_LDAP_BIND_TEST);
422  $this->url = $url;
423  $ilLog->write(__METHOD__.': Using url: '.$url.'.');
424  return TRUE;
425  }
426  catch(ilLDAPQueryException $exc)
427  {
428  $this->rotateFallbacks();
429  $ilLog->write(__METHOD__.': Cannot connect to LDAP server: '.$url.' '. $exc->getCode().': '.$exc->getMessage());
430  }
431  }
432  $ilLog->write(__METHOD__.': No valid LDAP server found.');
433  return FALSE;
434  }
const IL_LDAP_BIND_TEST
rotateFallbacks()
Rotate fallback urls in case of connect timeouts.
+ Here is the call graph for this function:

◆ enableAccountMigration()

ilLDAPServer::enableAccountMigration (   $a_status)

Enable account migration.

public

Parameters
boolstatus

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

Referenced by read().

690  {
691  $this->account_migration = $a_status;
692  }
+ 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 318 of file class.ilLDAPServer.php.

Referenced by read().

319  {
320  $this->enabled_authentication = (bool) $a_status;
321  }
+ Here is the caller graph for this function:

◆ enabledGroupMemberIsDN()

ilLDAPServer::enabledGroupMemberIsDN ( )

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

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

614  {
615  return (bool) $this->memberisdn;
616  }
+ Here is the caller graph for this function:

◆ enabledRoleSynchronization()

ilLDAPServer::enabledRoleSynchronization ( )

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

References $role_sync_active.

Referenced by create(), and update().

674  {
676  }
+ Here is the caller graph for this function:

◆ enabledSyncOnLogin()

ilLDAPServer::enabledSyncOnLogin ( )

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

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

638  {
639  return $this->sync_on_login;
640  }
+ Here is the caller graph for this function:

◆ enabledSyncPerCron()

ilLDAPServer::enabledSyncPerCron ( )

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

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

646  {
647  return $this->sync_per_cron;
648  }
+ Here is the caller graph for this function:

◆ enableGroupMemberIsDN()

ilLDAPServer::enableGroupMemberIsDN (   $a_value)

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

Referenced by read().

618  {
619  $this->memberisdn = (bool) $a_value;
620  }
+ Here is the caller graph for this function:

◆ enableRoleSynchronization()

ilLDAPServer::enableRoleSynchronization (   $a_value)

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

Referenced by read().

678  {
679  $this->role_sync_active = $a_value;
680  }
+ Here is the caller graph for this function:

◆ enableSyncOnLogin()

ilLDAPServer::enableSyncOnLogin (   $a_value)

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

Referenced by read().

642  {
643  $this->sync_on_login = (int) $a_value;
644  }
+ Here is the caller graph for this function:

◆ enableSyncPerCron()

ilLDAPServer::enableSyncPerCron (   $a_value)

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

Referenced by read().

650  {
651  $this->sync_per_cron = (int) $a_value;
652  }
+ Here is the caller graph for this function:

◆ getAuthenticationMapping()

ilLDAPServer::getAuthenticationMapping ( )

Get authentication mode that is mapped.

Returns
int

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

References $authentication_mapping.

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

346  {
348  }
+ Here is the caller graph for this function:

◆ getAuthenticationMappingKey()

ilLDAPServer::getAuthenticationMappingKey ( )

Get authentication mapping key Default is ldap.

Returns
string

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

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

Referenced by ilLDAPCronSynchronization\deactivateUsers().

356  {
357  if($this->isAuthenticationEnabled() or !$this->getAuthenticationMapping())
358  {
359  return 'ldap';
360  }
362  }
static _getAuthModeName($a_auth_key)
getAuthenticationMapping()
Get authentication mode that is mapped.
isAuthenticationEnabled()
Check if authentication is enabled.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableDataSources()

static ilLDAPServer::getAvailableDataSources (   $a_auth_mode)
static

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

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

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

227  {
228  global $ilDB;
229 
230  $query = "SELECT server_id FROM ldap_server_settings ".
231  "WHERE active = ".$ilDB->quote(1,'integer')." ".
232  "AND authentication = ".$ilDB->quote(0,'integer')." ".
233  "AND ( authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
234  "OR authentication_type = ".$ilDB->quote(0,'integer').")";
235  $res = $ilDB->query($query);
236 
237  $server_ids = array();
238  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
239  {
240  $server_ids[] = $row->server_id;
241  }
242  return $server_ids;
243  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ getBaseDN()

ilLDAPServer::getBaseDN ( )

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

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

454  {
455  return $this->base_dn;
456  }
+ Here is the caller graph for this function:

◆ getBindingType()

ilLDAPServer::getBindingType ( )

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

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

478  {
479  return $this->binding_type;
480  }
+ Here is the caller graph for this function:

◆ getBindPassword()

ilLDAPServer::getBindPassword ( )

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

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

501  {
502  return $this->bind_password;
503  }
+ Here is the caller graph for this function:

◆ getBindUser()

ilLDAPServer::getBindUser ( )

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

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

493  {
494  return $this->bind_user;
495  }
+ Here is the caller graph for this function:

◆ getDataSource()

static ilLDAPServer::getDataSource (   $a_auth_mode)
static

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

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

Referenced by ilAuthContainerCAS\handleLDAPDataSource(), and ilAuthContainerRadius\handleLDAPDataSource().

267  {
268  global $ilDB;
269 
270  $query = "SELECT server_id FROM ldap_server_settings ".
271  "WHERE authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
272  "AND authentication = ".$ilDB->quote(0,'integer');
273  $res = $ilDB->query($query);
274  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
275  {
276  return $row->server_id;
277  }
278  return 0;
279  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ getFilter()

ilLDAPServer::getFilter ( )

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

References prepareFilter().

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

525  {
526  return $this->prepareFilter($this->filter);
527  }
prepareFilter($a_filter)
Create brackets for filters if they do not exist.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroupAttribute()

ilLDAPServer::getGroupAttribute ( )

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

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

588  {
589  return $this->group_attribute;
590  }
+ Here is the caller graph for this function:

◆ getGroupDN()

ilLDAPServer::getGroupDN ( )

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

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

533  {
534  return $this->group_dn;
535  }
+ Here is the caller graph for this function:

◆ getGroupFilter()

ilLDAPServer::getGroupFilter ( )

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

References prepareFilter().

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

541  {
542  return $this->prepareFilter($this->group_filter);
543  }
prepareFilter($a_filter)
Create brackets for filters if they do not exist.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroupMember()

ilLDAPServer::getGroupMember ( )

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

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

549  {
550  return $this->group_member;
551  }
+ Here is the caller graph for this function:

◆ getGroupName()

ilLDAPServer::getGroupName ( )

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

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

557  {
558  return $this->group_name;
559  }
+ Here is the caller graph for this function:

◆ getGroupNames()

ilLDAPServer::getGroupNames ( )

Get group names as array.

public

Parameters

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

References getGroupName().

572  {
573  $names = explode(',',$this->getGroupName());
574 
575  if(!is_array($names))
576  {
577  return array();
578  }
579  foreach($names as $name)
580  {
581  $new_names[] = trim($name);
582  }
583  return $new_names;
584  }
+ Here is the call graph for this function:

◆ getGroupScope()

ilLDAPServer::getGroupScope ( )

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

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

626  {
627  return $this->group_scope;
628  }
+ Here is the caller graph for this function:

◆ getGroupUserFilter()

ilLDAPServer::getGroupUserFilter ( )

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

Referenced by create(), and update().

609  {
610  return $this->group_user_filter;
611  }
+ Here is the caller graph for this function:

◆ getInstanceByServerId()

static ilLDAPServer::getInstanceByServerId (   $a_server_id)
static

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

Referenced by ilECSCmsCourseMemberCommandQueueHandler\createMember(), ilAuthContainerCAS\handleLDAPDataSource(), ilAuthContainerRadius\handleLDAPDataSource(), ilLDAPUserSynchronisation\initServer(), and ilLDAPRoleAssignmentRule\isGroupMember().

54  {
55  if(isset(self::$instances[$a_server_id]))
56  {
57  return self::$instances[$a_server_id];
58  }
59  return self::$instances[$a_server_id] = new ilLDAPServer($a_server_id);
60  }
+ Here is the caller graph for this function:

◆ getName()

ilLDAPServer::getName ( )

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

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

438  {
439  return $this->name;
440  }
+ Here is the caller graph for this function:

◆ getPearAtributeArray()

ilLDAPServer::getPearAtributeArray ( )
private

Get attribute array for pear auth data.

private

Parameters

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

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

Referenced by toPearAuthArray().

938  {
939  if($this->enabledSyncOnLogin())
940  {
941  include_once('Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
942  include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
944  return array_merge(
945  array($this->getUserAttribute()),
946  $mapping->getFields(),
947  array('dn'),
949  );
950  }
951  else
952  {
953  return array($this->getUserAttribute());
954  }
955  }
static _getInstanceByServerId($a_server_id)
Get instance of class.
static getAttributeNames()
get all possible attribute names
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleBindDN()

ilLDAPServer::getRoleBindDN ( )

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

References $role_bind_dn.

Referenced by create(), and update().

658  {
659  return $this->role_bind_dn;
660  }
+ Here is the caller graph for this function:

◆ getRoleBindPassword()

ilLDAPServer::getRoleBindPassword ( )

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

References $role_bind_pass.

Referenced by create(), and update().

666  {
667  return $this->role_bind_pass;
668  }
+ Here is the caller graph for this function:

◆ getSearchBase()

ilLDAPServer::getSearchBase ( )

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

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

509  {
510  return $this->search_base;
511  }
+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPServer::getServerId ( )

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

References $server_id.

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

310  {
311  return $this->server_id;
312  }
+ Here is the caller graph for this function:

◆ getUrl()

ilLDAPServer::getUrl ( )

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

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

373  {
374  return $this->url;
375  }
+ Here is the caller graph for this function:

◆ getUrlString()

ilLDAPServer::getUrlString ( )

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

Referenced by create(), and update().

398  {
399  return $this->url_string;
400  }
+ Here is the caller graph for this function:

◆ getUserAttribute()

ilLDAPServer::getUserAttribute ( )

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

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

517  {
518  return $this->user_attribute;
519  }
+ Here is the caller graph for this function:

◆ getUserScope()

ilLDAPServer::getUserScope ( )

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

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

634  {
635  return $this->user_scope;
636  }
+ Here is the caller graph for this function:

◆ getVersion()

ilLDAPServer::getVersion ( )

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

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

446  {
447  return $this->version ? $this->version : self::DEFAULT_VERSION;
448  }
+ Here is the caller graph for this function:

◆ isAccountMigrationEnabled()

ilLDAPServer::isAccountMigrationEnabled ( )

enabled account migration

public

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

Referenced by create(), and update().

701  {
702  return $this->account_migration ? true : false;
703  }
+ Here is the caller graph for this function:

◆ isActive()

ilLDAPServer::isActive ( )

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

Referenced by create(), and update().

369  {
370  return $this->active;
371  }
+ Here is the caller graph for this function:

◆ isActiveReferrer()

ilLDAPServer::isActiveReferrer ( )

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

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

462  {
463  return $this->referrals ? true : false;
464  }
+ Here is the caller graph for this function:

◆ isActiveTLS()

ilLDAPServer::isActiveTLS ( )

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

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

470  {
471  return $this->tls ? true : false;
472  }
+ Here is the caller graph for this function:

◆ isAuthenticationEnabled()

ilLDAPServer::isAuthenticationEnabled ( )

Check if authentication is enabled.

Returns
bool

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

References $enabled_authentication.

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

328  {
329  return (bool) $this->enabled_authentication;
330  }
+ 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 ilDB $ilDB.

Parameters
int$a_auth_mode
Returns
bool

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

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

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

252  {
253  global $ilDB;
254 
255  $query = "SELECT server_id FROM ldap_server_settings ".
256  "WHERE authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
257  "AND authentication = ".$ilDB->quote(0,'integer');
258  $res = $ilDB->query($query);
259  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
260  {
261  return true;
262  }
263  return false;
264  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ isMembershipOptional()

ilLDAPServer::isMembershipOptional ( )

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

Referenced by create(), and update().

601  {
602  return (bool) $this->group_optional;
603  }
+ Here is the caller graph for this function:

◆ prepareFilter()

ilLDAPServer::prepareFilter (   $a_filter)
private

Create brackets for filters if they do not exist.

private

Parameters
stringfilter

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

Referenced by getFilter(), and getGroupFilter().

911  {
912  $filter = trim($a_filter);
913 
914  if(!strlen($filter))
915  {
916  return $filter;
917  }
918 
919  if(strpos($filter,'(') !== 0)
920  {
921  $filter = ('('.$filter);
922  }
923  if(substr($filter,-1) != ')')
924  {
925  $filter = ($filter.')');
926  }
927  return $filter;
928  }
+ Here is the caller graph for this function:

◆ read()

ilLDAPServer::read ( )
private

Read server settings.

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

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(), setUserScope(), setVersion(), toggleActive(), toggleMembershipOptional(), toggleReferrer(), and toggleTLS().

Referenced by __construct().

964  {
965  if(!$this->server_id)
966  {
967  return true;
968  }
969  $query = "SELECT * FROM ldap_server_settings WHERE server_id = ".$this->db->quote($this->server_id)."";
970 
971  $res = $this->db->query($query);
972  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
973  {
974  $this->toggleActive($row->active);
975  $this->setName($row->name);
976  $this->setUrl($row->url);
977  $this->setVersion($row->version);
978  $this->setBaseDN($row->base_dn);
979  $this->toggleReferrer($row->referrals);
980  $this->toggleTLS($row->tls);
981  $this->setBindingType($row->bind_type);
982  $this->setBindUser($row->bind_user);
983  $this->setBindPassword($row->bind_pass);
984  $this->setSearchBase($row->search_base);
985  $this->setUserScope($row->user_scope);
986  $this->setUserAttribute($row->user_attribute);
987  $this->setFilter($row->filter);
988  $this->setGroupDN($row->group_dn);
989  $this->setGroupScope($row->group_scope);
990  $this->setGroupFilter($row->group_filter);
991  $this->setGroupMember($row->group_member);
992  $this->setGroupAttribute($row->group_attribute);
993  $this->toggleMembershipOptional($row->group_optional);
994  $this->setGroupUserFilter($row->group_user_filter);
995  $this->enableGroupMemberIsDN($row->group_memberisdn);
996  $this->setGroupName($row->group_name);
997  $this->enableSyncOnLogin($row->sync_on_login);
998  $this->enableSyncPerCron($row->sync_per_cron);
999  $this->enableRoleSynchronization($row->role_sync_active);
1000  $this->setRoleBindDN($row->role_bind_dn);
1001  $this->setRoleBindPassword($row->role_bind_pass);
1002  $this->enableAccountMigration($row->migration);
1003  $this->enableAuthentication($row->authentication);
1004  $this->setAuthenticationMapping($row->authentication_type);
1005  }
1006  }
setVersion($a_version)
enableSyncOnLogin($a_value)
setGroupScope($a_value)
toggleTLS($a_status)
setAuthenticationMapping($a_map)
Set mapped authentication mapping.
enableGroupMemberIsDN($a_value)
enableAccountMigration($a_status)
Enable account migration.
enableRoleSynchronization($a_value)
setGroupFilter($a_value)
enableSyncPerCron($a_value)
toggleReferrer($a_status)
toggleMembershipOptional($a_status)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
toggleActive($a_status)
setRoleBindPassword($a_value)
setUserScope($a_value)
setGroupUserFilter($a_filter)
setBaseDN($a_base_dn)
setGroupMember($a_value)
setRoleBindDN($a_value)
setBindPassword($a_password)
setSearchBase($a_search_base)
setGroupName($a_value)
enableAuthentication($a_status)
Enable authentication for this ldap server.
setUserAttribute($a_user_attr)
setFilter($a_filter)
setGroupAttribute($a_value)
+ 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 66 of file class.ilLDAPServer.php.

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

Referenced by doConnectionCheck().

67  {
68  global $ilDB;
69 
70  if(!$this->fallback_urls)
71  {
72  return FALSE;
73  }
74 
75  $all_urls = array_merge($this->fallback_urls);
76  $all_urls[] = $this->getUrl();
77 
78  $query = 'UPDATE ldap_server_settings SET '.
79  'url = '.$ilDB->quote(implode(',', $all_urls),'text').' '.
80  'WHERE server_id = '.$ilDB->quote($this->getServerId(),'integer');
81  $ilDB->manipulate($query);
82  return TRUE;
83  }
+ 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 336 of file class.ilLDAPServer.php.

Referenced by read().

337  {
338  $this->authentication_mapping = $a_map;
339  }
+ Here is the caller graph for this function:

◆ setBaseDN()

ilLDAPServer::setBaseDN (   $a_base_dn)

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

Referenced by read().

458  {
459  $this->base_dn = $a_base_dn;
460  }
+ Here is the caller graph for this function:

◆ setBindingType()

ilLDAPServer::setBindingType (   $a_type)

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

References IL_LDAP_BIND_ANONYMOUS, and IL_LDAP_BIND_USER.

Referenced by read().

482  {
483  if($a_type == IL_LDAP_BIND_USER)
484  {
485  $this->binding_type = IL_LDAP_BIND_USER;
486  }
487  else
488  {
489  $this->binding_type = IL_LDAP_BIND_ANONYMOUS;
490  }
491  }
const IL_LDAP_BIND_USER
const IL_LDAP_BIND_ANONYMOUS
+ Here is the caller graph for this function:

◆ setBindPassword()

ilLDAPServer::setBindPassword (   $a_password)

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

Referenced by read().

505  {
506  $this->bind_password = $a_password;
507  }
+ Here is the caller graph for this function:

◆ setBindUser()

ilLDAPServer::setBindUser (   $a_user)

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

Referenced by read().

497  {
498  $this->bind_user = $a_user;
499  }
+ Here is the caller graph for this function:

◆ setFilter()

ilLDAPServer::setFilter (   $a_filter)

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

Referenced by read().

529  {
530  $this->filter = $a_filter;
531  }
+ Here is the caller graph for this function:

◆ setGlobalRole()

ilLDAPServer::setGlobalRole (   $a_role)

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

654  {
655  $this->global_role = $a_role;
656  }

◆ setGroupAttribute()

ilLDAPServer::setGroupAttribute (   $a_value)

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

Referenced by read().

592  {
593  $this->group_attribute = $a_value;
594  }
+ Here is the caller graph for this function:

◆ setGroupDN()

ilLDAPServer::setGroupDN (   $a_value)

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

Referenced by read().

537  {
538  $this->group_dn = $a_value;
539  }
+ Here is the caller graph for this function:

◆ setGroupFilter()

ilLDAPServer::setGroupFilter (   $a_value)

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

Referenced by read().

545  {
546  $this->group_filter = $a_value;
547  }
+ Here is the caller graph for this function:

◆ setGroupMember()

ilLDAPServer::setGroupMember (   $a_value)

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

Referenced by read().

553  {
554  $this->group_member = $a_value;
555  }
+ Here is the caller graph for this function:

◆ setGroupName()

ilLDAPServer::setGroupName (   $a_value)

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

Referenced by read().

561  {
562  $this->group_name = $a_value;
563  }
+ Here is the caller graph for this function:

◆ setGroupScope()

ilLDAPServer::setGroupScope (   $a_value)

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

Referenced by read().

622  {
623  $this->group_scope = $a_value;
624  }
+ Here is the caller graph for this function:

◆ setGroupUserFilter()

ilLDAPServer::setGroupUserFilter (   $a_filter)

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

Referenced by read().

605  {
606  $this->group_user_filter = $a_filter;
607  }
+ Here is the caller graph for this function:

◆ setName()

ilLDAPServer::setName (   $a_name)

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

Referenced by read().

442  {
443  $this->name = $a_name;
444  }
+ Here is the caller graph for this function:

◆ setRoleBindDN()

ilLDAPServer::setRoleBindDN (   $a_value)

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

Referenced by read().

662  {
663  $this->role_bind_dn = $a_value;
664  }
+ Here is the caller graph for this function:

◆ setRoleBindPassword()

ilLDAPServer::setRoleBindPassword (   $a_value)

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

Referenced by read().

670  {
671  $this->role_bind_pass = $a_value;
672  }
+ Here is the caller graph for this function:

◆ setSearchBase()

ilLDAPServer::setSearchBase (   $a_search_base)

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

Referenced by read().

513  {
514  $this->search_base = $a_search_base;
515  }
+ Here is the caller graph for this function:

◆ setUrl()

ilLDAPServer::setUrl (   $a_url)

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

Referenced by read().

377  {
378  $this->url_string = $a_url;
379 
380  // Maybe there are more than one url's (comma seperated).
381  $urls = explode(',',$a_url);
382 
383  $counter = 0;
384  foreach($urls as $url)
385  {
386  $url = trim($url);
387  if(!$counter++)
388  {
389  $this->url = $url;
390  }
391  else
392  {
393  $this->fallback_urls[] = $url;
394  }
395  }
396  }
+ Here is the caller graph for this function:

◆ setUserAttribute()

ilLDAPServer::setUserAttribute (   $a_user_attr)

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

Referenced by read().

521  {
522  $this->user_attribute = $a_user_attr;
523  }
+ Here is the caller graph for this function:

◆ setUserScope()

ilLDAPServer::setUserScope (   $a_value)

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

Referenced by read().

630  {
631  $this->user_scope = $a_value;
632  }
+ Here is the caller graph for this function:

◆ setVersion()

ilLDAPServer::setVersion (   $a_version)

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

Referenced by read().

450  {
451  $this->version = $a_version;
452  }
+ Here is the caller graph for this function:

◆ toggleActive()

ilLDAPServer::toggleActive (   $a_status)

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

Referenced by read().

365  {
366  $this->active = $a_status;
367  }
+ Here is the caller graph for this function:

◆ toggleDataSource()

static ilLDAPServer::toggleDataSource (   $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 287 of file class.ilLDAPServer.php.

References $query.

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

288  {
289  global $ilDB;
290 
291  if($a_status)
292  {
293  $query = "UPDATE ldap_server_settings ".
294  "SET authentication_type = ".$ilDB->quote($a_auth_mode,'integer')." ".
295  "WHERE authentication = ".$ilDB->quote(0,'integer');
296  $ilDB->query($query);
297  }
298  else
299  {
300  $query = "UPDATE ldap_server_settings ".
301  "SET authentication_type = ".$ilDB->quote(0,'integer')." ".
302  "WHERE authentication = ".$ilDB->quote(0,'integer');
303  $ilDB->query($query);
304  }
305  return true;
306  }
+ Here is the caller graph for this function:

◆ toggleMembershipOptional()

ilLDAPServer::toggleMembershipOptional (   $a_status)

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

Referenced by read().

597  {
598  $this->group_optional = (bool) $a_status;
599  }
+ Here is the caller graph for this function:

◆ toggleReferrer()

ilLDAPServer::toggleReferrer (   $a_status)

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

Referenced by read().

466  {
467  $this->referrals = $a_status;
468  }
+ Here is the caller graph for this function:

◆ toggleTLS()

ilLDAPServer::toggleTLS (   $a_status)

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

Referenced by read().

474  {
475  $this->tls = $a_status;
476  }
+ 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 843 of file class.ilLDAPServer.php.

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

844  {
845  $options = array(
846  'url' => $this->getUrl(),
847  'version' => (int) $this->getVersion(),
848  'referrals' => (bool) $this->isActiveReferrer());
849 
850  if($this->getBindingType() == IL_LDAP_BIND_USER)
851  {
852  $options['binddn'] = $this->getBindUser();
853  $options['bindpw'] = $this->getBindPassword();
854  }
855  $options['basedn'] = $this->getBaseDN();
856  $options['start_tls'] = (bool) $this->isActiveTLS();
857  $options['userdn'] = $this->getSearchBase();
858  switch($this->getUserScope())
859  {
860  case IL_LDAP_SCOPE_ONE:
861  $options['userscope'] = 'one';
862  break;
863  default:
864  $options['userscope'] = 'sub';
865  break;
866  }
867 
868  $options['userattr'] = $this->getUserAttribute();
869  $options['userfilter'] = $this->getFilter();
870  $options['attributes'] = $this->getPearAtributeArray();
871  $options['debug'] = self::DEBUG;
872 
873  if(@include_once('Log.php'))
874  {
875  if(@include_once('Log/observer.php'))
876  {
877  $options['enableLogging'] = true;
878  }
879  }
880  switch($this->getGroupScope())
881  {
882  case IL_LDAP_SCOPE_BASE:
883  $options['groupscope'] = 'base';
884  break;
885  case IL_LDAP_SCOPE_ONE:
886  $options['groupscope'] = 'one';
887  break;
888  default:
889  $options['groupscope'] = 'sub';
890  break;
891  }
892  $options['groupdn'] = $this->getGroupDN();
893  $options['groupattr'] = $this->getGroupAttribute();
894  $options['groupfilter'] = $this->getGroupFilter();
895  $options['memberattr'] = $this->getGroupMember();
896  $options['memberisdn'] = $this->enabledGroupMemberIsDN();
897  $options['group'] = $this->getGroupName();
898 
899 
900  return $options;
901  }
const IL_LDAP_BIND_USER
getPearAtributeArray()
Get attribute array for pear auth data.
const DEBUG
if(!is_array($argv)) $options
const IL_LDAP_SCOPE_ONE
const IL_LDAP_SCOPE_BASE
+ Here is the call graph for this function:

◆ update()

ilLDAPServer::update ( )

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

References $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(), getUserScope(), getVersion(), isAccountMigrationEnabled(), isActive(), isActiveReferrer(), isActiveTLS(), isAuthenticationEnabled(), and isMembershipOptional().

797  {
798  global $ilDB;
799 
800  $query = "UPDATE ldap_server_settings SET ".
801  "active = ".$this->db->quote($this->isActive(),'integer').", ".
802  "name = ".$this->db->quote($this->getName(),'text').", ".
803  "url = ".$this->db->quote($this->getUrlString(),'text').", ".
804  "version = ".$this->db->quote($this->getVersion(),'integer').", ".
805  "base_dn = ".$this->db->quote($this->getBaseDN(),'text').", ".
806  "referrals = ".$this->db->quote($this->isActiveReferrer(),'integer').", ".
807  "tls = ".$this->db->quote($this->isActiveTLS(),'integer').", ".
808  "bind_type = ".$this->db->quote($this->getBindingType(),'integer').", ".
809  "bind_user = ".$this->db->quote($this->getBindUser(),'text').", ".
810  "bind_pass = ".$this->db->quote($this->getBindPassword(),'text').", ".
811  "search_base = ".$this->db->quote($this->getSearchBase(),'text').", ".
812  "user_scope = ".$this->db->quote($this->getUserScope(),'integer').", ".
813  "user_attribute = ".$this->db->quote($this->getUserAttribute(),'text').", ".
814  "filter = ".$this->db->quote($this->getFilter(),'text').", ".
815  "group_dn = ".$this->db->quote($this->getGroupDN(),'text').", ".
816  "group_scope = ".$this->db->quote($this->getGroupScope(),'integer').", ".
817  "group_filter = ".$this->db->quote($this->getGroupFilter(),'text').", ".
818  "group_member = ".$this->db->quote($this->getGroupMember(),'text').", ".
819  "group_memberisdn =".$this->db->quote((int) $this->enabledGroupMemberIsDN(),'integer').", ".
820  "group_name = ".$this->db->quote($this->getGroupName(),'text').", ".
821  "group_attribute = ".$this->db->quote($this->getGroupAttribute(),'text').", ".
822  "group_optional = ".$this->db->quote((int) $this->isMembershipOptional(),'integer').", ".
823  "group_user_filter = ".$this->db->quote($this->getGroupUserFilter(),'text').", ".
824  "sync_on_login = ".$this->db->quote(($this->enabledSyncOnLogin() ? 1 : 0),'integer').", ".
825  "sync_per_cron = ".$this->db->quote(($this->enabledSyncPerCron() ? 1 : 0),'integer').", ".
826  "role_sync_active = ".$this->db->quote($this->enabledRoleSynchronization(),'integer').", ".
827  "role_bind_dn = ".$this->db->quote($this->getRoleBindDN(),'text').", ".
828  "role_bind_pass = ".$this->db->quote($this->getRoleBindPassword(),'text').", ".
829  "migration = ".$this->db->quote((int)$this->isAccountMigrationEnabled(),'integer').", ".
830  'authentication = '.$this->db->quote((int) $this->isAuthenticationEnabled(),'integer').', '.
831  'authentication_type = '.$this->db->quote((int) $this->getAuthenticationMapping(),'integer').' '.
832  "WHERE server_id = ".$this->db->quote($this->getServerId(),'integer');
833 
834  $res = $ilDB->manipulate($query);
835  return true;
836  }
getAuthenticationMapping()
Get authentication mode that is mapped.
isAuthenticationEnabled()
Check if authentication is enabled.
isAccountMigrationEnabled()
enabled account migration
+ Here is the call graph for this function:

◆ validate()

ilLDAPServer::validate ( )

Validate user input.

Parameters

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

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

712  {
713  global $ilErr;
714 
715  $ilErr->setMessage('');
716  if(!strlen($this->getName()) ||
717  !strlen($this->getUrl()) ||
718  !strlen($this->getBaseDN()) ||
719  !strlen($this->getUserAttribute()))
720  {
721  $ilErr->setMessage($this->lng->txt('fill_out_all_required_fields'));
722  }
723 
724  if($this->getBindingType() == IL_LDAP_BIND_USER
725  && (!strlen($this->getBindUser()) || !strlen($this->getBindPassword())))
726  {
727  $ilErr->appendMessage($this->lng->txt('ldap_missing_bind_user'));
728  }
729 
730  if(($this->enabledSyncPerCron() or $this->enabledSyncOnLogin()) and !$this->global_role)
731  {
732  $ilErr->appendMessage($this->lng->txt('ldap_missing_role_assignment'));
733  }
734  if($this->getVersion() == 2 and $this->isActiveTLS())
735  {
736  $ilErr->appendMessage($this->lng->txt('ldap_tls_conflict'));
737  }
738 
739  return strlen($ilErr->getMessage()) ? false : true;
740  }
const IL_LDAP_BIND_USER
+ 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.

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


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