ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLDAPServer Class Reference
+ Collaboration diagram for ilLDAPServer:

Public Member Functions

 __construct ($a_server_id=0)
 getServerId ()
 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.
 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.
 getGroupAttribute ()
 setGroupAttribute ($a_value)
 toggleMembershipOptional ($a_status)
 isMembershipOptional ()
 setGroupUserFilter ($a_filter)
 getGroupUserFilter ()
 enabledGroupMemberIsDN ()
 enableGroupMemberIsDN ($a_value)
 setGroupScope ($a_value)
 getGroupScope ()
 setUserScope ($a_value)
 getUserScope ()
 enabledSyncOnLogin ()
 enableSyncOnLogin ($a_value)
 enabledSyncPerCron ()
 enableSyncPerCron ($a_value)
 setGlobalRole ($a_role)
 getRoleBindDN ()
 setRoleBindDN ($a_value)
 getRoleBindPassword ()
 setRoleBindPassword ($a_value)
 enabledRoleSynchronization ()
 enableRoleSynchronization ($a_value)
 enableAccountMigration ($a_status)
 Enable account migration.
 isAccountMigrationEnabled ()
 enabled account migration
 validate ()
 Validate user input.
 create ()
 update ()
 toPearAuthArray ()
 Creates an array of options compatible to PEAR Auth.

Static Public Member Functions

static getInstanceByServerId ($a_server_id)
static checkLDAPLib ()
 Check if ldap module is installed.
static _getActiveServerList ()
 Get active server list.
static _getCronServerIds ()
 Get list of acticve servers with option 'SyncCron'.
static _getRoleSyncServerIds ()
 Check whether there if there is an active server with option role_sync_active.
static _getPasswordServers ()
 Checks whether password synchronistation is enabled for an user.
static _getFirstActiveServer ()
 Get first active server.
static _getServerList ()
 Get list of all configured servers.
static _getFirstServer ()

Data Fields

const DEBUG = false
const DEFAULT_VERSION = 3

Private Member Functions

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

Private Attributes

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

Static Private Attributes

static $instances = array()

Detailed Description

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

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

Constructor & Destructor Documentation

ilLDAPServer::__construct (   $a_server_id = 0)

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

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

{
global $ilDB,$lng;
$this->db = $ilDB;
$this->lng = $lng;
$this->server_id = $a_server_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilLDAPServer::_getActiveServerList ( )
static

Get active server list.

Returns
array server ids of active ldap server

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

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

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

{
global $ilDB;
$query = "SELECT server_id FROM ldap_server_settings ".
"WHERE active = 1 ".
"ORDER BY name ";
$res = $ilDB->query($query);
$server_ids = array();
while($row = $ilDB->fetchObject($res))
{
$server_ids[] = $row->server_id;
}
return $server_ids;
}

+ Here is the caller graph for this function:

static ilLDAPServer::_getCronServerIds ( )
static

Get list of acticve servers with option 'SyncCron'.

Returns
array server ids of active ldap server

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

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

Referenced by ilLDAPCronSynchronization\start().

{
global $ilDB;
$query = "SELECT server_id FROM ldap_server_settings ".
"WHERE active = 1 ".
"AND sync_per_cron = 1 ".
"ORDER BY name";
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$server_ids[] = $row->server_id;
}
return $server_ids ? $server_ids : array();
}

+ Here is the caller graph for this function:

static ilLDAPServer::_getFirstActiveServer ( )
static

Get first active server.

Returns
int first active server

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

References _getActiveServerList().

Referenced by ilAuthContainerLDAP\__construct(), ilAuthUtils\_getMultipleAuthModeOptions(), ilAuthContainerApache\fetchData(), ilLDAPRoleAssignmentRules\getDefaultRole(), ilObjAuthSettingsGUI\initLoginForm(), ilLDAPRoleAssignmentRule\isGroupMember(), and ilAuthModeDetermination\read().

{
if(count($servers))
{
return $servers[0];
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLDAPServer::_getFirstServer ( )
static

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

References _getServerList().

Referenced by ilLDAPSettingsGUI\initServer().

{
if(count($servers))
{
return $servers[0];
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLDAPServer::_getPasswordServers ( )
static

Checks whether password synchronistation is enabled for an user.

public

Parameters
intuser_id

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

References _getActiveServerList().

+ Here is the call graph for this function:

static ilLDAPServer::_getRoleSyncServerIds ( )
static

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

public

Parameters

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

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

Referenced by ilLDAPRoleGroupMapping\initServers().

{
global $ilDB;
$query = "SELECT server_id FROM ldap_server_settings ".
"WHERE active = 1 ".
"AND role_sync_active = 1 ";
$res = $ilDB->query($query);
$server_ids = array();
while($row = $ilDB->fetchObject($res))
{
$server_ids[] = $row->server_id;
}
return $server_ids;
}

+ Here is the caller graph for this function:

static ilLDAPServer::_getServerList ( )
static

Get list of all configured servers.

Returns
array list of server ids

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

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

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

{
global $ilDB;
$query = "SELECT server_id FROM ldap_server_settings ORDER BY name";
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$server_ids[] = $row->server_id;
}
return $server_ids ? $server_ids : array();
}

+ Here is the caller graph for this function:

static ilLDAPServer::checkLDAPLib ( )
static

Check if ldap module is installed.

Returns

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

Referenced by ilLDAPSettingsGUI\serverList().

{
return function_exists('ldap_bind');
}

+ Here is the caller graph for this function:

ilLDAPServer::create ( )

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

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

{
global $ilDB;
$next_id = $ilDB->nextId('ldap_server_settings');
$query = 'INSERT INTO ldap_server_settings (server_id,active,name,url,version,base_dn,referrals,tls,bind_type,bind_user,bind_pass,'.
'search_base,user_scope,user_attribute,filter,group_dn,group_scope,group_filter,group_member,group_memberisdn,group_name,'.
'group_attribute,group_optional,group_user_filter,sync_on_login,sync_per_cron,role_sync_active,role_bind_dn,role_bind_pass,migration) '.
'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)';
$res = $ilDB->queryF($query,
array(
'integer','integer','text','text','integer','text','integer','integer','integer','text','text','text','integer',
'text','text','text','integer','text','text','integer','text','text','integer','text','integer','integer','integer',
'text','text', 'integer'),
array(
$next_id,
$this->isActive(),
$this->getName(),
$this->getUrlString(),
$this->getVersion(),
$this->getBaseDN(),
$this->isActiveReferrer(),
$this->isActiveTLS(),
$this->getBindingType(),
$this->getBindUser(),
$this->getBindPassword(),
$this->getSearchBase(),
$this->getUserScope(),
$this->getUserAttribute(),
$this->getFilter(),
$this->getGroupDN(),
$this->getGroupScope(),
$this->getGroupFilter(),
$this->getGroupMember(),
$this->getGroupName(),
$this->getRoleBindDN(),
));
return $next_id;
}

+ Here is the call graph for this function:

ilLDAPServer::doConnectionCheck ( )

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

public

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

References $ilLog, and $query.

{
global $ilLog;
include_once('Services/LDAP/classes/class.ilLDAPQuery.php');
foreach(array_merge(array(0 => $this->url),$this->fallback_urls) as $url)
{
try
{
// Need to do a full bind, since openldap return valid connection links for invalid hosts
$query = new ilLDAPQuery($this,$url);
$query->bind();
$this->url = $url;
$ilLog->write(__METHOD__.': Using url: '.$url.'.');
return true;
}
{
$ilLog->write(__METHOD__.': Cannot connect to LDAP server: '.$url.'. Trying fallback...');
}
}
$ilLog->write(__METHOD__.': No valid LDAP server found.');
return false;
}
ilLDAPServer::enableAccountMigration (   $a_status)

Enable account migration.

public

Parameters
boolstatus

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

Referenced by read().

{
$this->account_migration = $a_status;
}

+ Here is the caller graph for this function:

ilLDAPServer::enabledGroupMemberIsDN ( )

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

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

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

+ Here is the caller graph for this function:

ilLDAPServer::enabledRoleSynchronization ( )

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

References $role_sync_active.

Referenced by create(), and update().

+ Here is the caller graph for this function:

ilLDAPServer::enabledSyncOnLogin ( )

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

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

{
return $this->sync_on_login;
}

+ Here is the caller graph for this function:

ilLDAPServer::enabledSyncPerCron ( )

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

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

{
return $this->sync_per_cron;
}

+ Here is the caller graph for this function:

ilLDAPServer::enableGroupMemberIsDN (   $a_value)

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

Referenced by read().

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

+ Here is the caller graph for this function:

ilLDAPServer::enableRoleSynchronization (   $a_value)

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

Referenced by read().

{
$this->role_sync_active = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::enableSyncOnLogin (   $a_value)

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

Referenced by read().

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

+ Here is the caller graph for this function:

ilLDAPServer::enableSyncPerCron (   $a_value)

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

Referenced by read().

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

+ Here is the caller graph for this function:

ilLDAPServer::getBaseDN ( )

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

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

{
return $this->base_dn;
}

+ Here is the caller graph for this function:

ilLDAPServer::getBindingType ( )

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

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

{
return $this->binding_type;
}

+ Here is the caller graph for this function:

ilLDAPServer::getBindPassword ( )

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

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

{
return $this->bind_password;
}

+ Here is the caller graph for this function:

ilLDAPServer::getBindUser ( )

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

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

{
return $this->bind_user;
}

+ Here is the caller graph for this function:

ilLDAPServer::getFilter ( )

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

References prepareFilter().

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

{
return $this->prepareFilter($this->filter);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPServer::getGroupAttribute ( )

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

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

{
return $this->group_attribute;
}

+ Here is the caller graph for this function:

ilLDAPServer::getGroupDN ( )

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

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

{
return $this->group_dn;
}

+ Here is the caller graph for this function:

ilLDAPServer::getGroupFilter ( )

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

References prepareFilter().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPServer::getGroupMember ( )

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

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

{
return $this->group_member;
}

+ Here is the caller graph for this function:

ilLDAPServer::getGroupName ( )

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

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

{
return $this->group_name;
}

+ Here is the caller graph for this function:

ilLDAPServer::getGroupNames ( )

Get group names as array.

public

Parameters

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

References getGroupName().

{
$names = explode(',',$this->getGroupName());
if(!is_array($names))
{
return array();
}
foreach($names as $name)
{
$new_names[] = trim($name);
}
return $new_names;
}

+ Here is the call graph for this function:

ilLDAPServer::getGroupScope ( )

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

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

{
return $this->group_scope;
}

+ Here is the caller graph for this function:

ilLDAPServer::getGroupUserFilter ( )

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

Referenced by create(), and update().

{
return $this->group_user_filter;
}

+ Here is the caller graph for this function:

static ilLDAPServer::getInstanceByServerId (   $a_server_id)
static

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

Referenced by ilLDAPRoleAssignmentRule\isGroupMember().

{
if(isset(self::$instances[$a_server_id]))
{
return self::$instances[$a_server_id];
}
return self::$instances[$a_server_id] = new ilLDAPServer($a_server_id);
}

+ Here is the caller graph for this function:

ilLDAPServer::getName ( )

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

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

{
return $this->name;
}

+ Here is the caller graph for this function:

ilLDAPServer::getPearAtributeArray ( )
private

Get attribute array for pear auth data.

private

Parameters

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

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

Referenced by toPearAuthArray().

{
if($this->enabledSyncOnLogin())
{
include_once('Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
return array_merge(
array($this->getUserAttribute()),
$mapping->getFields(),
array('dn'),
);
}
else
{
return array($this->getUserAttribute());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPServer::getRoleBindDN ( )

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

References $role_bind_dn.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilLDAPServer::getRoleBindPassword ( )

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

References $role_bind_pass.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilLDAPServer::getSearchBase ( )

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

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

{
return $this->search_base;
}

+ Here is the caller graph for this function:

ilLDAPServer::getServerId ( )

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

References $server_id.

Referenced by getPearAtributeArray(), and update().

{
}

+ Here is the caller graph for this function:

ilLDAPServer::getUrl ( )

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

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

{
return $this->url;
}

+ Here is the caller graph for this function:

ilLDAPServer::getUrlString ( )

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

Referenced by create(), and update().

{
return $this->url_string;
}

+ Here is the caller graph for this function:

ilLDAPServer::getUserAttribute ( )

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

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

{
return $this->user_attribute;
}

+ Here is the caller graph for this function:

ilLDAPServer::getUserScope ( )

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

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

{
return $this->user_scope;
}

+ Here is the caller graph for this function:

ilLDAPServer::getVersion ( )

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

References DEFAULT_VERSION.

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

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

+ Here is the caller graph for this function:

ilLDAPServer::isAccountMigrationEnabled ( )

enabled account migration

public

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

Referenced by create(), and update().

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

+ Here is the caller graph for this function:

ilLDAPServer::isActive ( )

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

Referenced by create(), and update().

{
return $this->active;
}

+ Here is the caller graph for this function:

ilLDAPServer::isActiveReferrer ( )

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

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

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

+ Here is the caller graph for this function:

ilLDAPServer::isActiveTLS ( )

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

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

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

+ Here is the caller graph for this function:

ilLDAPServer::isMembershipOptional ( )

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

Referenced by create(), and update().

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

+ Here is the caller graph for this function:

ilLDAPServer::prepareFilter (   $a_filter)
private

Create brackets for filters if they do not exist.

private

Parameters
stringfilter

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

Referenced by getFilter(), and getGroupFilter().

{
$filter = trim($a_filter);
if(!strlen($filter))
{
return $filter;
}
if(strpos($filter,'(') !== 0)
{
$filter = ('('.$filter);
}
if(substr($filter,-1) != ')')
{
$filter = ($filter.')');
}
return $filter;
}

+ Here is the caller graph for this function:

ilLDAPServer::read ( )
private

Read server settings.

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

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

Referenced by __construct().

{
if(!$this->server_id)
{
return true;
}
$query = "SELECT * FROM ldap_server_settings WHERE server_id = ".$this->db->quote($this->server_id)."";
# var_dump("<pre>",$query,"</pre>");
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->toggleActive($row->active);
$this->setName($row->name);
$this->setUrl($row->url);
$this->setVersion($row->version);
$this->setBaseDN($row->base_dn);
$this->toggleReferrer($row->referrals);
$this->toggleTLS($row->tls);
$this->setBindingType($row->bind_type);
$this->setBindUser($row->bind_user);
$this->setBindPassword($row->bind_pass);
$this->setSearchBase($row->search_base);
$this->setUserScope($row->user_scope);
$this->setUserAttribute($row->user_attribute);
$this->setFilter($row->filter);
$this->setGroupDN($row->group_dn);
$this->setGroupScope($row->group_scope);
$this->setGroupFilter($row->group_filter);
$this->setGroupMember($row->group_member);
$this->setGroupAttribute($row->group_attribute);
$this->toggleMembershipOptional($row->group_optional);
$this->setGroupUserFilter($row->group_user_filter);
$this->enableGroupMemberIsDN($row->group_memberisdn);
$this->setGroupName($row->group_name);
$this->enableSyncOnLogin($row->sync_on_login);
$this->enableSyncPerCron($row->sync_per_cron);
$this->enableRoleSynchronization($row->role_sync_active);
$this->setRoleBindDN($row->role_bind_dn);
$this->setRoleBindPassword($row->role_bind_pass);
$this->enableAccountMigration($row->migration);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPServer::setBaseDN (   $a_base_dn)

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

Referenced by read().

{
$this->base_dn = $a_base_dn;
}

+ Here is the caller graph for this function:

ilLDAPServer::setBindingType (   $a_type)

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

References IL_LDAP_BIND_ANONYMOUS, and IL_LDAP_BIND_USER.

Referenced by read().

{
if($a_type == IL_LDAP_BIND_USER)
{
$this->binding_type = IL_LDAP_BIND_USER;
}
else
{
$this->binding_type = IL_LDAP_BIND_ANONYMOUS;
}
}

+ Here is the caller graph for this function:

ilLDAPServer::setBindPassword (   $a_password)

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

Referenced by read().

{
$this->bind_password = $a_password;
}

+ Here is the caller graph for this function:

ilLDAPServer::setBindUser (   $a_user)

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

Referenced by read().

{
$this->bind_user = $a_user;
}

+ Here is the caller graph for this function:

ilLDAPServer::setFilter (   $a_filter)

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

Referenced by read().

{
$this->filter = $a_filter;
}

+ Here is the caller graph for this function:

ilLDAPServer::setGlobalRole (   $a_role)

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

{
$this->global_role = $a_role;
}
ilLDAPServer::setGroupAttribute (   $a_value)

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

Referenced by read().

{
$this->group_attribute = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setGroupDN (   $a_value)

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

Referenced by read().

{
$this->group_dn = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setGroupFilter (   $a_value)

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

Referenced by read().

{
$this->group_filter = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setGroupMember (   $a_value)

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

Referenced by read().

{
$this->group_member = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setGroupName (   $a_value)

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

Referenced by read().

{
$this->group_name = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setGroupScope (   $a_value)

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

Referenced by read().

{
$this->group_scope = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setGroupUserFilter (   $a_filter)

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

Referenced by read().

{
$this->group_user_filter = $a_filter;
}

+ Here is the caller graph for this function:

ilLDAPServer::setName (   $a_name)

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

Referenced by read().

{
$this->name = $a_name;
}

+ Here is the caller graph for this function:

ilLDAPServer::setRoleBindDN (   $a_value)

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

Referenced by read().

{
$this->role_bind_dn = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setRoleBindPassword (   $a_value)

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

Referenced by read().

{
$this->role_bind_pass = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setSearchBase (   $a_search_base)

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

Referenced by read().

{
$this->search_base = $a_search_base;
}

+ Here is the caller graph for this function:

ilLDAPServer::setUrl (   $a_url)

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

Referenced by read().

{
$this->url_string = $a_url;
// Maybe there are more than one url's (comma seperated).
$urls = explode(',',$a_url);
$counter = 0;
foreach($urls as $url)
{
$url = trim($url);
if(!$counter++)
{
$this->url = $url;
}
else
{
$this->fallback_urls[] = $url;
}
}
}

+ Here is the caller graph for this function:

ilLDAPServer::setUserAttribute (   $a_user_attr)

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

Referenced by read().

{
$this->user_attribute = $a_user_attr;
}

+ Here is the caller graph for this function:

ilLDAPServer::setUserScope (   $a_value)

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

Referenced by read().

{
$this->user_scope = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPServer::setVersion (   $a_version)

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

Referenced by read().

{
$this->version = $a_version;
}

+ Here is the caller graph for this function:

ilLDAPServer::toggleActive (   $a_status)

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

Referenced by read().

{
$this->active = $a_status;
}

+ Here is the caller graph for this function:

ilLDAPServer::toggleMembershipOptional (   $a_status)

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

Referenced by read().

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

+ Here is the caller graph for this function:

ilLDAPServer::toggleReferrer (   $a_status)

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

Referenced by read().

{
$this->referrals = $a_status;
}

+ Here is the caller graph for this function:

ilLDAPServer::toggleTLS (   $a_status)

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

Referenced by read().

{
$this->tls = $a_status;
}

+ Here is the caller graph for this function:

ilLDAPServer::toPearAuthArray ( )

Creates an array of options compatible to PEAR Auth.

Returns
array auth settings

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

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

{
$options = array(
'url' => $this->getUrl(),
'version' => (int) $this->getVersion(),
'referrals' => (bool) $this->isActiveReferrer());
{
$options['binddn'] = $this->getBindUser();
$options['bindpw'] = $this->getBindPassword();
}
$options['basedn'] = $this->getBaseDN();
$options['start_tls'] = (bool) $this->isActiveTLS();
$options['userdn'] = $this->getSearchBase();
switch($this->getUserScope())
{
$options['userscope'] = 'one';
break;
default:
$options['userscope'] = 'sub';
break;
}
$options['userattr'] = $this->getUserAttribute();
$options['userfilter'] = $this->getFilter();
$options['attributes'] = $this->getPearAtributeArray();
$options['debug'] = self::DEBUG;
if(@include_once('Log.php'))
{
if(@include_once('Log/observer.php'))
{
$options['enableLogging'] = true;
}
}
switch($this->getGroupScope())
{
$options['groupscope'] = 'base';
break;
$options['groupscope'] = 'one';
break;
default:
$options['groupscope'] = 'sub';
break;
}
$options['groupdn'] = $this->getGroupDN();
$options['groupattr'] = $this->getGroupAttribute();
$options['groupfilter'] = $this->getGroupFilter();
$options['memberattr'] = $this->getGroupMember();
$options['memberisdn'] = $this->enabledGroupMemberIsDN();
$options['group'] = $this->getGroupName();
return $options;
}

+ Here is the call graph for this function:

ilLDAPServer::update ( )

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

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

{
global $ilDB;
$query = "UPDATE ldap_server_settings SET ".
"active = ".$this->db->quote($this->isActive(),'integer').", ".
"name = ".$this->db->quote($this->getName(),'text').", ".
"url = ".$this->db->quote($this->getUrlString(),'text').", ".
"version = ".$this->db->quote($this->getVersion(),'integer').", ".
"base_dn = ".$this->db->quote($this->getBaseDN(),'text').", ".
"referrals = ".$this->db->quote($this->isActiveReferrer(),'integer').", ".
"tls = ".$this->db->quote($this->isActiveTLS(),'integer').", ".
"bind_type = ".$this->db->quote($this->getBindingType(),'integer').", ".
"bind_user = ".$this->db->quote($this->getBindUser(),'text').", ".
"bind_pass = ".$this->db->quote($this->getBindPassword(),'text').", ".
"search_base = ".$this->db->quote($this->getSearchBase(),'text').", ".
"user_scope = ".$this->db->quote($this->getUserScope(),'integer').", ".
"user_attribute = ".$this->db->quote($this->getUserAttribute(),'text').", ".
"filter = ".$this->db->quote($this->getFilter(),'text').", ".
"group_dn = ".$this->db->quote($this->getGroupDN(),'text').", ".
"group_scope = ".$this->db->quote($this->getGroupScope(),'integer').", ".
"group_filter = ".$this->db->quote($this->getGroupFilter(),'text').", ".
"group_member = ".$this->db->quote($this->getGroupMember(),'text').", ".
"group_memberisdn =".$this->db->quote((int) $this->enabledGroupMemberIsDN(),'integer').", ".
"group_name = ".$this->db->quote($this->getGroupName(),'text').", ".
"group_attribute = ".$this->db->quote($this->getGroupAttribute(),'text').", ".
"group_optional = ".$this->db->quote((int) $this->isMembershipOptional(),'integer').", ".
"group_user_filter = ".$this->db->quote($this->getGroupUserFilter(),'text').", ".
"sync_on_login = ".$this->db->quote(($this->enabledSyncOnLogin() ? 1 : 0),'integer').", ".
"sync_per_cron = ".$this->db->quote(($this->enabledSyncPerCron() ? 1 : 0),'integer').", ".
"role_sync_active = ".$this->db->quote($this->enabledRoleSynchronization(),'integer').", ".
"role_bind_dn = ".$this->db->quote($this->getRoleBindDN(),'text').", ".
"role_bind_pass = ".$this->db->quote($this->getRoleBindPassword(),'text').", ".
"migration = ".$this->db->quote((int)$this->isAccountMigrationEnabled(),'integer')." ".
"WHERE server_id = ".$this->db->quote($this->getServerId(),'integer');
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilLDAPServer::validate ( )

Validate user input.

Parameters
@returnboolean

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

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

{
global $ilErr;
$ilErr->setMessage('');
if(!strlen($this->getName()) ||
!strlen($this->getUrl()) ||
!strlen($this->getBaseDN()) ||
!strlen($this->getUserAttribute()))
{
$ilErr->setMessage($this->lng->txt('fill_out_all_required_fields'));
}
&& (!strlen($this->getBindUser()) || !strlen($this->getBindPassword())))
{
$ilErr->appendMessage($this->lng->txt('ldap_missing_bind_user'));
}
if(($this->enabledSyncPerCron() or $this->enabledSyncOnLogin()) and !$this->global_role)
{
$ilErr->appendMessage($this->lng->txt('ldap_missing_role_assignment'));
}
if($this->getVersion() == 2 and $this->isActiveTLS())
{
$ilErr->appendMessage($this->lng->txt('ldap_tls_conflict'));
}
return strlen($ilErr->getMessage()) ? false : true;
}

+ Here is the call graph for this function:

Field Documentation

ilLDAPServer::$fallback_urls = array()
private

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

ilLDAPServer::$instances = array()
staticprivate

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

ilLDAPServer::$role_bind_dn = ''
private

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

Referenced by getRoleBindDN().

ilLDAPServer::$role_bind_pass = ''
private

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

Referenced by getRoleBindPassword().

ilLDAPServer::$role_sync_active = 0
private

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

Referenced by enabledRoleSynchronization().

ilLDAPServer::$server_id = null
private

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

Referenced by getServerId().

const ilLDAPServer::DEBUG = false

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

Referenced by toPearAuthArray().

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: