ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLDAPCronSynchronization Class Reference
+ Collaboration diagram for ilLDAPCronSynchronization:

Public Member Functions

 __construct ()
 start ()
 Check for LDAP servers and synchronize them.

Private Member Functions

 deactivateUsers (ilLDAPServer $server, $a_ldap_users)
 Deactivate users that are disabled in LDAP.

Private Attributes

 $current_server = null
 $ldap_query = null
 $log = null

Detailed Description

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

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

Constructor & Destructor Documentation

ilLDAPCronSynchronization::__construct ( )

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

References $ilLog.

{
global $ilLog;
$this->log = $ilLog;
}

Member Function Documentation

ilLDAPCronSynchronization::deactivateUsers ( ilLDAPServer  $server,
  $a_ldap_users 
)
private

Deactivate users that are disabled in LDAP.

private

Definition at line 104 of file class.ilLDAPCronSynchronization.php.

References $usr_id, ilObjUser\_getExternalAccountsByAuthMode(), ilObjUser\_toggleActiveStatusOfUsers(), and ilLDAPServer\getAuthenticationMappingKey().

Referenced by start().

{
include_once './Services/User/classes/class.ilObjUser.php';
foreach($ext = ilObjUser::_getExternalAccountsByAuthMode($server->getAuthenticationMappingKey(),true) as $usr_id => $external_account)
{
if(!array_key_exists($external_account,$a_ldap_users))
{
$inactive[] = $usr_id;
}
}
if(count($inactive))
{
$this->log->write('LDAP: Found '.count($inactive).' inactive users.');
}
else
{
$this->log->write('LDAP: No inactive users found');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPCronSynchronization::start ( )

Check for LDAP servers and synchronize them.

public

Parameters

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

References ilLDAPServer\_getCronServerIds(), deactivateUsers(), and IL_LDAP_BIND_DEFAULT.

{
foreach(ilLDAPServer::_getCronServerIds() as $server_id)
{
try
{
$this->current_server = new ilLDAPServer($server_id);
$this->current_server->doConnectionCheck();
$this->log->write("LDAP: starting user synchronization for ".$this->current_server->getName());
$this->ldap_query = new ilLDAPQuery($this->current_server);
$this->ldap_query->bind(IL_LDAP_BIND_DEFAULT);
if(is_array($users = $this->ldap_query->fetchUsers()))
{
// Deactivate ldap users that are not in the list
$this->deactivateUsers($this->current_server,$users);
}
if(count($users))
{
$this->log->write("LDAP: Starting update/creation of users ...");
$this->ldap_to_ilias = new ilLDAPAttributeToUser($this->current_server);
$this->ldap_to_ilias->setNewUserAuthMode($this->current_server->getAuthenticationMappingKey());
#$GLOBALS['ilLog']->write(print_r($users,true));
$this->ldap_to_ilias->setUserData($users);
$this->ldap_to_ilias->refresh();
$this->log->write("LDAP: Finished update/creation");
}
else
{
$this->log->write("LDAP: No users for update/create. Aborting.");
}
}
{
$this->log->write($exc->getMessage());
}
}
}

+ Here is the call graph for this function:

Field Documentation

ilLDAPCronSynchronization::$current_server = null
private

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

ilLDAPCronSynchronization::$ldap_query = null
private

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

ilLDAPCronSynchronization::$log = null
private

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


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