ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLDAPServer Class Reference
+ Collaboration diagram for ilLDAPServer:

Public Member Functions

 __construct (int $a_server_id=0)
 
 rotateFallbacks ()
 Rotate fallback urls in case of connect timeouts. More...
 
 getServerId ()
 
 enableAuthentication (bool $a_status)
 Enable authentication for this ldap server. More...
 
 isAuthenticationEnabled ()
 Check if authentication is enabled. More...
 
 setAuthenticationMapping (int $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 (bool $a_status)
 
 isActive ()
 
 getUrl ()
 
 setUrl (string $a_url)
 
 getUrlString ()
 
 doConnectionCheck ()
 Check ldap connection and do a fallback to the next server if no connection is possible. More...
 
 getName ()
 
 setName (string $a_name)
 
 getVersion ()
 
 setVersion (int $a_version)
 
 getBaseDN ()
 
 setBaseDN (string $a_base_dn)
 
 isActiveReferrer ()
 
 toggleReferrer (bool $a_status)
 
 isActiveTLS ()
 
 toggleTLS (bool $a_status)
 
 getBindingType ()
 
 setBindingType (int $a_type)
 
 getBindUser ()
 
 setBindUser (string $a_user)
 
 getBindPassword ()
 
 setBindPassword (string $a_password)
 
 getSearchBase ()
 
 setSearchBase (string $a_search_base)
 
 getUserAttribute ()
 
 setUserAttribute (string $a_user_attr)
 
 getFilter ()
 
 setFilter (string $a_filter)
 
 getGroupDN ()
 
 setGroupDN (string $a_value)
 
 getGroupFilter ()
 
 setGroupFilter (string $a_value)
 
 getGroupMember ()
 
 setGroupMember (string $a_value)
 
 getGroupName ()
 
 setGroupName (string $a_value)
 
 getGroupNames ()
 Get group names as array. More...
 
 getGroupAttribute ()
 
 setGroupAttribute (string $a_value)
 
 toggleMembershipOptional (bool $a_status)
 
 isMembershipOptional ()
 
 setGroupUserFilter (string $a_filter)
 
 getGroupUserFilter ()
 
 enabledGroupMemberIsDN ()
 
 enableGroupMemberIsDN (bool $a_value)
 
 setGroupScope (int $a_value)
 
 getGroupScope ()
 
 setUserScope (int $a_value)
 
 getUserScope ()
 
 enabledSyncOnLogin ()
 
 enableSyncOnLogin (bool $a_value)
 
 enabledSyncPerCron ()
 
 enableSyncPerCron (bool $a_value)
 
 setGlobalRole (int $a_role)
 
 getRoleBindDN ()
 
 setRoleBindDN (string $a_value)
 
 getRoleBindPassword ()
 
 setRoleBindPassword (string $a_value)
 
 enabledRoleSynchronization ()
 
 enableRoleSynchronization (bool $a_value)
 
 getUsernameFilter ()
 
 setUsernameFilter (string $a_value)
 
 enableEscapeDN (bool $a_value)
 
 enabledEscapeDN ()
 
 enableAccountMigration (bool $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 (int $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 _getFirstActiveServer ()
 Get first active server. More...
 
static _getServerList ()
 Get list of all configured servers. More...
 
static getServerIds ()
 Get all server ids. More...
 
static _getAllServer ()
 Get list of all configured servers. More...
 
static getAvailableDataSources (int $a_auth_mode)
 
static isDataSourceActive (int $a_auth_mode)
 Check if a data source is active for a specific auth mode. More...
 
static getDataSource (int $a_auth_mode)
 
static disableDataSourceForAuthMode (int $a_authmode)
 Disable data source. More...
 
static toggleDataSource (int $a_ldap_server_id, int $a_auth_mode, int $a_status)
 Toggle Data Source. More...
 
static isAuthModeLDAP (string $a_auth_mode)
 Check if user auth mode is LDAP. More...
 
static getServerIdByAuthMode (string $a_auth_mode)
 Get auth id by auth mode. More...
 
static getAuthModeByKey (string $a_auth_key)
 get auth mode by key More...
 
static getKeyByAuthMode (string $a_auth_mode)
 Get auth id by auth mode. More...
 

Data Fields

const LDAP_BIND_ANONYMOUS = 0
 
const LDAP_BIND_USER = 1
 
const LDAP_SCOPE_SUB = 0
 
const LDAP_SCOPE_ONE = 1
 
const LDAP_SCOPE_BASE = 2
 
const DEFAULT_NETWORK_TIMEOUT = 5
 

Private Member Functions

 prepareFilter (string $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

const DEBUG = false
 
const DEFAULT_VERSION = 3
 
string $role_bind_dn = ''
 
string $role_bind_pass = ''
 
bool $role_sync_active = false
 
int $server_id
 
array $fallback_urls = array()
 
string $url = ''
 
string $url_string = ''
 
bool $enabled_authentication = true
 
int $authentication_mapping = 0
 
bool $escape_dn = false
 
bool $active = false
 
string $name = ''
 
int $version = self::DEFAULT_VERSION
 
string $base_dn = ''
 
bool $referrals = false
 
bool $tls = false
 
int $binding_type = self::LDAP_BIND_ANONYMOUS
 
string $bind_user = ''
 
string $bind_password = ''
 
string $search_base = ''
 
string $user_attribute = ''
 
int $user_scope = self::LDAP_SCOPE_ONE
 
string $group_filter = ''
 
string $filter = ''
 
string $group_dn = ''
 
string $group_member = ''
 
int $group_scope = self::LDAP_SCOPE_ONE
 
string $group_name = ''
 
bool $memberisdn = false
 
string $group_attribute = ''
 
bool $group_optional = true
 
string $group_user_filter = ''
 
bool $sync_on_login = false
 
bool $sync_per_cron = false
 
bool $account_migration = false
 
string $username_filter = ''
 
int $global_role = 0
 
ilDBInterface $db
 
ilLanguage $lng
 
ilErrorHandling $ilErr
 

Static Private Attributes

static array $instances = []
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLDAPServer::__construct ( int  $a_server_id = 0)

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

86 {
87 global $DIC;
88
89 $this->db = $DIC->database();
90 $this->lng = $DIC->language();
91 $this->ilErr = $DIC['ilErr'];
92
93 $this->server_id = $a_server_id;
94
95 $this->read();
96 }
read()
Read server settings.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\lng(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getActiveServerList()

static ilLDAPServer::_getActiveServerList ( )
static

Get active server list.

Returns
int[] server ids of active ldap server

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

139 : array
140 {
141 global $DIC;
142
143 $ilDB = $DIC['ilDB'];
144
145 $query = "SELECT server_id FROM ldap_server_settings " .
146 "WHERE active = 1 AND authentication = 1 " .
147 "ORDER BY name ";
148 $res = $ilDB->query($query);
149
150 $server_ids = [];
151
152 while ($row = $ilDB->fetchObject($res)) {
153 $server_ids[] = (int) $row->server_id;
154 }
155 return $server_ids;
156 }
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

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

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

◆ _getAllServer()

static ilLDAPServer::_getAllServer ( )
static

Get list of all configured servers.

Returns
list<array<string, string|int|float|null>> list of server

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

269 : array
270 {
271 global $DIC;
272
273 $ilDB = $DIC['ilDB'];
274
275 $query = 'SELECT * FROM ldap_server_settings ORDER BY name';
276
277 $server = [];
278
279 $res = $ilDB->query($query);
280 while ($row = $ilDB->fetchAssoc($res)) {
281 $server[] = $row;
282 }
283 return $server;
284 }
$server
Definition: shib_login.php:28

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

Referenced by ilLDAPSettingsGUI\serverListCmd().

+ Here is the caller graph for this function:

◆ _getCronServerIds()

static ilLDAPServer::_getCronServerIds ( )
static

Get list of acticve servers with option 'SyncCron'.

Returns
int[] server ids of active ldap server

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

163 : array
164 {
165 global $DIC;
166
167 $ilDB = $DIC['ilDB'];
168
169 $query = "SELECT server_id FROM ldap_server_settings " .
170 "WHERE active = 1 " .
171 "AND sync_per_cron = 1 " .
172 "ORDER BY name";
173
174 $res = $ilDB->query($query);
175
176 $server_ids = [];
177
178 while ($row = $ilDB->fetchObject($res)) {
179 $server_ids[] = (int) $row->server_id;
180 }
181 return $server_ids;
182 }

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilLDAPCronSynchronization\run().

+ Here is the call graph for this function:
+ 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 213 of file class.ilLDAPServer.php.

213 : int
214 {
215 $servers = self::_getActiveServerList();
216 if (count($servers)) {
217 return $servers[0];
218 }
219 return 0;
220 }
static _getActiveServerList()
Get active server list.

References _getActiveServerList().

Referenced by ilECSCmsCourseMemberCommandQueueHandler\createMember().

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

◆ _getRoleSyncServerIds()

static ilLDAPServer::_getRoleSyncServerIds ( )
static

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

Returns
int[]

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

188 : array
189 {
190 global $DIC;
191
192 $ilDB = $DIC['ilDB'];
193
194 $query = "SELECT server_id FROM ldap_server_settings " .
195 "WHERE active = 1 " .
196 "AND role_sync_active = 1 ";
197
198 $res = $ilDB->query($query);
199
200 $server_ids = [];
201
202 while ($row = $ilDB->fetchObject($res)) {
203 $server_ids[] = (int) $row->server_id;
204 }
205 return $server_ids;
206 }

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilLDAPRoleGroupMapping\initServers().

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

◆ _getServerList()

static ilLDAPServer::_getServerList ( )
static

Get list of all configured servers.

Returns
int[] list of server ids

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

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

References $DIC, $ilDB, and $res.

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

+ Here is the caller graph for this function:

◆ checkLDAPLib()

static ilLDAPServer::checkLDAPLib ( )
static

Check if ldap module is installed.

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

129 : bool
130 {
131 return function_exists('ldap_bind');
132 }

Referenced by ilLDAPSettingsGUI\serverListCmd().

+ Here is the caller graph for this function:

◆ create()

ilLDAPServer::create ( )

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

846 : int
847 {
848 $next_id = $this->db->nextId('ldap_server_settings');
849
850 $query = 'INSERT INTO ldap_server_settings (server_id,active,name,url,version,base_dn,referrals,tls,bind_type,bind_user,bind_pass,' .
851 'search_base,user_scope,user_attribute,filter,group_dn,group_scope,group_filter,group_member,group_memberisdn,group_name,' .
852 'group_attribute,group_optional,group_user_filter,sync_on_login,sync_per_cron,role_sync_active,role_bind_dn,role_bind_pass,migration, ' .
853 'authentication,authentication_type,username_filter, escape_dn) ' .
854 'VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)';
855 $this->db->queryF(
856 $query,
857 array(
858 'integer','integer','text','text','integer','text','integer','integer','integer','text','text','text','integer',
859 'text','text','text','integer','text','text','integer','text','text','integer','text','integer','integer','integer',
860 'text','text', 'integer','integer','integer',"text", 'integer'),
861 array(
862 $next_id,
863 $this->isActive(),
864 $this->getName(),
865 $this->getUrlString(),
866 $this->getVersion(),
867 $this->getBaseDN(),
868 $this->isActiveReferrer(),
869 $this->isActiveTLS(),
870 $this->getBindingType(),
871 $this->getBindUser(),
872 $this->getBindPassword(),
873 $this->getSearchBase(),
874 $this->getUserScope(),
875 $this->getUserAttribute(),
876 $this->getFilter(),
877 $this->getGroupDN(),
878 $this->getGroupScope(),
879 $this->getGroupFilter(),
880 $this->getGroupMember(),
881 $this->enabledGroupMemberIsDN(),
882 $this->getGroupName(),
883 $this->getGroupAttribute(),
884 $this->isMembershipOptional(),
885 $this->getGroupUserFilter(),
886 $this->enabledSyncOnLogin(),
887 $this->enabledSyncPerCron(),
889 $this->getRoleBindDN(),
890 $this->getRoleBindPassword(),
894 $this->getUsernameFilter(),
895 (int) $this->enabledEscapeDN()
896 )
897 );
898 // end Patch Name Filter
899 $this->server_id = $next_id;
900 return $next_id;
901 }
isAuthenticationEnabled()
Check if authentication is enabled.
getAuthenticationMapping()
Get authentication mode that is mapped.
isAccountMigrationEnabled()
enabled account migration

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

+ Here is the call graph for this function:

◆ delete()

ilLDAPServer::delete ( )

delete

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

948 : void
949 {
950 if (!$this->getServerId()) {
951 //TODO check if we need return false
952 return;
953 }
954
956
958
959 foreach ($rules as $ruleAssigment) {
960 $ruleAssigment->delete();
961 }
962
964
965 $query = "DELETE FROM ldap_server_settings " .
966 "WHERE server_id = " . $this->db->quote($this->getServerId(), 'integer');
967 $this->db->manipulate($query);
968 }
static _delete(int $a_server_id)
static _getRules($a_server_id)
Get all rules.

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

+ Here is the call graph for this function:

◆ disableDataSourceForAuthMode()

static ilLDAPServer::disableDataSourceForAuthMode ( int  $a_authmode)
static

Disable data source.

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

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

References $DIC, and $ilDB.

Referenced by toggleDataSource().

+ Here is the caller graph for this function:

◆ doConnectionCheck()

ilLDAPServer::doConnectionCheck ( )

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

@access public

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

527 : bool
528 {
529 foreach (array_merge(array(0 => $this->url), $this->fallback_urls) as $url) {
530 try {
531 ilLoggerFactory::getLogger('auth')->debug('Using url: ' . $url);
532 // Need to do a full bind, since openldap return valid connection links for invalid hosts
533 $query = new ilLDAPQuery($this, $url);
534 $query->bind(ilLDAPQuery::LDAP_BIND_TEST);
535 $this->url = $url;
536 return true;
537 } catch (ilLDAPQueryException $exc) {
538 $this->rotateFallbacks();
539 ilLoggerFactory::getLogger('auth')->error('Cannot connect to LDAP server: ' . $url . ' ' . $exc->getCode() . ' ' . $exc->getMessage());
540 }
541 }
542 ilLoggerFactory::getLogger('auth')->warning('No valid LDAP server found');
543 return false;
544 }
rotateFallbacks()
Rotate fallback urls in case of connect timeouts.
static getLogger(string $a_component_id)
Get component logger.

References $url, ilLoggerFactory\getLogger(), ilLDAPQuery\LDAP_BIND_TEST, and rotateFallbacks().

+ Here is the call graph for this function:

◆ enableAccountMigration()

ilLDAPServer::enableAccountMigration ( bool  $a_status)

Enable account migration.

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

804 : void
805 {
806 $this->account_migration = $a_status;
807 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableAuthentication()

ilLDAPServer::enableAuthentication ( bool  $a_status)

Enable authentication for this ldap server.

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

445 : void
446 {
447 $this->enabled_authentication = $a_status;
448 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enabledEscapeDN()

ilLDAPServer::enabledEscapeDN ( )

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

796 : bool
797 {
798 return $this->escape_dn;
799 }

References $escape_dn.

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

+ Here is the caller graph for this function:

◆ enabledGroupMemberIsDN()

ilLDAPServer::enabledGroupMemberIsDN ( )

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

713 : bool
714 {
715 return $this->memberisdn;
716 }

References $memberisdn.

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

+ Here is the caller graph for this function:

◆ enabledRoleSynchronization()

ilLDAPServer::enabledRoleSynchronization ( )

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

773 : bool
774 {
776 }

References $role_sync_active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ enabledSyncOnLogin()

ilLDAPServer::enabledSyncOnLogin ( )

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

737 : bool
738 {
740 }

References $sync_on_login.

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

+ Here is the caller graph for this function:

◆ enabledSyncPerCron()

ilLDAPServer::enabledSyncPerCron ( )

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

745 : bool
746 {
748 }

References $sync_per_cron.

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

+ Here is the caller graph for this function:

◆ enableEscapeDN()

ilLDAPServer::enableEscapeDN ( bool  $a_value)

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

791 : void
792 {
793 $this->escape_dn = $a_value;
794 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableGroupMemberIsDN()

ilLDAPServer::enableGroupMemberIsDN ( bool  $a_value)

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

717 : void
718 {
719 $this->memberisdn = $a_value;
720 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableRoleSynchronization()

ilLDAPServer::enableRoleSynchronization ( bool  $a_value)

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

777 : void
778 {
779 $this->role_sync_active = $a_value;
780 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncOnLogin()

ilLDAPServer::enableSyncOnLogin ( bool  $a_value)

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

741 : void
742 {
743 $this->sync_on_login = $a_value;
744 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncPerCron()

ilLDAPServer::enableSyncPerCron ( bool  $a_value)

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

749 : void
750 {
751 $this->sync_per_cron = $a_value;
752 }

Referenced by read().

+ Here is the caller graph for this function:

◆ getAuthenticationMapping()

ilLDAPServer::getAuthenticationMapping ( )

Get authentication mode that is mapped.

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

469 : int
470 {
472 }

References $authentication_mapping.

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

+ Here is the caller graph for this function:

◆ getAuthenticationMappingKey()

ilLDAPServer::getAuthenticationMappingKey ( )

Get authentication mapping key Default is ldap.

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

478 : string
479 {
480 if ($this->isAuthenticationEnabled() || !$this->getAuthenticationMapping()) {
481 return 'ldap_' . $this->getServerId();
482 }
484 }
static _getAuthModeName($a_auth_key)

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

+ Here is the call graph for this function:

◆ getAuthModeByKey()

static ilLDAPServer::getAuthModeByKey ( string  $a_auth_key)
static

get auth mode by key

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

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

Referenced by ilAuthUtils\_getAuthModeName().

+ Here is the caller graph for this function:

◆ getAvailableDataSources()

static ilLDAPServer::getAvailableDataSources ( int  $a_auth_mode)
static

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

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

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

◆ getBaseDN()

ilLDAPServer::getBaseDN ( )

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

563 : string
564 {
565 return $this->base_dn;
566 }

References $base_dn.

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

+ Here is the caller graph for this function:

◆ getBindingType()

ilLDAPServer::getBindingType ( )

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

587 : int
588 {
589 return $this->binding_type;
590 }

References $binding_type.

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

+ Here is the caller graph for this function:

◆ getBindPassword()

ilLDAPServer::getBindPassword ( )

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

607 : string
608 {
610 }

References $bind_password.

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

+ Here is the caller graph for this function:

◆ getBindUser()

ilLDAPServer::getBindUser ( )

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

599 : string
600 {
601 return $this->bind_user;
602 }

References $bind_user.

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

+ Here is the caller graph for this function:

◆ getDataSource()

static ilLDAPServer::getDataSource ( int  $a_auth_mode)
static

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

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

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

Referenced by ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildLdapEnableInput().

+ Here is the caller graph for this function:

◆ getFilter()

ilLDAPServer::getFilter ( )

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

631 : string
632 {
633 return $this->prepareFilter($this->filter);
634 }
prepareFilter(string $a_filter)
Create brackets for filters if they do not exist.
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)

References ILIAS\Repository\filter(), and prepareFilter().

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

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

◆ getGroupAttribute()

ilLDAPServer::getGroupAttribute ( )

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

688 : string
689 {
691 }

References $group_attribute.

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

+ Here is the caller graph for this function:

◆ getGroupDN()

ilLDAPServer::getGroupDN ( )

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

639 : string
640 {
641 return $this->group_dn;
642 }

References $group_dn.

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

+ Here is the caller graph for this function:

◆ getGroupFilter()

ilLDAPServer::getGroupFilter ( )

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

647 : string
648 {
649 return $this->prepareFilter($this->group_filter);
650 }

References prepareFilter().

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

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

◆ getGroupMember()

ilLDAPServer::getGroupMember ( )

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

655 : string
656 {
657 return $this->group_member;
658 }

References $group_member.

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

+ Here is the caller graph for this function:

◆ getGroupName()

ilLDAPServer::getGroupName ( )

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

663 : string
664 {
665 return $this->group_name;
666 }

References $group_name.

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

+ Here is the caller graph for this function:

◆ getGroupNames()

ilLDAPServer::getGroupNames ( )

Get group names as array.

Returns
string[]

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

676 : array
677 {
678 $names = explode(',', $this->getGroupName());
679
680 if (!is_array($names)) {
681 return [];
682 }
683
684 return array_filter(array_map('trim', $names));
685 }

References getGroupName().

+ Here is the call graph for this function:

◆ getGroupScope()

ilLDAPServer::getGroupScope ( )

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

725 : int
726 {
727 return $this->group_scope;
728 }

References $group_scope.

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

+ Here is the caller graph for this function:

◆ getGroupUserFilter()

ilLDAPServer::getGroupUserFilter ( )

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

708 : string
709 {
711 }

References $group_user_filter.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getInstanceByServerId()

◆ getKeyByAuthMode()

static ilLDAPServer::getKeyByAuthMode ( string  $a_auth_mode)
static

Get auth id by auth mode.

Returns
int|string auth_mode

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

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

References ilAuthUtils\AUTH_LDAP.

Referenced by ilAuthUtils\_getAuthMode().

+ Here is the caller graph for this function:

◆ getName()

ilLDAPServer::getName ( )

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

547 : string
548 {
549 return $this->name;
550 }

References $name.

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

+ Here is the caller graph for this function:

◆ getPearAtributeArray()

ilLDAPServer::getPearAtributeArray ( )
private

Get attribute array for pear auth data.

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

1050 : array
1051 {
1052 if ($this->enabledSyncOnLogin()) {
1054 return array_merge(
1055 array($this->getUserAttribute()),
1056 $mapping->getFields(),
1057 array('dn'),
1059 );
1060 }
1061
1062 return array($this->getUserAttribute());
1063 }
static _getInstanceByServerId(int $a_server_id)
static getAttributeNames($a_server_id)
get all possible attribute names

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

Referenced by toPearAuthArray().

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

◆ getRoleBindDN()

ilLDAPServer::getRoleBindDN ( )

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

757 : string
758 {
759 return $this->role_bind_dn;
760 }

References $role_bind_dn.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getRoleBindPassword()

ilLDAPServer::getRoleBindPassword ( )

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

765 : string
766 {
768 }

References $role_bind_pass.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getSearchBase()

ilLDAPServer::getSearchBase ( )

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

615 : string
616 {
617 return $this->search_base;
618 }

References $search_base.

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

+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPServer::getServerId ( )

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

437 : int
438 {
439 return $this->server_id;
440 }

References $server_id.

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

+ Here is the caller graph for this function:

◆ getServerIdByAuthMode()

static ilLDAPServer::getServerIdByAuthMode ( string  $a_auth_mode)
static

Get auth id by auth mode.

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

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

Referenced by ilObjAuthSettingsGUI\buildAuthModeDeterminationForm(), ilObjAuthSettingsGUI\buildRegistrationRoleMappingForm(), ilAuthModeDetermination\getAuthModeSequence(), ilAuthUtils\getAuthModeTranslation(), and ilAuthModeDetermination\read().

+ Here is the caller graph for this function:

◆ getServerIds()

static ilLDAPServer::getServerIds ( )
static

Get all server ids.

Returns
int[]

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

248 : array
249 {
250 global $DIC;
251
252 $ilDB = $DIC['ilDB'];
253
254 $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
255
256 $res = $ilDB->query($query);
257
258 $server = [];
259 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
260 $server[] = (int) $row->server_id;
261 }
262 return $server;
263 }

References $DIC, $ilDB, $res, $server, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildLdapEnableInput(), and ilECSParticipantSettingsGUI\parseAvailableAuthModes().

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

◆ getUrl()

ilLDAPServer::getUrl ( )

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

494 : string
495 {
496 return $this->url;
497 }

References $url.

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

+ Here is the caller graph for this function:

◆ getUrlString()

ilLDAPServer::getUrlString ( )

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

515 : string
516 {
517 return $this->url_string;
518 }

References $url_string.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserAttribute()

ilLDAPServer::getUserAttribute ( )

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

623 : string
624 {
626 }

References $user_attribute.

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

+ Here is the caller graph for this function:

◆ getUsernameFilter()

ilLDAPServer::getUsernameFilter ( )

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

782 : string
783 {
785 }

References $username_filter.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserScope()

ilLDAPServer::getUserScope ( )

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

733 : int
734 {
735 return $this->user_scope;
736 }

References $user_scope.

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

+ Here is the caller graph for this function:

◆ getVersion()

ilLDAPServer::getVersion ( )

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

555 : int
556 {
557 return $this->version;
558 }

References $version.

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

+ Here is the caller graph for this function:

◆ isAccountMigrationEnabled()

ilLDAPServer::isAccountMigrationEnabled ( )

enabled account migration

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

812 : bool
813 {
815 }

References $account_migration.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActive()

ilLDAPServer::isActive ( )

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

490 : bool
491 {
492 return $this->active;
493 }

References $active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActiveReferrer()

ilLDAPServer::isActiveReferrer ( )

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

571 : bool
572 {
573 return $this->referrals;
574 }

References $referrals.

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

+ Here is the caller graph for this function:

◆ isActiveTLS()

ilLDAPServer::isActiveTLS ( )

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

579 : bool
580 {
581 return $this->tls;
582 }

References $tls.

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

+ Here is the caller graph for this function:

◆ isAuthenticationEnabled()

ilLDAPServer::isAuthenticationEnabled ( )

Check if authentication is enabled.

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

453 : bool
454 {
456 }

References $enabled_authentication.

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

+ Here is the caller graph for this function:

◆ isAuthModeLDAP()

static ilLDAPServer::isAuthModeLDAP ( string  $a_auth_mode)
static

Check if user auth mode is LDAP.

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

382 : bool
383 {
384 global $DIC;
385
386 $logger = $DIC->logger()->auth();
387
388 if ($a_auth_mode === '') {
389 $logger->error(__METHOD__ . ': No auth mode given..............');
390 return false;
391 }
392
393 $auth_arr = explode('_', $a_auth_mode);
394
395 return ((int) $auth_arr[0] === ilAuthUtils::AUTH_LDAP) && (isset($auth_arr[1]) && $auth_arr[1]);
396 }

References $DIC, and ilAuthUtils\AUTH_LDAP.

Referenced by ilObjAuthSettingsGUI\buildAuthModeDeterminationForm().

+ Here is the caller graph for this function:

◆ isDataSourceActive()

static ilLDAPServer::isDataSourceActive ( int  $a_auth_mode)
static

Check if a data source is active for a specific auth mode.

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

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

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

◆ isMembershipOptional()

ilLDAPServer::isMembershipOptional ( )

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

700 : bool
701 {
703 }

References $group_optional.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ prepareFilter()

ilLDAPServer::prepareFilter ( string  $a_filter)
private

Create brackets for filters if they do not exist.

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

1030 : string
1031 {
1032 $filter = trim($a_filter);
1033
1034 if ($filter === '') {
1035 return $filter;
1036 }
1037
1038 if (strpos($filter, '(') !== 0) {
1039 $filter = ('(' . $filter);
1040 }
1041 if (substr($filter, -1) !== ')') {
1042 $filter .= ')';
1043 }
1044 return $filter;
1045 }

References $filter.

Referenced by getFilter(), and getGroupFilter().

+ Here is the caller graph for this function:

◆ read()

ilLDAPServer::read ( )
private

Read server settings.

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

1069 : void
1070 {
1071 if (!$this->server_id) {
1072 return;
1073 }
1074 $query = "SELECT * FROM ldap_server_settings WHERE server_id = " . $this->db->quote($this->server_id, ilDBConstants::T_INTEGER);
1075
1076 $res = $this->db->query($query);
1077 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1078 $this->toggleActive((bool) $row->active);
1079 $this->setName($row->name ?? '');
1080 $this->setUrl($row->url ?? '');
1081 $this->setVersion((int) $row->version);
1082 $this->setBaseDN($row->base_dn ?? '');
1083 $this->toggleReferrer((bool) $row->referrals);
1084 $this->toggleTLS((bool) $row->tls);
1085 $this->setBindingType((int) $row->bind_type);
1086 $this->setBindUser($row->bind_user ?? '');
1087 $this->setBindPassword($row->bind_pass ?? '');
1088 $this->setSearchBase($row->search_base ?? '');
1089 $this->setUserScope((int) $row->user_scope);
1090 $this->setUserAttribute($row->user_attribute ?? '');
1091 $this->setFilter($row->filter ?? '');
1092 $this->setGroupDN($row->group_dn ?? '');
1093 $this->setGroupScope((int) $row->group_scope);
1094 $this->setGroupFilter($row->group_filter ?? '');
1095 $this->setGroupMember($row->group_member ?? '');
1096 $this->setGroupAttribute($row->group_attribute ?? '');
1097 $this->toggleMembershipOptional((bool) $row->group_optional);
1098 $this->setGroupUserFilter($row->group_user_filter ?? '');
1099 $this->enableGroupMemberIsDN((bool) $row->group_memberisdn);
1100 $this->setGroupName($row->group_name ?? '');
1101 $this->enableSyncOnLogin((bool) $row->sync_on_login);
1102 $this->enableSyncPerCron((bool) $row->sync_per_cron);
1103 $this->enableRoleSynchronization((bool) $row->role_sync_active);
1104 $this->setRoleBindDN($row->role_bind_dn ?? '');
1105 $this->setRoleBindPassword($row->role_bind_pass ?? '');
1106 $this->enableAccountMigration((bool) $row->migration);
1107 $this->enableAuthentication((bool) $row->authentication);
1108 $this->setAuthenticationMapping((int) $row->authentication_type);
1109 $this->setUsernameFilter($row->username_filter ?? '');
1110 $this->enableEscapeDN((bool) $row->escape_dn);
1111 }
1112 }
enableRoleSynchronization(bool $a_value)
setGroupFilter(string $a_value)
setFilter(string $a_filter)
enableEscapeDN(bool $a_value)
toggleTLS(bool $a_status)
enableGroupMemberIsDN(bool $a_value)
enableSyncOnLogin(bool $a_value)
setGroupDN(string $a_value)
setGroupScope(int $a_value)
setRoleBindDN(string $a_value)
setGroupUserFilter(string $a_filter)
enableAuthentication(bool $a_status)
Enable authentication for this ldap server.
setUrl(string $a_url)
setGroupAttribute(string $a_value)
setUsernameFilter(string $a_value)
setBindPassword(string $a_password)
setUserAttribute(string $a_user_attr)
setGroupName(string $a_value)
setBaseDN(string $a_base_dn)
enableSyncPerCron(bool $a_value)
enableAccountMigration(bool $a_status)
Enable account migration.
setGroupMember(string $a_value)
setBindUser(string $a_user)
setUserScope(int $a_value)
setBindingType(int $a_type)
toggleMembershipOptional(bool $a_status)
toggleReferrer(bool $a_status)
setAuthenticationMapping(int $a_map)
Set mapped authentication mapping.
toggleActive(bool $a_status)
setSearchBase(string $a_search_base)
setVersion(int $a_version)
setName(string $a_name)
setRoleBindPassword(string $a_value)

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

Referenced by __construct().

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

◆ rotateFallbacks()

ilLDAPServer::rotateFallbacks ( )

Rotate fallback urls in case of connect timeouts.

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

109 : bool
110 {
111 if (!$this->fallback_urls) {
112 return false;
113 }
114
115 $all_urls = array_merge($this->fallback_urls);
116 $all_urls[] = $this->getUrl();
117
118 $query = 'UPDATE ldap_server_settings SET ' .
119 'url = ' . $this->db->quote(implode(',', $all_urls), 'text') . ' ' .
120 'WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer');
121 $this->db->manipulate($query);
122 return true;
123 }

References getServerId(), and getUrl().

Referenced by doConnectionCheck().

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

◆ setAuthenticationMapping()

ilLDAPServer::setAuthenticationMapping ( int  $a_map)

Set mapped authentication mapping.

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

461 : void
462 {
463 $this->authentication_mapping = $a_map;
464 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBaseDN()

ilLDAPServer::setBaseDN ( string  $a_base_dn)

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

567 : void
568 {
569 $this->base_dn = $a_base_dn;
570 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindingType()

ilLDAPServer::setBindingType ( int  $a_type)

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

591 : void
592 {
593 if ($a_type === self::LDAP_BIND_USER) {
594 $this->binding_type = self::LDAP_BIND_USER;
595 } else {
596 $this->binding_type = self::LDAP_BIND_ANONYMOUS;
597 }
598 }

References LDAP_BIND_ANONYMOUS, and LDAP_BIND_USER.

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindPassword()

ilLDAPServer::setBindPassword ( string  $a_password)

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

611 : void
612 {
613 $this->bind_password = $a_password;
614 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindUser()

ilLDAPServer::setBindUser ( string  $a_user)

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

603 : void
604 {
605 $this->bind_user = $a_user;
606 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setFilter()

ilLDAPServer::setFilter ( string  $a_filter)

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

635 : void
636 {
637 $this->filter = $a_filter;
638 }

References ILIAS\Repository\filter().

Referenced by read().

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

◆ setGlobalRole()

ilLDAPServer::setGlobalRole ( int  $a_role)

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

753 : void
754 {
755 $this->global_role = $a_role;
756 }

◆ setGroupAttribute()

ilLDAPServer::setGroupAttribute ( string  $a_value)

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

692 : void
693 {
694 $this->group_attribute = $a_value;
695 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupDN()

ilLDAPServer::setGroupDN ( string  $a_value)

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

643 : void
644 {
645 $this->group_dn = $a_value;
646 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupFilter()

ilLDAPServer::setGroupFilter ( string  $a_value)

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

651 : void
652 {
653 $this->group_filter = $a_value;
654 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupMember()

ilLDAPServer::setGroupMember ( string  $a_value)

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

659 : void
660 {
661 $this->group_member = $a_value;
662 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupName()

ilLDAPServer::setGroupName ( string  $a_value)

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

667 : void
668 {
669 $this->group_name = $a_value;
670 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupScope()

ilLDAPServer::setGroupScope ( int  $a_value)

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

721 : void
722 {
723 $this->group_scope = $a_value;
724 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupUserFilter()

ilLDAPServer::setGroupUserFilter ( string  $a_filter)

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

704 : void
705 {
706 $this->group_user_filter = $a_filter;
707 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setName()

ilLDAPServer::setName ( string  $a_name)

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

551 : void
552 {
553 $this->name = $a_name;
554 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindDN()

ilLDAPServer::setRoleBindDN ( string  $a_value)

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

761 : void
762 {
763 $this->role_bind_dn = $a_value;
764 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindPassword()

ilLDAPServer::setRoleBindPassword ( string  $a_value)

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

769 : void
770 {
771 $this->role_bind_pass = $a_value;
772 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSearchBase()

ilLDAPServer::setSearchBase ( string  $a_search_base)

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

619 : void
620 {
621 $this->search_base = $a_search_base;
622 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUrl()

ilLDAPServer::setUrl ( string  $a_url)

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

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

References $counter, and $url.

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserAttribute()

ilLDAPServer::setUserAttribute ( string  $a_user_attr)

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

627 : void
628 {
629 $this->user_attribute = $a_user_attr;
630 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUsernameFilter()

ilLDAPServer::setUsernameFilter ( string  $a_value)

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

786 : void
787 {
788 $this->username_filter = $a_value;
789 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserScope()

ilLDAPServer::setUserScope ( int  $a_value)

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

729 : void
730 {
731 $this->user_scope = $a_value;
732 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion()

ilLDAPServer::setVersion ( int  $a_version)

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

559 : void
560 {
561 $this->version = $a_version;
562 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleActive()

ilLDAPServer::toggleActive ( bool  $a_status)

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

486 : void
487 {
488 $this->active = $a_status;
489 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleDataSource()

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

Toggle Data Source.

Todo:
handle multiple ldap servers

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

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

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

+ Here is the call graph for this function:

◆ toggleMembershipOptional()

ilLDAPServer::toggleMembershipOptional ( bool  $a_status)

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

696 : void
697 {
698 $this->group_optional = $a_status;
699 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleReferrer()

ilLDAPServer::toggleReferrer ( bool  $a_status)

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

575 : void
576 {
577 $this->referrals = $a_status;
578 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleTLS()

ilLDAPServer::toggleTLS ( bool  $a_status)

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

583 : void
584 {
585 $this->tls = $a_status;
586 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toPearAuthArray()

ilLDAPServer::toPearAuthArray ( )

Creates an array of options compatible to PEAR Auth.

Returns
array auth settings

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

976 : array
977 {
978 $options = array(
979 'url' => $this->getUrl(),
980 'version' => $this->getVersion(),
981 'referrals' => $this->isActiveReferrer());
982
983 if ($this->getBindingType() === self::LDAP_BIND_USER) {
984 $options['binddn'] = $this->getBindUser();
985 $options['bindpw'] = $this->getBindPassword();
986 }
987 $options['basedn'] = $this->getBaseDN();
988 $options['start_tls'] = $this->isActiveTLS();
989 $options['userdn'] = $this->getSearchBase();
990 if ($this->getUserScope() === self::LDAP_SCOPE_ONE) {
991 $options['userscope'] = 'one';
992 } else {
993 $options['userscope'] = 'sub';
994 }
995
996 $options['userattr'] = $this->getUserAttribute();
997 $options['userfilter'] = $this->getFilter();
998 $options['attributes'] = $this->getPearAtributeArray();
999 $options['debug'] = self::DEBUG;
1000
1001
1002 $options['enableLogging'] = true;
1003
1004 switch ($this->getGroupScope()) {
1006 $options['groupscope'] = 'base';
1007 break;
1009 $options['groupscope'] = 'one';
1010 break;
1011 default:
1012 $options['groupscope'] = 'sub';
1013 break;
1014 }
1015 $options['escape_dn'] = $this->enabledEscapeDN();
1016 $options['groupdn'] = $this->getGroupDN();
1017 $options['groupattr'] = $this->getGroupAttribute();
1018 $options['groupfilter'] = $this->getGroupFilter();
1019 $options['memberattr'] = $this->getGroupMember();
1020 $options['memberisdn'] = $this->enabledGroupMemberIsDN();
1021 $options['group'] = $this->getGroupName();
1022
1023
1024 return $options;
1025 }
getPearAtributeArray()
Get attribute array for pear auth data.

References DEBUG, enabledEscapeDN(), enabledGroupMemberIsDN(), getBaseDN(), getBindingType(), getBindPassword(), getBindUser(), getFilter(), getGroupAttribute(), getGroupDN(), getGroupFilter(), getGroupMember(), getGroupName(), getGroupScope(), getPearAtributeArray(), getSearchBase(), getUrl(), getUserAttribute(), getUserScope(), getVersion(), isActiveReferrer(), isActiveTLS(), LDAP_SCOPE_BASE, and LDAP_SCOPE_ONE.

+ Here is the call graph for this function:

◆ update()

ilLDAPServer::update ( )

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

903 : bool
904 {
905 $query = "UPDATE ldap_server_settings SET " .
906 "active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
907 "name = " . $this->db->quote($this->getName(), 'text') . ", " .
908 "url = " . $this->db->quote($this->getUrlString(), 'text') . ", " .
909 "version = " . $this->db->quote($this->getVersion(), 'integer') . ", " .
910 "base_dn = " . $this->db->quote($this->getBaseDN(), 'text') . ", " .
911 "referrals = " . $this->db->quote($this->isActiveReferrer(), 'integer') . ", " .
912 "tls = " . $this->db->quote($this->isActiveTLS(), 'integer') . ", " .
913 "bind_type = " . $this->db->quote($this->getBindingType(), 'integer') . ", " .
914 "bind_user = " . $this->db->quote($this->getBindUser(), 'text') . ", " .
915 "bind_pass = " . $this->db->quote($this->getBindPassword(), 'text') . ", " .
916 "search_base = " . $this->db->quote($this->getSearchBase(), 'text') . ", " .
917 "user_scope = " . $this->db->quote($this->getUserScope(), 'integer') . ", " .
918 "user_attribute = " . $this->db->quote($this->getUserAttribute(), 'text') . ", " .
919 "filter = " . $this->db->quote($this->getFilter(), 'text') . ", " .
920 "group_dn = " . $this->db->quote($this->getGroupDN(), 'text') . ", " .
921 "group_scope = " . $this->db->quote($this->getGroupScope(), 'integer') . ", " .
922 "group_filter = " . $this->db->quote($this->getGroupFilter(), 'text') . ", " .
923 "group_member = " . $this->db->quote($this->getGroupMember(), 'text') . ", " .
924 "group_memberisdn =" . $this->db->quote((int) $this->enabledGroupMemberIsDN(), 'integer') . ", " .
925 "group_name = " . $this->db->quote($this->getGroupName(), 'text') . ", " .
926 "group_attribute = " . $this->db->quote($this->getGroupAttribute(), 'text') . ", " .
927 "group_optional = " . $this->db->quote((int) $this->isMembershipOptional(), 'integer') . ", " .
928 "group_user_filter = " . $this->db->quote($this->getGroupUserFilter(), 'text') . ", " .
929 "sync_on_login = " . $this->db->quote(($this->enabledSyncOnLogin() ? 1 : 0), 'integer') . ", " .
930 "sync_per_cron = " . $this->db->quote(($this->enabledSyncPerCron() ? 1 : 0), 'integer') . ", " .
931 "role_sync_active = " . $this->db->quote($this->enabledRoleSynchronization(), 'integer') . ", " .
932 "role_bind_dn = " . $this->db->quote($this->getRoleBindDN(), 'text') . ", " .
933 "role_bind_pass = " . $this->db->quote($this->getRoleBindPassword(), 'text') . ", " .
934 "migration = " . $this->db->quote((int) $this->isAccountMigrationEnabled(), 'integer') . ", " .
935 'authentication = ' . $this->db->quote((int) $this->isAuthenticationEnabled(), 'integer') . ', ' .
936 'authentication_type = ' . $this->db->quote($this->getAuthenticationMapping(), 'integer') . ' ' .
937 ", username_filter = " . $this->db->quote($this->getUsernameFilter(), "text") . " " .
938 ", escape_dn = " . $this->db->quote($this->enabledEscapeDN() ? 1 : 0, 'integer') . " " .
939 "WHERE server_id = " . $this->db->quote($this->getServerId(), 'integer');
940
941 $this->db->manipulate($query);
942 return true;
943 }

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

+ Here is the call graph for this function:

◆ validate()

ilLDAPServer::validate ( )

Validate user input.

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

821 : bool
822 {
823 $this->ilErr->setMessage('');
824 if ($this->getName() === '' ||
825 $this->getUrl() === '' ||
826 $this->getBaseDN() === '' ||
827 $this->getUserAttribute() === '') {
828 $this->ilErr->setMessage($this->lng->txt('fill_out_all_required_fields'));
829 }
830
831 if ($this->getBindingType() === self::LDAP_BIND_USER
832 && ($this->getBindUser() === '' || $this->getBindPassword() === '')) {
833 $this->ilErr->appendMessage($this->lng->txt('ldap_missing_bind_user'));
834 }
835
836 if (!$this->global_role && ($this->enabledSyncPerCron() || $this->enabledSyncOnLogin())) {
837 $this->ilErr->appendMessage($this->lng->txt('ldap_missing_role_assignment'));
838 }
839 if ($this->getVersion() === 2 && $this->isActiveTLS()) {
840 $this->ilErr->appendMessage($this->lng->txt('ldap_tls_conflict'));
841 }
842
843 return $this->ilErr->getMessage() === '';
844 }

References enabledSyncOnLogin(), enabledSyncPerCron(), getBaseDN(), getBindingType(), getBindPassword(), getBindUser(), getName(), getUrl(), getUserAttribute(), getVersion(), isActiveTLS(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $account_migration

bool ilLDAPServer::$account_migration = false
private

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

Referenced by isAccountMigrationEnabled().

◆ $active

bool ilLDAPServer::$active = false
private

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

Referenced by isActive().

◆ $authentication_mapping

int ilLDAPServer::$authentication_mapping = 0
private

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

Referenced by getAuthenticationMapping().

◆ $base_dn

string ilLDAPServer::$base_dn = ''
private

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

Referenced by getBaseDN().

◆ $bind_password

string ilLDAPServer::$bind_password = ''
private

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

Referenced by getBindPassword().

◆ $bind_user

string ilLDAPServer::$bind_user = ''
private

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

Referenced by getBindUser().

◆ $binding_type

int ilLDAPServer::$binding_type = self::LDAP_BIND_ANONYMOUS
private

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

Referenced by getBindingType().

◆ $db

ilDBInterface ilLDAPServer::$db
private

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

◆ $enabled_authentication

bool ilLDAPServer::$enabled_authentication = true
private

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

Referenced by isAuthenticationEnabled().

◆ $escape_dn

bool ilLDAPServer::$escape_dn = false
private

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

Referenced by enabledEscapeDN().

◆ $fallback_urls

array ilLDAPServer::$fallback_urls = array()
private

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

◆ $filter

string ilLDAPServer::$filter = ''
private

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

Referenced by prepareFilter().

◆ $global_role

int ilLDAPServer::$global_role = 0
private

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

◆ $group_attribute

string ilLDAPServer::$group_attribute = ''
private

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

Referenced by getGroupAttribute().

◆ $group_dn

string ilLDAPServer::$group_dn = ''
private

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

Referenced by getGroupDN().

◆ $group_filter

string ilLDAPServer::$group_filter = ''
private

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

◆ $group_member

string ilLDAPServer::$group_member = ''
private

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

Referenced by getGroupMember().

◆ $group_name

string ilLDAPServer::$group_name = ''
private

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

Referenced by getGroupName().

◆ $group_optional

bool ilLDAPServer::$group_optional = true
private

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

Referenced by isMembershipOptional().

◆ $group_scope

int ilLDAPServer::$group_scope = self::LDAP_SCOPE_ONE
private

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

Referenced by getGroupScope().

◆ $group_user_filter

string ilLDAPServer::$group_user_filter = ''
private

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

Referenced by getGroupUserFilter().

◆ $ilErr

ilErrorHandling ilLDAPServer::$ilErr
private

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

◆ $instances

array ilLDAPServer::$instances = []
staticprivate

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

◆ $lng

ilLanguage ilLDAPServer::$lng
private

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

◆ $memberisdn

bool ilLDAPServer::$memberisdn = false
private

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

Referenced by enabledGroupMemberIsDN().

◆ $name

string ilLDAPServer::$name = ''
private

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

Referenced by getName().

◆ $referrals

bool ilLDAPServer::$referrals = false
private

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

Referenced by isActiveReferrer().

◆ $role_bind_dn

string ilLDAPServer::$role_bind_dn = ''
private

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

Referenced by getRoleBindDN().

◆ $role_bind_pass

string ilLDAPServer::$role_bind_pass = ''
private

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

Referenced by getRoleBindPassword().

◆ $role_sync_active

bool ilLDAPServer::$role_sync_active = false
private

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

Referenced by enabledRoleSynchronization().

◆ $search_base

string ilLDAPServer::$search_base = ''
private

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

Referenced by getSearchBase().

◆ $server_id

int ilLDAPServer::$server_id
private

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

Referenced by getServerId().

◆ $sync_on_login

bool ilLDAPServer::$sync_on_login = false
private

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

Referenced by enabledSyncOnLogin().

◆ $sync_per_cron

bool ilLDAPServer::$sync_per_cron = false
private

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

Referenced by enabledSyncPerCron().

◆ $tls

bool ilLDAPServer::$tls = false
private

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

Referenced by isActiveTLS().

◆ $url

string ilLDAPServer::$url = ''
private

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

Referenced by doConnectionCheck(), getUrl(), and setUrl().

◆ $url_string

string ilLDAPServer::$url_string = ''
private

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

Referenced by getUrlString().

◆ $user_attribute

string ilLDAPServer::$user_attribute = ''
private

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

Referenced by getUserAttribute().

◆ $user_scope

int ilLDAPServer::$user_scope = self::LDAP_SCOPE_ONE
private

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

Referenced by getUserScope().

◆ $username_filter

string ilLDAPServer::$username_filter = ''
private

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

Referenced by getUsernameFilter().

◆ $version

int ilLDAPServer::$version = self::DEFAULT_VERSION
private

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

Referenced by getVersion().

◆ DEBUG

const ilLDAPServer::DEBUG = false
private

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

Referenced by toPearAuthArray().

◆ DEFAULT_NETWORK_TIMEOUT

const ilLDAPServer::DEFAULT_NETWORK_TIMEOUT = 5

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

Referenced by ilLDAPQuery\bind().

◆ DEFAULT_VERSION

const ilLDAPServer::DEFAULT_VERSION = 3
private

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

◆ LDAP_BIND_ANONYMOUS

const ilLDAPServer::LDAP_BIND_ANONYMOUS = 0

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

Referenced by ilLDAPSettingsGUI\initForm(), and setBindingType().

◆ LDAP_BIND_USER

const ilLDAPServer::LDAP_BIND_USER = 1

◆ LDAP_SCOPE_BASE

const ilLDAPServer::LDAP_SCOPE_BASE = 2

◆ LDAP_SCOPE_ONE

const ilLDAPServer::LDAP_SCOPE_ONE = 1

◆ LDAP_SCOPE_SUB

const ilLDAPServer::LDAP_SCOPE_SUB = 0

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

Referenced by ilLDAPSettingsGUI\initForm(), and ilLDAPQuery\queryByScope().


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