ILIAS  release_8 Revision v8.24
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: feed.php:28

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

References $DIC, $ilDB, $query, $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
int[] list of server

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

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

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

Referenced by ilLDAPServerTableGUI\importData().

+ Here is the caller graph for this function:

◆ _getCronServerIds()

static ilLDAPServer::_getCronServerIds ( )
static

Get list of acticve servers with option 'SyncCron'.

Returns
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, $query, $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(), and ilAuthLoginPageEditorGUI\initLoginForm().

+ 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, $query, $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, $query, 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\serverList().

+ Here is the caller graph for this function:

◆ create()

ilLDAPServer::create ( )

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

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

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

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

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

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

References $DIC, $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ doConnectionCheck()

ilLDAPServer::doConnectionCheck ( )

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

@access public

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

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

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

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

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ enabledEscapeDN()

ilLDAPServer::enabledEscapeDN ( )

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

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

References $escape_dn.

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

+ Here is the caller graph for this function:

◆ enabledGroupMemberIsDN()

ilLDAPServer::enabledGroupMemberIsDN ( )

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

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

References $memberisdn.

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

+ Here is the caller graph for this function:

◆ enabledRoleSynchronization()

ilLDAPServer::enabledRoleSynchronization ( )

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

774 : bool
775 {
777 }

References $role_sync_active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ enabledSyncOnLogin()

ilLDAPServer::enabledSyncOnLogin ( )

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

738 : bool
739 {
741 }

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

746 : bool
747 {
749 }

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ enableGroupMemberIsDN()

