ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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 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$

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 $ilDB, $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:17
global $ilDB
+ 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.

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

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

Referenced by ilLDAPServerTableGUI\importData().

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  }
Create styles array
The data for the language used.
$server
global $ilDB
+ 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.

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

Referenced by ilLDAPCronSynchronization\run().

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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.

References _getActiveServerList().

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

186  {
188  if(count($servers))
189  {
190  return $servers[0];
191  }
192  return 0;
193  }
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 262 of file class.ilLDAPServer.php.

References _getServerList().

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.
+ Here is the call 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 174 of file class.ilLDAPServer.php.

References _getActiveServerList().

175  {
177  }
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 150 of file class.ilLDAPServer.php.

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

Referenced by ilLDAPRoleGroupMapping\initServers().

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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.

Referenced by ilLDAPSettingsGUI\serverList().

96  {
97  return function_exists('ldap_bind');
98  }
+ Here is the caller graph for this function:

◆ create()

ilLDAPServer::create ( )

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

References $ilDB, $query, $res, array, 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().

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

◆ delete()

ilLDAPServer::delete ( )

delete

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

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

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

References $ilDB, and $query.

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

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  }
global $ilDB
+ 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.

public

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

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

Referenced by ilAuthContainerApache\forceCreation().

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);
543  $query->bind(IL_LDAP_BIND_TEST);
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  }
$url
Definition: shib_logout.php:72
const IL_LDAP_BIND_TEST
Create styles array
The data for the language used.
rotateFallbacks()
Rotate fallback urls in case of connect timeouts.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableAccountMigration()

ilLDAPServer::enableAccountMigration (   $a_status)

Enable account migration.

public

Parameters
boolstatus

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

Referenced by read().

824  {
825  $this->account_migration = $a_status;
826  }
+ 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.

Referenced by read().

439  {
440  $this->enabled_authentication = (bool) $a_status;
441  }
+ Here is the caller graph for this function:

◆ enabledGroupMemberIsDN()

ilLDAPServer::enabledGroupMemberIsDN ( )

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

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

739  {
740  return (bool) $this->memberisdn;
741  }
+ Here is the caller graph for this function:

◆ enabledRoleSynchronization()

ilLDAPServer::enabledRoleSynchronization ( )

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

References $role_sync_active.

Referenced by create(), and update().

799  {
801  }
+ Here is the caller graph for this function:

◆ enabledSyncOnLogin()

ilLDAPServer::enabledSyncOnLogin ( )

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

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

763  {
764  return $this->sync_on_login;
765  }
+ Here is the caller graph for this function:

◆ enabledSyncPerCron()

ilLDAPServer::enabledSyncPerCron ( )

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

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

771  {
772  return $this->sync_per_cron;
773  }
+ Here is the caller graph for this function:

◆ enableGroupMemberIsDN()

ilLDAPServer::enableGroupMemberIsDN (   $a_value)

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

Referenced by read().

743  {
744  $this->memberisdn = (bool) $a_value;
745  }
+ Here is the caller graph for this function:

◆ enableRoleSynchronization()

ilLDAPServer::enableRoleSynchronization (   $a_value)

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

Referenced by read().

803  {
804  $this->role_sync_active = $a_value;
805  }
+ Here is the caller graph for this function:

◆ enableSyncOnLogin()

ilLDAPServer::enableSyncOnLogin (   $a_value)

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

Referenced by read().

767  {
768  $this->sync_on_login = (int) $a_value;
769  }
+ Here is the caller graph for this function:

◆ enableSyncPerCron()

ilLDAPServer::enableSyncPerCron (   $a_value)

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

Referenced by read().

775  {
776  $this->sync_per_cron = (int) $a_value;
777  }
+ 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.

References $authentication_mapping.

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

466  {
468  }
+ 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.

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

Referenced by ilLDAPCronSynchronization\deactivateUsers().

476  {
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)
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:

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

References array.

Referenced by ilAuthUtils\_getAuthModeName().

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  }
Create styles array
The data for the language used.
+ 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.

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

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

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(ilDBConstants::FETCHMODE_OBJECT))
287  {
288  $server_ids[] = $row->server_id;
289  }
290  return $server_ids;
291  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getBaseDN()

ilLDAPServer::getBaseDN ( )

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

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

575  {
576  return $this->base_dn;
577  }
+ Here is the caller graph for this function:

◆ getBindingType()

ilLDAPServer::getBindingType ( )

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

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

599  {
600  return $this->binding_type;
601  }
+ Here is the caller graph for this function:

◆ getBindPassword()

ilLDAPServer::getBindPassword ( )

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

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

