ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLDAPCronSynchronization Class Reference
+ Inheritance diagram for ilLDAPCronSynchronization:
+ Collaboration diagram for ilLDAPCronSynchronization:

Public Member Functions

 getId ()
 Get id.
 getTitle ()
 Get title.
 getDescription ()
 Get description.
 getDefaultScheduleType ()
 Get schedule type.
 getDefaultScheduleValue ()
 Get schedule value.
 hasAutoActivation ()
 Is to be activated on "installation".
 hasFlexibleSchedule ()
 Can the schedule be configured?
 run ()
 Run job.
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form.
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active?
 getScheduleType ()
 Get current schedule type (if flexible)
 getScheduleValue ()
 Get current schedule value (if flexible)
 setSchedule ($a_type, $a_value)
 Update current schedule (if flexible)
 getValidScheduleTypes ()
 Get all available schedule types.
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually.
 hasCustomSettings ()
 Has cron job any custom setting which can be edited?
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form.
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings.
 activationWasToggled ($a_currently_active)
 Cron job status was changed.

Private Member Functions

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

Private Attributes

 $current_server = null
 $ldap_query = null
 $ldap_to_ilias = null
 $counter = 0

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
const SCHEDULE_TYPE_IN_MINUTES = 2
const SCHEDULE_TYPE_IN_HOURS = 3
const SCHEDULE_TYPE_IN_DAYS = 4
const SCHEDULE_TYPE_WEEKLY = 5
const SCHEDULE_TYPE_MONTHLY = 6
const SCHEDULE_TYPE_QUARTERLY = 7
const SCHEDULE_TYPE_YEARLY = 8
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)

Detailed Description

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

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

Member Function Documentation

ilLDAPCronSynchronization::addToExternalSettingsForm (   $a_form_id,
array &  $a_fields,
  $a_is_active 
)

Add external settings to form.

Parameters
int$a_form_id
array$a_fields
bool$a_is_active

Reimplemented from ilCronJob.

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

References $lng, and ilAdministrationSettingsFormHandler\FORM_LDAP.

{
global $lng;
switch($a_form_id)
{
$a_fields["ldap_user_sync_cron"] = $a_is_active ?
$lng->txt("enabled") :
$lng->txt("disabled");
break;
}
}
ilLDAPCronSynchronization::deactivateUsers ( ilLDAPServer  $server,
  $a_ldap_users 
)
private

Deactivate users that are disabled in LDAP.

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

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

Referenced by run().

{
global $ilLog;
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))
{
$ilLog->write('LDAP: Found '.count($inactive).' inactive users.');
$this->counter++;
}
else
{
$ilLog->write('LDAP: No inactive users found');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPCronSynchronization::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

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

References ilCronJob\SCHEDULE_TYPE_DAILY.

ilLDAPCronSynchronization::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

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

{
return;
}
ilLDAPCronSynchronization::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

References $lng.

{
global $lng;
$lng->loadLanguageModule("ldap");
return $lng->txt("ldap_user_sync_cron_info");
}
ilLDAPCronSynchronization::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

{
return "ldap_sync";
}
ilLDAPCronSynchronization::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

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

References $lng.

{
global $lng;
$lng->loadLanguageModule('ldap');
return $lng->txt('ldap_user_sync_cron');
}
ilLDAPCronSynchronization::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

{
return false;
}
ilLDAPCronSynchronization::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

{
return false;
}
ilLDAPCronSynchronization::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

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

References $ilLog, $messages, $result, ilLDAPServer\_getCronServerIds(), deactivateUsers(), IL_LDAP_BIND_DEFAULT, ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

{
global $ilLog;
$messages = array();
foreach(ilLDAPServer::_getCronServerIds() as $server_id)
{
try
{
$this->current_server = new ilLDAPServer($server_id);
$this->current_server->doConnectionCheck();
$ilLog->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))
{
$ilLog->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());
#$ilLog->write(print_r($users,true));
$this->ldap_to_ilias->setUserData($users);
$this->ldap_to_ilias->refresh();
$ilLog->write("LDAP: Finished update/creation");
$this->counter++;
}
else
{
$ilLog->write("LDAP: No users for update/create. Aborting.");
}
}
{
$mess = $exc->getMessage();
$ilLog->write($mess);
$messages[] = $mess;
}
}
if($this->counter)
{
}
if(sizeof($messages))
{
$result->setMessage(implode("\n", $messages));
}
$result->setStatus($status);
return $result;
}

+ Here is the call graph for this function:

Field Documentation

ilLDAPCronSynchronization::$counter = 0
private

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

ilLDAPCronSynchronization::$current_server = null
private

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

ilLDAPCronSynchronization::$ldap_query = null
private

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

ilLDAPCronSynchronization::$ldap_to_ilias = null
private

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


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