ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLDAPServer Class Reference
+ Collaboration diagram for ilLDAPServer:

Public Member Functions

 __construct ($a_server_id=0)
 
 rotateFallbacks ()
 Rotate fallback urls in case of connect timeouts. More...
 
 getServerId ()
 
 enableAuthentication ($a_status)
 Enable authentication for this ldap server. More...
 
 isAuthenticationEnabled ()
 Check if authentication is enabled. More...
 
 setAuthenticationMapping ($a_map)
 Set mapped authentication mapping. More...
 
 getAuthenticationMapping ()
 Get authentication mode that is mapped. More...
 
 getAuthenticationMappingKey ()
 Get authentication mapping key Default is ldap. More...
 
 toggleActive ($a_status)
 
 isActive ()
 
 getUrl ()
 
 setUrl ($a_url)
 
 getUrlString ()
 
 doConnectionCheck ()
 Check ldap connection and do a fallback to the next server if no connection is possible. More...
 
 getName ()
 
 setName ($a_name)
 
 getVersion ()
 
 setVersion ($a_version)
 
 getBaseDN ()
 
 setBaseDN ($a_base_dn)
 
 isActiveReferrer ()
 
 toggleReferrer ($a_status)
 
 isActiveTLS ()
 
 toggleTLS ($a_status)
 
 getBindingType ()
 
 setBindingType ($a_type)
 
 getBindUser ()
 
 setBindUser ($a_user)
 
 getBindPassword ()
 
 setBindPassword ($a_password)
 
 getSearchBase ()
 
 setSearchBase ($a_search_base)
 
 getUserAttribute ()
 
 setUserAttribute ($a_user_attr)
 
 getFilter ()
 
 setFilter ($a_filter)
 
 getGroupDN ()
 
 setGroupDN ($a_value)
 
 getGroupFilter ()
 
 setGroupFilter ($a_value)
 
 getGroupMember ()
 
 setGroupMember ($a_value)
 
 getGroupName ()
 
 setGroupName ($a_value)
 
 getGroupNames ()
 Get group names as array. More...
 
 getGroupAttribute ()
 
 setGroupAttribute ($a_value)
 
 toggleMembershipOptional ($a_status)
 
 isMembershipOptional ()
 
 setGroupUserFilter ($a_filter)
 
 getGroupUserFilter ()
 
 enabledGroupMemberIsDN ()
 
 enableGroupMemberIsDN ($a_value)
 
 setGroupScope ($a_value)
 
 getGroupScope ()
 
 setUserScope ($a_value)
 
 getUserScope ()
 
 enabledSyncOnLogin ()
 
 enableSyncOnLogin ($a_value)
 
 enabledSyncPerCron ()
 
 enableSyncPerCron ($a_value)
 
 setGlobalRole ($a_role)
 
 getRoleBindDN ()
 
 setRoleBindDN ($a_value)
 
 getRoleBindPassword ()
 
 setRoleBindPassword ($a_value)
 
 enabledRoleSynchronization ()
 
 enableRoleSynchronization ($a_value)
 
 getUsernameFilter ()
 
 setUsernameFilter ($a_value)
 
 enableAccountMigration ($a_status)
 Enable account migration. More...
 
 isAccountMigrationEnabled ()
 enabled account migration More...
 
 validate ()
 Validate user input. More...
 
 create ()
 
 update ()
 
 delete ()
 delete More...
 
 toPearAuthArray ()
 Creates an array of options compatible to PEAR Auth. More...
 

Static Public Member Functions

static getInstanceByServerId ($a_server_id)
 Get instance by server id. More...
 
static checkLDAPLib ()
 Check if ldap module is installed. More...
 
static _getActiveServerList ()
 Get active server list. More...
 
static _getCronServerIds ()
 Get list of acticve servers with option 'SyncCron'. More...
 
static _getRoleSyncServerIds ()
 Check whether there if there is an active server with option role_sync_active. More...
 
static _getPasswordServers ()
 Checks whether password synchronistation is enabled for an user. More...
 
static _getFirstActiveServer ()
 Get first active server. More...
 
static _getServerList ()
 Get list of all configured servers. More...
 
static getServerIds ()
 Get all server ids @global ilDB $ilDB. More...
 
static _getAllServer ()
 Get list of all configured servers. More...
 
static _getFirstServer ()
 
static getAvailableDataSources ($a_auth_mode)
 
static isDataSourceActive ($a_auth_mode)
 Check if a data source is active for a specific auth mode @global ilDB $ilDB. More...
 
static getDataSource ($a_auth_mode)
 
static disableDataSourceForAuthMode ($a_authmode)
 Disable data source. More...
 
static toggleDataSource ($a_ldap_server_id, $a_auth_mode, $a_status)
 Toggle Data Source. More...
 
static isAuthModeLDAP ($a_auth_mode)
 Check if user auth mode is LDAP. More...
 
static getServerIdByAuthMode ($a_auth_mode)
 Get auth id by auth mode. More...
 
static getAuthModeByKey ($a_auth_key)
 get auth mode by key More...
 
static getKeyByAuthMode ($a_auth_mode)
 Get auth id by auth mode. More...
 

Data Fields

const DEBUG = false
 
const DEFAULT_VERSION = 3
 
const DEFAULT_NETWORK_TIMEOUT = 5
 

Private Member Functions

 prepareFilter ($a_filter)
 Create brackets for filters if they do not exist. More...
 
 getPearAtributeArray ()
 Get attribute array for pear auth data. More...
 
 read ()
 Read server settings. More...
 

Private Attributes

 $role_bind_dn = ''
 
 $role_bind_pass = ''
 
 $role_sync_active = 0
 
 $server_id = null
 
 $fallback_urls = array()
 
 $enabled_authentication = true
 
 $authentication_mapping = 0
 

Static Private Attributes

static $instances = array()
 

Detailed Description

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

@ilCtrl_Calls

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

Constructor & Destructor Documentation

◆ __construct()

ilLDAPServer::__construct (   $a_server_id = 0)

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

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

References $ilDB, $lng, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getActiveServerList()

static ilLDAPServer::_getActiveServerList ( )
static

Get active server list.

Returns
array server ids of active ldap server

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

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

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

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

+ Here is the caller graph for this function:

◆ _getAllServer()

static ilLDAPServer::_getAllServer ( )
static

Get list of all configured servers.

Returns
array list of server

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

234 {
235 global $ilDB;
236
237 $query = "SELECT * FROM ldap_server_settings ORDER BY name";
238
239 $server = array();
240
241 $res = $ilDB->query($query);
242 while ($row = $ilDB->fetchAssoc($res)) {
243 $server[] = $row;
244 }
245 return $server;
246 }
$server
Definition: getUserInfo.php:12

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

Referenced by ilLDAPServerTableGUI\importData().

+ Here is the caller graph for this function:

◆ _getCronServerIds()

static ilLDAPServer::_getCronServerIds ( )
static

Get list of acticve servers with option 'SyncCron'.

Returns
array server ids of active ldap server

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

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

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

Referenced by ilLDAPCronSynchronization\run().

+ Here is the caller graph for this function:

◆ _getFirstActiveServer()

static ilLDAPServer::_getFirstActiveServer ( )
static

Get first active server.

Returns
int first active server

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

181 {
183 if (count($servers)) {
184 return $servers[0];
185 }
186 return 0;
187 }
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:

◆ _getFirstServer()

static ilLDAPServer::_getFirstServer ( )
static

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

254 {
255 $servers = ilLDAPServer::_getServerList();
256
257 if (count($servers)) {
258 return $servers[0];
259 }
260 return 0;
261 }
static _getServerList()
Get list of all configured servers.

References _getServerList().

+ Here is the call graph for this function:

◆ _getPasswordServers()

static ilLDAPServer::_getPasswordServers ( )
static

Checks whether password synchronistation is enabled for an user.

@access public

Parameters
intuser_id

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

170 {
172 }

References _getActiveServerList().

+ Here is the call graph for this function:

◆ _getRoleSyncServerIds()

static ilLDAPServer::_getRoleSyncServerIds ( )
static

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

@access public

Parameters

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

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

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

Referenced by ilLDAPRoleGroupMapping\initServers().

+ Here is the caller graph for this function:

◆ _getServerList()

static ilLDAPServer::_getServerList ( )
static

Get list of all configured servers.

Returns
array list of server ids

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

195 {
196 global $ilDB;
197
198 $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
199
200 $res = $ilDB->query($query);
201 while ($row = $ilDB->fetchObject($res)) {
202 $server_ids[] = $row->server_id;
203 }
204 return $server_ids ? $server_ids : array();
205 }

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

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

+ Here is the caller graph for this function:

◆ checkLDAPLib()

static ilLDAPServer::checkLDAPLib ( )
static

Check if ldap module is installed.

Returns

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

94 {
95 return function_exists('ldap_bind');
96 }

Referenced by ilLDAPSettingsGUI\serverList().

+ Here is the caller graph for this function:

◆ create()

ilLDAPServer::create ( )

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

833 {
834 global $ilDB;
835 // start Patch Name Filter remove ",username_filter", ",%s", ",$this->getUsernameFilter()"
836 $next_id = $ilDB->nextId('ldap_server_settings');
837
838 $query = 'INSERT INTO ldap_server_settings (server_id,active,name,url,version,base_dn,referrals,tls,bind_type,bind_user,bind_pass,' .
839 'search_base,user_scope,user_attribute,filter,group_dn,group_scope,group_filter,group_member,group_memberisdn,group_name,' .
840 'group_attribute,group_optional,group_user_filter,sync_on_login,sync_per_cron,role_sync_active,role_bind_dn,role_bind_pass,migration, ' .
841 'authentication,authentication_type,username_filter) ' .
842 '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)';
843 $res = $ilDB->queryF(
844 $query,
845 array(
846 'integer','integer','text','text','integer','text','integer','integer','integer','text','text','text','integer',
847 'text','text','text','integer','text','text','integer','text','text','integer','text','integer','integer','integer',
848 'text','text', 'integer','integer','integer',"text"),
849 array(
850 $next_id,
851 $this->isActive(),
852 $this->getName(),
853 $this->getUrlString(),
854 $this->getVersion(),
855 $this->getBaseDN(),
856 $this->isActiveReferrer(),
857 $this->isActiveTLS(),
858 $this->getBindingType(),
859 $this->getBindUser(),
860 $this->getBindPassword(),
861 $this->getSearchBase(),
862 $this->getUserScope(),
863 $this->getUserAttribute(),
864 $this->getFilter(),
865 $this->getGroupDN(),
866 $this->getGroupScope(),
867 $this->getGroupFilter(),
868 $this->getGroupMember(),
869 $this->enabledGroupMemberIsDN(),
870 $this->getGroupName(),
871 $this->getGroupAttribute(),
872 $this->isMembershipOptional(),
873 $this->getGroupUserFilter(),
874 $this->enabledSyncOnLogin(),
875 $this->enabledSyncPerCron(),
877 $this->getRoleBindDN(),
878 $this->getRoleBindPassword(),
882 $this->getUsernameFilter()
883 )
884 );
885 // end Patch Name Filter
886 $this->server_id = $next_id;
887 return $next_id;
888 }
isAuthenticationEnabled()
Check if authentication is enabled.
getAuthenticationMapping()
Get authentication mode that is mapped.
isAccountMigrationEnabled()
enabled account migration

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

+ Here is the call graph for this function:

◆ delete()

ilLDAPServer::delete ( )

delete

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

939 {
940 if (!$this->getServerId()) {
941 return false;
942 }
943
944 include_once 'Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
946
947 include_once 'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
949
950 foreach ($rules as $ruleAssigment) {
951 $ruleAssigment->delete();
952 }
953
954 include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
956
957 $query = "DELETE FROM ldap_server_settings " .
958 "WHERE server_id = " . $this->db->quote($this->getServerId(), 'integer');
959 $res = $this->db->manipulate($query);
960 }
static _delete($a_server_id)
Delete mapping rules by server id.
static _getRules($a_server_id)
Get all rules.

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

+ Here is the call graph for this function:

◆ disableDataSourceForAuthMode()

static ilLDAPServer::disableDataSourceForAuthMode (   $a_authmode)
static

Disable data source.

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

319 {
320 global $ilDB;
321
322 $query = 'UPDATE ldap_server_settings ' .
323 'SET authentication_type = ' . $ilDB->quote(0, 'integer') . ' ' .
324 'WHERE authentication_type = ' . $ilDB->quote($a_authmode, 'integer');
325 $ilDB->manipulate($query);
326 return true;
327 }

References $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ doConnectionCheck()

ilLDAPServer::doConnectionCheck ( )

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

@access public

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

510 {
511 include_once('Services/LDAP/classes/class.ilLDAPQuery.php');
512
513 foreach (array_merge(array(0 => $this->url), $this->fallback_urls) as $url) {
514 try {
515 ilLoggerFactory::getLogger('auth')->debug('Using url: ' . $url);
516 // Need to do a full bind, since openldap return valid connection links for invalid hosts
517 $query = new ilLDAPQuery($this, $url);
519 $this->url = $url;
520 return true;
521 } catch (ilLDAPQueryException $exc) {
522 $this->rotateFallbacks();
523 ilLoggerFactory::getLogger('auth')->error('Cannot connect to LDAP server: ' . $url . ' ' . $exc->getCode() . ' ' . $exc->getMessage());
524 }
525 }
526 ilLoggerFactory::getLogger('auth')->warning('No valid LDAP server found');
527 return false;
528 }
const IL_LDAP_BIND_TEST
rotateFallbacks()
Rotate fallback urls in case of connect timeouts.
static getLogger($a_component_id)
Get component logger.
$url

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

+ Here is the call graph for this function:

◆ enableAccountMigration()

ilLDAPServer::enableAccountMigration (   $a_status)

Enable account migration.

@access public

Parameters
boolstatus

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

784 {
785 $this->account_migration = $a_status;
786 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableAuthentication()

ilLDAPServer::enableAuthentication (   $a_status)

Enable authentication for this ldap server.

Parameters
bool$a_status

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

421 {
422 $this->enabled_authentication = (bool) $a_status;
423 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enabledGroupMemberIsDN()

ilLDAPServer::enabledGroupMemberIsDN ( )

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

699 {
700 return (bool) $this->memberisdn;
701 }

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

+ Here is the caller graph for this function:

◆ enabledRoleSynchronization()

ilLDAPServer::enabledRoleSynchronization ( )

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

759 {
761 }

References $role_sync_active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ enabledSyncOnLogin()

ilLDAPServer::enabledSyncOnLogin ( )

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

723 {
724 return $this->sync_on_login;
725 }

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

+ Here is the caller graph for this function:

◆ enabledSyncPerCron()

ilLDAPServer::enabledSyncPerCron ( )

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

731 {
732 return $this->sync_per_cron;
733 }

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

+ Here is the caller graph for this function:

◆ enableGroupMemberIsDN()

ilLDAPServer::enableGroupMemberIsDN (   $a_value)

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

703 {
704 $this->memberisdn = (bool) $a_value;
705 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableRoleSynchronization()

ilLDAPServer::enableRoleSynchronization (   $a_value)

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

763 {
764 $this->role_sync_active = $a_value;
765 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncOnLogin()

ilLDAPServer::enableSyncOnLogin (   $a_value)

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

727 {
728 $this->sync_on_login = (int) $a_value;
729 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableSyncPerCron()

ilLDAPServer::enableSyncPerCron (   $a_value)

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

735 {
736 $this->sync_per_cron = (int) $a_value;
737 }

Referenced by read().

+ Here is the caller graph for this function:

◆ getAuthenticationMapping()

ilLDAPServer::getAuthenticationMapping ( )

Get authentication mode that is mapped.

Returns
int

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

448 {
450 }

References $authentication_mapping.

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

+ Here is the caller graph for this function:

◆ getAuthenticationMappingKey()

ilLDAPServer::getAuthenticationMappingKey ( )

Get authentication mapping key Default is ldap.

Returns
string

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

458 {
459 if ($this->isAuthenticationEnabled() or !$this->getAuthenticationMapping()) {
460 // begin-patch ldap_multiple
461 return 'ldap_' . $this->getServerId();
462 #return 'ldap';
463 // end-patch ldap_multiple
464 }
466 }
static _getAuthModeName($a_auth_key)

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

+ Here is the call graph for this function:

◆ getAuthModeByKey()

static ilLDAPServer::getAuthModeByKey (   $a_auth_key)
static

get auth mode by key

Parameters
type$a_auth_key

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

386 {
387 $auth_arr = explode('_', $a_auth_key);
388 if (count((array) $auth_arr) > 1) {
389 return 'ldap_' . $auth_arr[1];
390 }
391 return 'ldap';
392 }

Referenced by ilAuthUtils\_getAuthModeName().

+ Here is the caller graph for this function:

◆ getAvailableDataSources()

static ilLDAPServer::getAvailableDataSources (   $a_auth_mode)
static

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

265 {
266 global $ilDB;
267
268 $query = "SELECT server_id FROM ldap_server_settings " .
269 "WHERE active = " . $ilDB->quote(1, 'integer') . " " .
270 "AND authentication = " . $ilDB->quote(0, 'integer') . " " .
271 "AND ( authentication_type = " . $ilDB->quote($a_auth_mode, 'integer') . " " .
272 "OR authentication_type = " . $ilDB->quote(0, 'integer') . ")";
273 $res = $ilDB->query($query);
274
275 $server_ids = array();
276 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
277 $server_ids[] = $row->server_id;
278 }
279 return $server_ids;
280 }

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

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

+ Here is the caller graph for this function:

◆ getBaseDN()

ilLDAPServer::getBaseDN ( )

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

548 {
549 return $this->base_dn;
550 }

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

+ Here is the caller graph for this function:

◆ getBindingType()

ilLDAPServer::getBindingType ( )

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

572 {
573 return $this->binding_type;
574 }

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

+ Here is the caller graph for this function:

◆ getBindPassword()

ilLDAPServer::getBindPassword ( )

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

592 {
593 return $this->bind_password;
594 }

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

+ Here is the caller graph for this function:

◆ getBindUser()

ilLDAPServer::getBindUser ( )

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

584 {
585 return $this->bind_user;
586 }

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

+ Here is the caller graph for this function:

◆ getDataSource()

static ilLDAPServer::getDataSource (   $a_auth_mode)
static

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

303 {
304 global $ilDB;
305
306 $query = "SELECT server_id FROM ldap_server_settings " .
307 "WHERE authentication_type = " . $ilDB->quote($a_auth_mode, 'integer') . " ";
308 $res = $ilDB->query($query);
309 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
310 return $row->server_id;
311 }
312 return 0;
313 }

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

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

+ Here is the caller graph for this function:

◆ getFilter()

ilLDAPServer::getFilter ( )

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

616 {
617 return $this->prepareFilter($this->filter);
618 }
prepareFilter($a_filter)
Create brackets for filters if they do not exist.

References prepareFilter().

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

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

◆ getGroupAttribute()

ilLDAPServer::getGroupAttribute ( )

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

673 {
674 return $this->group_attribute;
675 }

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

+ Here is the caller graph for this function:

◆ getGroupDN()

ilLDAPServer::getGroupDN ( )

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

624 {
625 return $this->group_dn;
626 }

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

+ Here is the caller graph for this function:

◆ getGroupFilter()

ilLDAPServer::getGroupFilter ( )

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

632 {
633 return $this->prepareFilter($this->group_filter);
634 }

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

640 {
641 return $this->group_member;
642 }

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

+ Here is the caller graph for this function:

◆ getGroupName()

ilLDAPServer::getGroupName ( )

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

648 {
649 return $this->group_name;
650 }

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

661 {
662 $names = explode(',', $this->getGroupName());
663
664 if (!is_array($names)) {
665 return array();
666 }
667
668 return array_filter(array_map('trim', $names));
669 }

References $names, and getGroupName().

+ Here is the call graph for this function:

◆ getGroupScope()

ilLDAPServer::getGroupScope ( )

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

711 {
712 return $this->group_scope;
713 }

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

+ Here is the caller graph for this function:

◆ getGroupUserFilter()

ilLDAPServer::getGroupUserFilter ( )

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

694 {
695 return $this->group_user_filter;
696 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getInstanceByServerId()

◆ getKeyByAuthMode()

static ilLDAPServer::getKeyByAuthMode (   $a_auth_mode)
static

Get auth id by auth mode.

Parameters
string$a_auth_mode
Returns
int auth_mode

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

400 {
401 $auth_arr = explode('_', $a_auth_mode);
402 if (count((array) $auth_arr) > 1) {
403 return AUTH_LDAP . '_' . $auth_arr[1];
404 }
405 return AUTH_LDAP;
406 }
const AUTH_LDAP

References AUTH_LDAP.

Referenced by ilAuthUtils\_getAuthMode().

+ Here is the caller graph for this function:

◆ getName()

ilLDAPServer::getName ( )

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

532 {
533 return $this->name;
534 }
if($format !==null) $name
Definition: metadata.php:146

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.

@access private

Parameters

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

1054 {
1055 if ($this->enabledSyncOnLogin()) {
1056 include_once('Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
1057 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
1059 return array_merge(
1060 array($this->getUserAttribute()),
1061 $mapping->getFields(),
1062 array('dn'),
1064 );
1065 } else {
1066 return array($this->getUserAttribute());
1067 }
1068 }
static _getInstanceByServerId($a_server_id)
Get instance of class.
static getAttributeNames($a_server_id)
get all possible attribute names

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

Referenced by toPearAuthArray().

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

◆ getRoleBindDN()

ilLDAPServer::getRoleBindDN ( )

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

743 {
744 return $this->role_bind_dn;
745 }

References $role_bind_dn.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getRoleBindPassword()

ilLDAPServer::getRoleBindPassword ( )

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

751 {
753 }

References $role_bind_pass.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getSearchBase()

ilLDAPServer::getSearchBase ( )

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

600 {
601 return $this->search_base;
602 }

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

+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPServer::getServerId ( )

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

412 {
413 return $this->server_id;
414 }

References $server_id.

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

+ Here is the caller graph for this function:

◆ getServerIdByAuthMode()

static ilLDAPServer::getServerIdByAuthMode (   $a_auth_mode)
static

Get auth id by auth mode.

Parameters
type$a_auth_mode
Returns
null

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

373 {
374 if (self::isAuthModeLDAP($a_auth_mode)) {
375 $auth_arr = explode('_', $a_auth_mode);
376 return $auth_arr[1];
377 }
378 return null;
379 }

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

Returns
array int

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

213 {
214 global $ilDB;
215
216 $query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
217
218
219 $res = $ilDB->query($query);
220
221 $server = array();
222 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
223 $server[] = $row->server_id;
224 }
225 return $server;
226 }

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

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

+ Here is the caller graph for this function:

◆ getUrl()

ilLDAPServer::getUrl ( )

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

477 {
478 return $this->url;
479 }

References $url.

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

+ Here is the caller graph for this function:

◆ getUrlString()

ilLDAPServer::getUrlString ( )

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

498 {
499 return $this->url_string;
500 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserAttribute()

ilLDAPServer::getUserAttribute ( )

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

608 {
609 return $this->user_attribute;
610 }

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

+ Here is the caller graph for this function:

◆ getUsernameFilter()

ilLDAPServer::getUsernameFilter ( )

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

768 {
769 return $this->username_filter;
770 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserScope()

ilLDAPServer::getUserScope ( )

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

719 {
720 return $this->user_scope;
721 }

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

+ Here is the caller graph for this function:

◆ getVersion()

ilLDAPServer::getVersion ( )

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

540 {
541 return $this->version ? $this->version : self::DEFAULT_VERSION;
542 }

References DEFAULT_VERSION.

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

+ Here is the caller graph for this function:

◆ isAccountMigrationEnabled()

ilLDAPServer::isAccountMigrationEnabled ( )

enabled account migration

@access public

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

795 {
796 return $this->account_migration ? true : false;
797 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActive()

ilLDAPServer::isActive ( )

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

473 {
474 return $this->active;
475 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ isActiveReferrer()

ilLDAPServer::isActiveReferrer ( )

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

556 {
557 return $this->referrals ? true : false;
558 }

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

+ Here is the caller graph for this function:

◆ isActiveTLS()

ilLDAPServer::isActiveTLS ( )

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

564 {
565 return $this->tls ? true : false;
566 }

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

+ Here is the caller graph for this function:

◆ isAuthenticationEnabled()

ilLDAPServer::isAuthenticationEnabled ( )

Check if authentication is enabled.

Returns
bool

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

430 {
431 return (bool) $this->enabled_authentication;
432 }

References $enabled_authentication.

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

+ Here is the caller graph for this function:

◆ isAuthModeLDAP()

static ilLDAPServer::isAuthModeLDAP (   $a_auth_mode)
static

Check if user auth mode is LDAP.

Parameters
type$a_auth_mode

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

358 {
359 if (!$a_auth_mode) {
360 $GLOBALS['ilLog']->write(__METHOD__ . ': No auth mode given..............');
361 return false;
362 }
363 $auth_arr = explode('_', $a_auth_mode);
364 return ($auth_arr[0] == AUTH_LDAP) and $auth_arr[1];
365 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, and AUTH_LDAP.

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

+ Here is the caller graph for this function:

◆ isDataSourceActive()

static ilLDAPServer::isDataSourceActive (   $a_auth_mode)
static

Check if a data source is active for a specific auth mode @global ilDB $ilDB.

Parameters
int$a_auth_mode
Returns
bool

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

289 {
290 global $ilDB;
291
292 $query = "SELECT server_id FROM ldap_server_settings " .
293 "WHERE authentication_type = " . $ilDB->quote($a_auth_mode, 'integer') . " " .
294 "AND authentication = " . $ilDB->quote(0, 'integer');
295 $res = $ilDB->query($query);
296 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
297 return true;
298 }
299 return false;
300 }

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

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

+ Here is the caller graph for this function:

◆ isMembershipOptional()

ilLDAPServer::isMembershipOptional ( )

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

686 {
687 return (bool) $this->group_optional;
688 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ prepareFilter()

ilLDAPServer::prepareFilter (   $a_filter)
private

Create brackets for filters if they do not exist.

@access private

Parameters
stringfilter

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

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

Referenced by getFilter(), and getGroupFilter().

+ Here is the caller graph for this function:

◆ read()

ilLDAPServer::read ( )
private

Read server settings.

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

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

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

Referenced by __construct().

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

◆ rotateFallbacks()

ilLDAPServer::rotateFallbacks ( )

Rotate fallback urls in case of connect timeouts.

Returns
boolean

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

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

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

Referenced by doConnectionCheck().

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

◆ setAuthenticationMapping()

ilLDAPServer::setAuthenticationMapping (   $a_map)

Set mapped authentication mapping.

Parameters
int$a_map

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

439 {
440 $this->authentication_mapping = $a_map;
441 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBaseDN()

ilLDAPServer::setBaseDN (   $a_base_dn)

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

552 {
553 $this->base_dn = $a_base_dn;
554 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindingType()

ilLDAPServer::setBindingType (   $a_type)

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

576 {
577 if ($a_type == IL_LDAP_BIND_USER) {
578 $this->binding_type = IL_LDAP_BIND_USER;
579 } else {
580 $this->binding_type = IL_LDAP_BIND_ANONYMOUS;
581 }
582 }
const IL_LDAP_BIND_USER
const IL_LDAP_BIND_ANONYMOUS
$a_type
Definition: workflow.php:92

References $a_type, IL_LDAP_BIND_ANONYMOUS, and IL_LDAP_BIND_USER.

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindPassword()

ilLDAPServer::setBindPassword (   $a_password)

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

596 {
597 $this->bind_password = $a_password;
598 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setBindUser()

ilLDAPServer::setBindUser (   $a_user)

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

588 {
589 $this->bind_user = $a_user;
590 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setFilter()

ilLDAPServer::setFilter (   $a_filter)

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

620 {
621 $this->filter = $a_filter;
622 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGlobalRole()

ilLDAPServer::setGlobalRole (   $a_role)

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

739 {
740 $this->global_role = $a_role;
741 }

◆ setGroupAttribute()

ilLDAPServer::setGroupAttribute (   $a_value)

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

677 {
678 $this->group_attribute = $a_value;
679 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupDN()

ilLDAPServer::setGroupDN (   $a_value)

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

628 {
629 $this->group_dn = $a_value;
630 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupFilter()

ilLDAPServer::setGroupFilter (   $a_value)

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

636 {
637 $this->group_filter = $a_value;
638 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupMember()

ilLDAPServer::setGroupMember (   $a_value)

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

644 {
645 $this->group_member = $a_value;
646 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupName()

ilLDAPServer::setGroupName (   $a_value)

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

652 {
653 $this->group_name = $a_value;
654 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupScope()

ilLDAPServer::setGroupScope (   $a_value)

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

707 {
708 $this->group_scope = $a_value;
709 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setGroupUserFilter()

ilLDAPServer::setGroupUserFilter (   $a_filter)

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

690 {
691 $this->group_user_filter = $a_filter;
692 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setName()

ilLDAPServer::setName (   $a_name)

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

536 {
537 $this->name = $a_name;
538 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindDN()

ilLDAPServer::setRoleBindDN (   $a_value)

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

747 {
748 $this->role_bind_dn = $a_value;
749 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRoleBindPassword()

ilLDAPServer::setRoleBindPassword (   $a_value)

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

755 {
756 $this->role_bind_pass = $a_value;
757 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSearchBase()

ilLDAPServer::setSearchBase (   $a_search_base)

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

604 {
605 $this->search_base = $a_search_base;
606 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUrl()

ilLDAPServer::setUrl (   $a_url)

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

481 {
482 $this->url_string = $a_url;
483
484 // Maybe there are more than one url's (comma seperated).
485 $urls = explode(',', $a_url);
486
487 $counter = 0;
488 foreach ($urls as $url) {
489 $url = trim($url);
490 if (!$counter++) {
491 $this->url = $url;
492 } else {
493 $this->fallback_urls[] = $url;
494 }
495 }
496 }
$counter
$urls
Definition: croninfo.php:28

References $counter, $url, and $urls.

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserAttribute()

ilLDAPServer::setUserAttribute (   $a_user_attr)

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

612 {
613 $this->user_attribute = $a_user_attr;
614 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUsernameFilter()

ilLDAPServer::setUsernameFilter (   $a_value)

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

772 {
773 $this->username_filter = $a_value;
774 }// end Patch Name Filter

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserScope()

ilLDAPServer::setUserScope (   $a_value)

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

715 {
716 $this->user_scope = $a_value;
717 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVersion()

ilLDAPServer::setVersion (   $a_version)

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

544 {
545 $this->version = $a_version;
546 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleActive()

ilLDAPServer::toggleActive (   $a_status)

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

469 {
470 $this->active = $a_status;
471 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleDataSource()

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

Toggle Data Source.

Todo:
handle multiple ldap servers
Parameters
int$a_auth_mode
int$a_status

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

338 {
339 global $ilDB;
340
342
343 if ($a_status) {
344 $query = "UPDATE ldap_server_settings " .
345 'SET authentication_type = ' . $ilDB->quote($a_auth_mode, 'integer') . " " .
346 'WHERE server_id = ' . $ilDB->quote($a_ldap_server_id, 'integer');
347 $ilDB->manipulate($query);
348 }
349 return true;
350 }
static disableDataSourceForAuthMode($a_authmode)
Disable data source.

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

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

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

◆ toggleMembershipOptional()

ilLDAPServer::toggleMembershipOptional (   $a_status)

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

682 {
683 $this->group_optional = (bool) $a_status;
684 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleReferrer()

ilLDAPServer::toggleReferrer (   $a_status)

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

560 {
561 $this->referrals = $a_status;
562 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleTLS()

ilLDAPServer::toggleTLS (   $a_status)

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

568 {
569 $this->tls = $a_status;
570 }

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

968 {
969 $options = array(
970 'url' => $this->getUrl(),
971 'version' => (int) $this->getVersion(),
972 'referrals' => (bool) $this->isActiveReferrer());
973
974 if ($this->getBindingType() == IL_LDAP_BIND_USER) {
975 $options['binddn'] = $this->getBindUser();
976 $options['bindpw'] = $this->getBindPassword();
977 }
978 $options['basedn'] = $this->getBaseDN();
979 $options['start_tls'] = (bool) $this->isActiveTLS();
980 $options['userdn'] = $this->getSearchBase();
981 switch ($this->getUserScope()) {
983 $options['userscope'] = 'one';
984 break;
985 default:
986 $options['userscope'] = 'sub';
987 break;
988 }
989
990 $options['userattr'] = $this->getUserAttribute();
991 $options['userfilter'] = $this->getFilter();
992 $options['attributes'] = $this->getPearAtributeArray();
993 $options['debug'] = self::DEBUG;
994
995 if (@include_once('Log.php')) {
996 if (@include_once('Log/observer.php')) {
997 $options['enableLogging'] = true;
998 }
999 }
1000 switch ($this->getGroupScope()) {
1001 case IL_LDAP_SCOPE_BASE:
1002 $options['groupscope'] = 'base';
1003 break;
1004 case IL_LDAP_SCOPE_ONE:
1005 $options['groupscope'] = 'one';
1006 break;
1007 default:
1008 $options['groupscope'] = 'sub';
1009 break;
1010 }
1011 $options['groupdn'] = $this->getGroupDN();
1012 $options['groupattr'] = $this->getGroupAttribute();
1013 $options['groupfilter'] = $this->getGroupFilter();
1014 $options['memberattr'] = $this->getGroupMember();
1015 $options['memberisdn'] = $this->enabledGroupMemberIsDN();
1016 $options['group'] = $this->getGroupName();
1017
1018
1019 return $options;
1020 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
const IL_LDAP_SCOPE_BASE
const IL_LDAP_SCOPE_ONE
getPearAtributeArray()
Get attribute array for pear auth data.

References $options, DEBUG, enabledGroupMemberIsDN(), getBaseDN(), getBindingType(), getBindPassword(), getBindUser(), getFilter(), getGroupAttribute(), getGroupDN(), getGroupFilter(), getGroupMember(), getGroupName(), getGroupScope(), getPearAtributeArray(), getSearchBase(), getUrl(), getUserAttribute(), getUserScope(), getVersion(), IL_LDAP_BIND_USER, IL_LDAP_SCOPE_BASE, IL_LDAP_SCOPE_ONE, isActiveReferrer(), and isActiveTLS().

+ Here is the call graph for this function:

◆ update()

ilLDAPServer::update ( )

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

891 {
892 global $ilDB;
893
894 $query = "UPDATE ldap_server_settings SET " .
895 "active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
896 "name = " . $this->db->quote($this->getName(), 'text') . ", " .
897 "url = " . $this->db->quote($this->getUrlString(), 'text') . ", " .
898 "version = " . $this->db->quote($this->getVersion(), 'integer') . ", " .
899 "base_dn = " . $this->db->quote($this->getBaseDN(), 'text') . ", " .
900 "referrals = " . $this->db->quote($this->isActiveReferrer(), 'integer') . ", " .
901 "tls = " . $this->db->quote($this->isActiveTLS(), 'integer') . ", " .
902 "bind_type = " . $this->db->quote($this->getBindingType(), 'integer') . ", " .
903 "bind_user = " . $this->db->quote($this->getBindUser(), 'text') . ", " .
904 "bind_pass = " . $this->db->quote($this->getBindPassword(), 'text') . ", " .
905 "search_base = " . $this->db->quote($this->getSearchBase(), 'text') . ", " .
906 "user_scope = " . $this->db->quote($this->getUserScope(), 'integer') . ", " .
907 "user_attribute = " . $this->db->quote($this->getUserAttribute(), 'text') . ", " .
908 "filter = " . $this->db->quote($this->getFilter(), 'text') . ", " .
909 "group_dn = " . $this->db->quote($this->getGroupDN(), 'text') . ", " .
910 "group_scope = " . $this->db->quote($this->getGroupScope(), 'integer') . ", " .
911 "group_filter = " . $this->db->quote($this->getGroupFilter(), 'text') . ", " .
912 "group_member = " . $this->db->quote($this->getGroupMember(), 'text') . ", " .
913 "group_memberisdn =" . $this->db->quote((int) $this->enabledGroupMemberIsDN(), 'integer') . ", " .
914 "group_name = " . $this->db->quote($this->getGroupName(), 'text') . ", " .
915 "group_attribute = " . $this->db->quote($this->getGroupAttribute(), 'text') . ", " .
916 "group_optional = " . $this->db->quote((int) $this->isMembershipOptional(), 'integer') . ", " .
917 "group_user_filter = " . $this->db->quote($this->getGroupUserFilter(), 'text') . ", " .
918 "sync_on_login = " . $this->db->quote(($this->enabledSyncOnLogin() ? 1 : 0), 'integer') . ", " .
919 "sync_per_cron = " . $this->db->quote(($this->enabledSyncPerCron() ? 1 : 0), 'integer') . ", " .
920 "role_sync_active = " . $this->db->quote($this->enabledRoleSynchronization(), 'integer') . ", " .
921 "role_bind_dn = " . $this->db->quote($this->getRoleBindDN(), 'text') . ", " .
922 "role_bind_pass = " . $this->db->quote($this->getRoleBindPassword(), 'text') . ", " .
923 "migration = " . $this->db->quote((int) $this->isAccountMigrationEnabled(), 'integer') . ", " .
924 'authentication = ' . $this->db->quote((int) $this->isAuthenticationEnabled(), 'integer') . ', ' .
925 'authentication_type = ' . $this->db->quote((int) $this->getAuthenticationMapping(), 'integer') . ' ' .
926 // start Patch Name Filter
927 ", username_filter = " . $this->db->quote($this->getUsernameFilter(), "text") . " " .
928 // end Patch Name Filter
929 "WHERE server_id = " . $this->db->quote($this->getServerId(), 'integer');
930
931 $res = $ilDB->manipulate($query);
932 return true;
933 }

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

+ Here is the call graph for this function:

◆ validate()

ilLDAPServer::validate ( )

Validate user input.

Parameters

return boolean

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

806 {
807 global $ilErr;
808
809 $ilErr->setMessage('');
810 if (!strlen($this->getName()) ||
811 !strlen($this->getUrl()) ||
812 !strlen($this->getBaseDN()) ||
813 !strlen($this->getUserAttribute())) {
814 $ilErr->setMessage($this->lng->txt('fill_out_all_required_fields'));
815 }
816
817 if ($this->getBindingType() == IL_LDAP_BIND_USER
818 && (!strlen($this->getBindUser()) || !strlen($this->getBindPassword()))) {
819 $ilErr->appendMessage($this->lng->txt('ldap_missing_bind_user'));
820 }
821
822 if (($this->enabledSyncPerCron() or $this->enabledSyncOnLogin()) and !$this->global_role) {
823 $ilErr->appendMessage($this->lng->txt('ldap_missing_role_assignment'));
824 }
825 if ($this->getVersion() == 2 and $this->isActiveTLS()) {
826 $ilErr->appendMessage($this->lng->txt('ldap_tls_conflict'));
827 }
828
829 return strlen($ilErr->getMessage()) ? false : true;
830 }
global $ilErr
Definition: raiseError.php:16

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

+ Here is the call graph for this function:

Field Documentation

◆ $authentication_mapping

ilLDAPServer::$authentication_mapping = 0
private

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

Referenced by getAuthenticationMapping().

◆ $enabled_authentication

ilLDAPServer::$enabled_authentication = true
private

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

Referenced by isAuthenticationEnabled().

◆ $fallback_urls

ilLDAPServer::$fallback_urls = array()
private

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

◆ $instances

ilLDAPServer::$instances = array()
staticprivate

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

◆ $role_bind_dn

ilLDAPServer::$role_bind_dn = ''
private

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

Referenced by getRoleBindDN().

◆ $role_bind_pass

ilLDAPServer::$role_bind_pass = ''
private

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

Referenced by getRoleBindPassword().

◆ $role_sync_active

ilLDAPServer::$role_sync_active = 0
private

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

Referenced by enabledRoleSynchronization().

◆ $server_id

ilLDAPServer::$server_id = null
private

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

Referenced by getServerId().

◆ DEBUG

const ilLDAPServer::DEBUG = false

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

Referenced by toPearAuthArray().

◆ DEFAULT_NETWORK_TIMEOUT

const ilLDAPServer::DEFAULT_NETWORK_TIMEOUT = 5

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

Referenced by ilLDAPQuery\bind().

◆ DEFAULT_VERSION

const ilLDAPServer::DEFAULT_VERSION = 3

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

Referenced by getVersion().


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