622  {
623  return $this->bind_password;
624  }
+ Here is the caller graph for this function:

◆ getBindUser()

ilLDAPServer::getBindUser ( )

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

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

614  {
615  return $this->bind_user;
616  }
+ 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.

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

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

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(ilDBConstants::FETCHMODE_OBJECT))
322  {
323  return $row->server_id;
324  }
325  return 0;
326  }
global $ilDB
+ Here is the caller graph for this function:

◆ getFilter()

ilLDAPServer::getFilter ( )

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

References prepareFilter().

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

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

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

713  {
714  return $this->group_attribute;
715  }
+ Here is the caller graph for this function:

◆ getGroupDN()

ilLDAPServer::getGroupDN ( )

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

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

654  {
655  return $this->group_dn;
656  }
+ Here is the caller graph for this function:

◆ getGroupFilter()

ilLDAPServer::getGroupFilter ( )

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

References prepareFilter().

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

662  {
663  return $this->prepareFilter($this->group_filter);
664  }
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 669 of file class.ilLDAPServer.php.

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

670  {
671  return $this->group_member;
672  }
+ Here is the caller graph for this function:

◆ getGroupName()

ilLDAPServer::getGroupName ( )

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

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

678  {
679  return $this->group_name;
680  }
+ Here is the caller graph for this function:

◆ getGroupNames()

ilLDAPServer::getGroupNames ( )

Get group names as array.

public

Parameters

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

References $names, array, and getGroupName().

693  {
694  $names = explode(',',$this->getGroupName());
695 
696  if(!is_array($names))
697  {
698  return array();
699  }
700  foreach($names as $name)
701  {
702  $name = trim($name);
703  if(strlen($name))
704  {
705  $new_names[] = trim($name);
706  }
707  }
708  return $new_names;
709  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getGroupScope()

ilLDAPServer::getGroupScope ( )

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

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

751  {
752  return $this->group_scope;
753  }
+ Here is the caller graph for this function:

◆ getGroupUserFilter()

ilLDAPServer::getGroupUserFilter ( )

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

Referenced by create(), and update().

734  {
735  return $this->group_user_filter;
736  }
+ Here is the caller graph for this function:

◆ getInstanceByServerId()

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

References array, and AUTH_LDAP.

Referenced by ilAuthUtils\_getAuthMode().

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
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getName()

ilLDAPServer::getName ( )

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

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

559  {
560  return $this->name;
561  }
+ Here is the caller graph for this function:

◆ getPearAtributeArray()

ilLDAPServer::getPearAtributeArray ( )
private

Get attribute array for pear auth data.

private

Parameters

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

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

Referenced by toPearAuthArray().

1107  {
1108  if($this->enabledSyncOnLogin())
1109  {
1110  include_once('Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
1111  include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
1113  return array_merge(
1114  array($this->getUserAttribute()),
1115  $mapping->getFields(),
1116  array('dn'),
1118  );
1119  }
1120  else
1121  {
1122  return array($this->getUserAttribute());
1123  }
1124  }
static _getInstanceByServerId($a_server_id)
Get instance of class.
static getAttributeNames($a_server_id)
get all possible attribute names
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleBindDN()

ilLDAPServer::getRoleBindDN ( )

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

References $role_bind_dn.

Referenced by create(), and update().

783  {
784  return $this->role_bind_dn;
785  }
+ Here is the caller graph for this function:

◆ getRoleBindPassword()

ilLDAPServer::getRoleBindPassword ( )

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

References $role_bind_pass.

Referenced by create(), and update().

791  {
792  return $this->role_bind_pass;
793  }
+ Here is the caller graph for this function:

◆ getSearchBase()

ilLDAPServer::getSearchBase ( )

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

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

630  {
631  return $this->search_base;
632  }
+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPServer::getServerId ( )

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

References $server_id.

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

430  {
431  return $this->server_id;
432  }
+ 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.

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

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  }
+ Here is the caller graph for this function:

◆ getServerIds()

static ilLDAPServer::getServerIds ( )
static

Get all server ids ilDB $ilDB.

Returns
array int

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

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

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

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(ilDBConstants::FETCHMODE_OBJECT))
230  {
231  $server[] = $row->server_id;
232  }
233  return $server;
234  }
Create styles array
The data for the language used.
$server
global $ilDB
+ Here is the caller graph for this function:

◆ getUrl()

ilLDAPServer::getUrl ( )

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

References $url.

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

496  {
497  return $this->url;
498  }
$url
Definition: shib_logout.php:72
+ Here is the caller graph for this function:

◆ getUrlString()

ilLDAPServer::getUrlString ( )

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

Referenced by create(), and update().

521  {
522  return $this->url_string;
523  }
+ Here is the caller graph for this function:

◆ getUserAttribute()

ilLDAPServer::getUserAttribute ( )

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

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

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

◆ getUsernameFilter()

ilLDAPServer::getUsernameFilter ( )

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

Referenced by create(), and update().

808  {
809  return $this->username_filter;
810  }
+ Here is the caller graph for this function:

◆ getUserScope()

ilLDAPServer::getUserScope ( )

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

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

759  {
760  return $this->user_scope;
761  }
+ Here is the caller graph for this function:

◆ getVersion()

ilLDAPServer::getVersion ( )

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

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

567  {
568  return $this->version ? $this->version : self::DEFAULT_VERSION;
569  }
+ Here is the caller graph for this function:

◆ isAccountMigrationEnabled()

ilLDAPServer::isAccountMigrationEnabled ( )

enabled account migration

public

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

Referenced by create(), and update().

835  {
836  return $this->account_migration ? true : false;
837  }
+ Here is the caller graph for this function:

◆ isActive()

ilLDAPServer::isActive ( )

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

Referenced by create(), and update().

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

◆ isActiveReferrer()

ilLDAPServer::isActiveReferrer ( )

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

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

583  {
584  return $this->referrals ? true : false;
585  }
+ Here is the caller graph for this function:

◆ isActiveTLS()

ilLDAPServer::isActiveTLS ( )

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

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

591  {
592  return $this->tls ? true : false;
593  }
+ 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.

References $enabled_authentication.

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

448  {
449  return (bool) $this->enabled_authentication;
450  }
+ 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.

References $GLOBALS, and AUTH_LDAP.

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

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  }
const AUTH_LDAP
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ 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 299 of file class.ilLDAPServer.php.

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

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

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(ilDBConstants::FETCHMODE_OBJECT))
308  {
309  return true;
310  }
311  return false;
312  }
global $ilDB
+ Here is the caller graph for this function:

◆ isMembershipOptional()

ilLDAPServer::isMembershipOptional ( )

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

Referenced by create(), and update().

726  {
727  return (bool) $this->group_optional;
728  }
+ 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 1079 of file class.ilLDAPServer.php.

Referenced by getFilter(), and getGroupFilter().

1080  {
1081  $filter = trim($a_filter);
1082 
1083  if(!strlen($filter))
1084  {
1085  return $filter;
1086  }
1087 
1088  if(strpos($filter,'(') !== 0)
1089  {
1090  $filter = ('('.$filter);
1091  }
1092  if(substr($filter,-1) != ')')
1093  {
1094  $filter = ($filter.')');
1095  }
1096  return $filter;
1097  }
+ Here is the caller graph for this function:

◆ read()

ilLDAPServer::read ( )
private

Read server settings.

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

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

Referenced by __construct().

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

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

Referenced by doConnectionCheck().

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  }
global $ilDB
+ 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.

Referenced by read().

457  {
458  $this->authentication_mapping = $a_map;
459  }
+ Here is the caller graph for this function:

◆ setBaseDN()

ilLDAPServer::setBaseDN (   $a_base_dn)

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

Referenced by read().

579  {
580  $this->base_dn = $a_base_dn;
581  }
+ Here is the caller graph for this function:

◆ setBindingType()

ilLDAPServer::setBindingType (   $a_type)

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

References $a_type, IL_LDAP_BIND_ANONYMOUS, and IL_LDAP_BIND_USER.

Referenced by read().

603  {
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
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ setBindPassword()

ilLDAPServer::setBindPassword (   $a_password)

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

Referenced by read().

626  {
627  $this->bind_password = $a_password;
628  }
+ Here is the caller graph for this function:

◆ setBindUser()

ilLDAPServer::setBindUser (   $a_user)

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

Referenced by read().

618  {
619  $this->bind_user = $a_user;
620  }
+ Here is the caller graph for this function:

◆ setFilter()

ilLDAPServer::setFilter (   $a_filter)

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

Referenced by read().

650  {
651  $this->filter = $a_filter;
652  }
+ Here is the caller graph for this function:

◆ setGlobalRole()

ilLDAPServer::setGlobalRole (   $a_role)

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

779  {
780  $this->global_role = $a_role;
781  }

◆ setGroupAttribute()

ilLDAPServer::setGroupAttribute (   $a_value)

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

Referenced by read().

717  {
718  $this->group_attribute = $a_value;
719  }
+ Here is the caller graph for this function:

◆ setGroupDN()

ilLDAPServer::setGroupDN (   $a_value)

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

Referenced by read().

658  {
659  $this->group_dn = $a_value;
660  }
+ Here is the caller graph for this function:

◆ setGroupFilter()

ilLDAPServer::setGroupFilter (   $a_value)

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

Referenced by read().

666  {
667  $this->group_filter = $a_value;
668  }
+ Here is the caller graph for this function:

◆ setGroupMember()

ilLDAPServer::setGroupMember (   $a_value)

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

Referenced by read().

674  {
675  $this->group_member = $a_value;
676  }
+ Here is the caller graph for this function:

◆ setGroupName()

ilLDAPServer::setGroupName (   $a_value)

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

Referenced by read().

682  {
683  $this->group_name = $a_value;
684  }
+ Here is the caller graph for this function:

◆ setGroupScope()

ilLDAPServer::setGroupScope (   $a_value)

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

Referenced by read().

747  {
748  $this->group_scope = $a_value;
749  }
+ Here is the caller graph for this function:

◆ setGroupUserFilter()

ilLDAPServer::setGroupUserFilter (   $a_filter)

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

Referenced by read().

730  {
731  $this->group_user_filter = $a_filter;
732  }
+ Here is the caller graph for this function:

◆ setName()

ilLDAPServer::setName (   $a_name)

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

Referenced by read().

563  {
564  $this->name = $a_name;
565  }
+ Here is the caller graph for this function:

◆ setRoleBindDN()

ilLDAPServer::setRoleBindDN (   $a_value)

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

Referenced by read().

787  {
788  $this->role_bind_dn = $a_value;
789  }
+ Here is the caller graph for this function:

◆ setRoleBindPassword()

ilLDAPServer::setRoleBindPassword (   $a_value)

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

Referenced by read().

795  {
796  $this->role_bind_pass = $a_value;
797  }
+ Here is the caller graph for this function:

◆ setSearchBase()

ilLDAPServer::setSearchBase (   $a_search_base)

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

Referenced by read().

634  {
635  $this->search_base = $a_search_base;
636  }
+ Here is the caller graph for this function:

◆ setUrl()

ilLDAPServer::setUrl (   $a_url)

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

References $counter, and $url.

Referenced by read().

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  }
$url
Definition: shib_logout.php:72
$counter
+ Here is the caller graph for this function:

◆ setUserAttribute()

ilLDAPServer::setUserAttribute (   $a_user_attr)

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

Referenced by read().

642  {
643  $this->user_attribute = $a_user_attr;
644  }
+ Here is the caller graph for this function:

◆ setUsernameFilter()

ilLDAPServer::setUsernameFilter (   $a_value)

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

Referenced by read().

812  {
813  $this->username_filter = $a_value;
814  }// end Patch Name Filter
+ Here is the caller graph for this function:

◆ setUserScope()

ilLDAPServer::setUserScope (   $a_value)

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

Referenced by read().

755  {
756  $this->user_scope = $a_value;
757  }
+ Here is the caller graph for this function:

◆ setVersion()

ilLDAPServer::setVersion (   $a_version)

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

Referenced by read().

571  {
572  $this->version = $a_version;
573  }
+ Here is the caller graph for this function:

◆ toggleActive()

ilLDAPServer::toggleActive (   $a_status)

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

Referenced by read().

488  {
489  $this->active = $a_status;
490  }
+ 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.

References $ilDB, and $query.

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

351  {
352  global $ilDB;
353 
354  self::disableDataSourceForAuthMode($a_auth_mode);
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  }
global $ilDB
+ Here is the caller graph for this function:

◆ toggleMembershipOptional()

ilLDAPServer::toggleMembershipOptional (   $a_status)

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

Referenced by read().

722  {
723  $this->group_optional = (bool) $a_status;
724  }
+ Here is the caller graph for this function:

◆ toggleReferrer()

ilLDAPServer::toggleReferrer (   $a_status)

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

Referenced by read().

587  {
588  $this->referrals = $a_status;
589  }
+ Here is the caller graph for this function:

◆ toggleTLS()

ilLDAPServer::toggleTLS (   $a_status)

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

Referenced by read().

595  {
596  $this->tls = $a_status;
597  }
+ 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 1012 of file class.ilLDAPServer.php.

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

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

◆ update()

ilLDAPServer::update ( )

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

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

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

◆ validate()

ilLDAPServer::validate ( )

Validate user input.

Parameters

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

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

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

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

Referenced by ilLDAPQuery\bind().

◆ DEFAULT_VERSION

const ilLDAPServer::DEFAULT_VERSION = 3

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


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