5include_once
"Services/Cron/classes/class.ilCronJob.php";
6include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
7include_once(
'Services/LDAP/classes/class.ilLDAPQuery.php');
8include_once(
'Services/LDAP/classes/class.ilLDAPAttributeToUser.php');
35 $lng->loadLanguageModule(
'ldap');
36 return $lng->txt(
'ldap_user_sync_cron');
45 $lng->loadLanguageModule(
"ldap");
46 return $lng->txt(
"ldap_user_sync_cron_info");
73 $ilLog =
$DIC[
'ilLog'];
81 $this->current_server->doConnectionCheck();
82 $ilLog->write(
"LDAP: starting user synchronization for " . $this->current_server->getName());
84 $this->ldap_query =
new ilLDAPQuery($this->current_server);
87 if (is_array($users = $this->ldap_query->fetchUsers())) {
93 include_once
'./Services/User/classes/class.ilUserCreationContext.php';
98 while ($user_sliced = array_slice($users, $offset, $limit,
true)) {
99 $ilLog->write(
"LDAP: Starting update/creation of users ...");
100 $ilLog->write(
"LDAP: Offset: " . $offset);
102 $this->ldap_to_ilias->setNewUserAuthMode($this->current_server->getAuthenticationMappingKey());
103 $this->ldap_to_ilias->setUserData($user_sliced);
104 $this->ldap_to_ilias->refresh();
105 $ilLog->write(
"LDAP: Finished update/creation");
113 $ilLog->write(
"LDAP: No users for update/create. Aborting.");
116 $mess = $exc->getMessage();
117 $ilLog->write($mess);
123 if ($this->counter) {
141 $ilLog =
$DIC[
'ilLog'];
143 include_once
'./Services/User/classes/class.ilObjUser.php';
149 if (!array_key_exists($external_account, $a_ldap_users)) {
150 $inactive[] = $usr_id;
153 if (count($inactive)) {
155 $ilLog->write(
'LDAP: Found ' . count($inactive) .
' inactive users.');
159 $ilLog->write(
'LDAP: No inactive users found');
169 switch ($a_form_id) {
171 $a_fields[
"ldap_user_sync_cron"] = $a_is_active ?
172 $lng->txt(
"enabled") :
173 $lng->txt(
"disabled");
An exception for terminatinating execution or to throw for unit testing.
const IL_LDAP_BIND_DEFAULT
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_DAILY
static ping($a_job_id)
Keep cron job alive.
Update/create ILIAS user account by given LDAP attributes according to user attribute mapping setting...
hasAutoActivation()
Is to be activated on "installation".
hasFlexibleSchedule()
Can the schedule be configured?
getDefaultScheduleValue()
Get schedule value.
addToExternalSettingsForm($a_form_id, array &$a_fields, $a_is_active)
Add external settings to form.
getDefaultScheduleType()
Get schedule type.
getDescription()
Get description.
deactivateUsers(ilLDAPServer $server, $a_ldap_users)
Deactivate users that are disabled in LDAP.
static _getCronServerIds()
Get list of acticve servers with option 'SyncCron'.
static _toggleActiveStatusOfUsers($a_usr_ids, $a_status)
Toggle active status of users.
static _getExternalAccountsByAuthMode($a_auth_mode, $a_read_auth_default=false)
Get list of external account by authentication method Note: If login == ext_account for two user with...
static getInstance()
Get instance.