ilLDAPServer::enableGroupMemberIsDN ( bool  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ enableRoleSynchronization()

ilLDAPServer::enableRoleSynchronization ( bool  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncOnLogin()

ilLDAPServer::enableSyncOnLogin ( bool  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncPerCron()

ilLDAPServer::enableSyncPerCron ( bool  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ getAuthenticationMapping()

ilLDAPServer::getAuthenticationMapping ( )

Get authentication mode that is mapped.

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

470 : int
471 {
473 }

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

479 : string
480 {
481 if ($this->isAuthenticationEnabled() || !$this->getAuthenticationMapping()) {
482 return 'ldap_' . $this->getServerId();
483 }
485 }
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 415 of file class.ilLDAPServer.php.

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

Referenced by ilAuthUtils\_getAuthModeName().

+ Here is the caller graph for this function:

◆ getAvailableDataSources()

static ilLDAPServer::getAvailableDataSources ( int  $a_auth_mode)
static

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

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

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

Referenced by ilCASSettingsGUI\initFormSettings().

+ Here is the caller graph for this function:

◆ getBaseDN()

ilLDAPServer::getBaseDN ( )

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

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

References $base_dn.

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

+ Here is the caller graph for this function:

◆ getBindingType()

ilLDAPServer::getBindingType ( )

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

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

References $binding_type.

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

+ Here is the caller graph for this function:

◆ getBindPassword()

ilLDAPServer::getBindPassword ( )

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

608 : string
609 {
611 }

References $bind_password.

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

+ Here is the caller graph for this function:

◆ getBindUser()

ilLDAPServer::getBindUser ( )

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

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

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

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

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

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

+ Here is the caller graph for this function:

◆ getFilter()

ilLDAPServer::getFilter ( )

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

632 : string
633 {
634 return $this->prepareFilter($this->filter);
635 }
prepareFilter(string $a_filter)
Create brackets for filters if they do not exist.

References ILIAS\UI\examples\Symbol\Glyph\Filter\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 689 of file class.ilLDAPServer.php.

689 : string
690 {
692 }

References $group_attribute.

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

+ Here is the caller graph for this function:

◆ getGroupDN()

ilLDAPServer::getGroupDN ( )

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

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

References $group_dn.

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

+ Here is the caller graph for this function:

◆ getGroupFilter()

ilLDAPServer::getGroupFilter ( )

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

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

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

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

References $group_member.

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

+ Here is the caller graph for this function:

◆ getGroupName()

ilLDAPServer::getGroupName ( )

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

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

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

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

References getGroupName().

+ Here is the call graph for this function:

◆ getGroupScope()

ilLDAPServer::getGroupScope ( )

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

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

References $group_scope.

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

+ Here is the caller graph for this function:

◆ getGroupUserFilter()

ilLDAPServer::getGroupUserFilter ( )

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

709 : string
710 {
712 }

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

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

References ilAuthUtils\AUTH_LDAP.

Referenced by ilAuthUtils\_getAuthMode().

+ Here is the caller graph for this function:

◆ getName()

ilLDAPServer::getName ( )

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

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

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

1051 : array
1052 {
1053 if ($this->enabledSyncOnLogin()) {
1055 return array_merge(
1056 array($this->getUserAttribute()),
1057 $mapping->getFields(),
1058 array('dn'),
1060 );
1061 }
1062
1063 return array($this->getUserAttribute());
1064 }
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 758 of file class.ilLDAPServer.php.

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

References $role_bind_dn.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getRoleBindPassword()

ilLDAPServer::getRoleBindPassword ( )

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

766 : string
767 {
769 }

References $role_bind_pass.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getSearchBase()

ilLDAPServer::getSearchBase ( )

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

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

References $search_base.

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

+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPServer::getServerId ( )

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

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

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

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

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

+ Here is the caller graph for this function:

◆ getServerIds()

static ilLDAPServer::getServerIds ( )
static

Get all server ids.

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, $query, $res, $server, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilObjAuthSettingsGUI\getApacheAuthSettingsForm(), 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 495 of file class.ilLDAPServer.php.

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

References $url.

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

+ Here is the caller graph for this function:

◆ getUrlString()

ilLDAPServer::getUrlString ( )

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

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

References $url_string.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserAttribute()

ilLDAPServer::getUserAttribute ( )

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

624 : string
625 {
627 }

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

783 : string
784 {
786 }

References $username_filter.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserScope()

ilLDAPServer::getUserScope ( )

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

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

References $user_scope.

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

+ Here is the caller graph for this function:

◆ getVersion()

ilLDAPServer::getVersion ( )

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

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

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

813 : bool
814 {
816 }

References $account_migration.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActive()

ilLDAPServer::isActive ( )

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

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

References $active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActiveReferrer()

ilLDAPServer::isActiveReferrer ( )

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

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

References $referrals.

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

+ Here is the caller graph for this function:

◆ isActiveTLS()

ilLDAPServer::isActiveTLS ( )

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

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

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

454 : bool
455 {
457 }

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

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

References $DIC, and ilAuthUtils\AUTH_LDAP.

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

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

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

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

Referenced by ilAuthProviderCAS\doAuthentication(), and ilCASSettingsGUI\initFormSettings().

+ Here is the caller graph for this function:

◆ isMembershipOptional()

ilLDAPServer::isMembershipOptional ( )

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

701 : bool
702 {
704 }

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

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

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

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

Referenced by doConnectionCheck().

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

◆ setAuthenticationMapping()

ilLDAPServer::setAuthenticationMapping ( int  $a_map)

Set mapped authentication mapping.

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setBaseDN()

ilLDAPServer::setBaseDN ( string  $a_base_dn)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindingType()

ilLDAPServer::setBindingType ( int  $a_type)

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

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

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindUser()

ilLDAPServer::setBindUser ( string  $a_user)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setFilter()

ilLDAPServer::setFilter ( string  $a_filter)

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

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

References ILIAS\UI\examples\Symbol\Glyph\Filter\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 754 of file class.ilLDAPServer.php.

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

◆ setGroupAttribute()

ilLDAPServer::setGroupAttribute ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupDN()

ilLDAPServer::setGroupDN ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupFilter()

ilLDAPServer::setGroupFilter ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupMember()

ilLDAPServer::setGroupMember ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupName()

ilLDAPServer::setGroupName ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupScope()

ilLDAPServer::setGroupScope ( int  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupUserFilter()

ilLDAPServer::setGroupUserFilter ( string  $a_filter)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setName()

ilLDAPServer::setName ( string  $a_name)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindDN()

ilLDAPServer::setRoleBindDN ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindPassword()

ilLDAPServer::setRoleBindPassword ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setSearchBase()

ilLDAPServer::setSearchBase ( string  $a_search_base)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setUrl()

ilLDAPServer::setUrl ( string  $a_url)

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

499 : void
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 $url = trim($url);
509 if (!$counter++) {
510 $this->url = $url;
511 } else {
512 $this->fallback_urls[] = $url;
513 }
514 }
515 }

References $url.

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserAttribute()

ilLDAPServer::setUserAttribute ( string  $a_user_attr)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setUsernameFilter()

ilLDAPServer::setUsernameFilter ( string  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserScope()

ilLDAPServer::setUserScope ( int  $a_value)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion()

ilLDAPServer::setVersion ( int  $a_version)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleActive()

ilLDAPServer::toggleActive ( bool  $a_status)

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

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

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

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

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

Referenced by ilCASSettingsGUI\save().

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

◆ toggleMembershipOptional()

ilLDAPServer::toggleMembershipOptional ( bool  $a_status)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleReferrer()

ilLDAPServer::toggleReferrer ( bool  $a_status)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleTLS()

ilLDAPServer::toggleTLS ( bool  $a_status)

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

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

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

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

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

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

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

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: