40            if (isset(
$DIC[
'ilSetting'])) {
 
   43                $this->roleIdWhiteliste = (string) $this->
settings->get(
 
   44                    'cron_users_without_login_delete_incl_roles',
 
   48                $this->thresholdInDays = (int) $this->
settings->get(
 
   49                    'cron_users_without_login_delete_threshold',
 
   50                    self::DEFAULT_CREATION_THRESHOLD
 
   54            if (isset(
$DIC[
'lng'])) {
 
   55                $this->lng = 
$DIC->language();
 
   56                $this->lng->loadLanguageModule(
'usr');
 
   59            if (isset(
$DIC[
'rbacreview'])) {
 
   60                $this->rbacreview = 
$DIC->rbac()->review();
 
   63            if (isset(
$DIC[
'ilObjDataCache'])) {
 
   64                $this->objectDataCache = 
$DIC[
'ilObjDataCache'];
 
   67            if (isset(
$DIC[
'http'])) {
 
   68                $this->request = 
$DIC->http()->request();
 
   78        return 'user_never_logged_in';
 
   88        return $DIC->language()->txt(
'user_never_logged_in');
 
   98        return $DIC->language()->txt(
'user_never_logged_in_info');
 
  148        $result = new \ilCronJobResult();
 
  154            $this->thresholdInDays ?: self::DEFAULT_CREATION_THRESHOLD
 
  157        $roleIdWhitelist = array_filter(array_map(
'intval', explode(
',', $this->roleIdWhiteliste)));
 
  160        foreach ($userIds as $userId) {
 
  166            if (!$user || !($user instanceof \
ilObjUser)) {
 
  172            if (count($roleIdWhitelist) > 0) {
 
  173                $assignedRoleIds = array_filter(array_map(
'intval', (array) $this->rbacreview->assignedRoles($userId)));
 
  175                $respectedRolesToInclude = array_intersect($assignedRoleIds, $roleIdWhitelist);
 
  176                if (count($respectedRolesToInclude) > 0) {
 
  185            $DIC->logger()->usr()->info(sprintf(
 
  186                "Deleting user account with id %s (login: %s)",
 
  197            $message = sprintf(
'%s user(s) deleted', $counter);
 
  212            $this->lng->txt(
'cron_users_without_login_del_role_whitelist'),
 
  215        $roleWhiteList->setInfo($this->lng->txt(
'cron_users_without_login_del_role_whitelist_info'));
 
  217        foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
 
  219                $roles[$role_id] = $this->objectDataCache->lookupTitle($role_id);
 
  222        $roleWhiteList->setOptions($roles);
 
  223        $roleWhiteList->setValue(array_filter(array_map(
'intval', explode(
',', $this->roleIdWhiteliste))));
 
  224        $roleWhiteList->setWidth(300);
 
  225        $a_form->
addItem($roleWhiteList);
 
  228            $this->lng->txt(
'cron_users_without_login_del_create_date_thr'),
 
  231        $threshold->setInfo($this->lng->txt(
'cron_users_without_login_del_create_date_thr_info'));
 
  232        $threshold->setValue($this->thresholdInDays);
 
  233        $threshold->setSuffix($this->lng->txt(
'days'));
 
  234        $threshold->setSize(4);
 
  235        $threshold->setMaxLength(4);
 
  236        $threshold->setRequired(
true);
 
  247        $roleIdWhitelist = $this->request->getParsedBody()[
'role_whitelist'] ?? [];
 
  248        $this->roleIdWhiteliste = implode(
',', array_map(
'intval', (is_array($roleIdWhitelist) ? $roleIdWhitelist : [])));
 
  250        $this->thresholdInDays = $this->request->getParsedBody()[
'threshold'] ?? 
'';
 
  252        if (!is_numeric($this->thresholdInDays) || $this->
hasDecimals($this->thresholdInDays)) {
 
  254            $a_form->
getItemByPostVar(
'threshold')->setAlert($this->lng->txt(
'user_never_logged_in_info_threshold_err_num'));
 
  259                'cron_users_without_login_delete_incl_roles',
 
  260                (
string) $this->roleIdWhiteliste
 
  263                'cron_users_without_login_delete_threshold',
 
  264                (
int) $this->thresholdInDays
 
  279        if (strpos($number, 
',') !== 
false || strpos($number, 
'.') !== 
false) {
 
An exception for terminatinating execution or to throw for unit testing.
Class ilCronDeleteNeverLoggedInUserAccounts.
hasFlexibleSchedule()
Can the schedule be configured?boolean
hasAutoActivation()
Is to be activated on "installation".boolean
saveCustomSettings(\ilPropertyFormGUI $a_form)
getDefaultScheduleValue()
Get schedule value.int|array
const DEFAULT_CREATION_THRESHOLD
getDefaultScheduleType()
Get schedule type.int
run()
Run job.ilCronJobResult
getDescription()
Get description.string
__construct()
ilCronDeleteNeverLoggedInUserAccounts constructor.
addCustomSettingsToForm(\ilPropertyFormGUI $a_form)
getTitle()
Get title.string
hasCustomSettings()
Has cron job any custom setting which can be edited?boolean
Cron job application base class.
const SCHEDULE_TYPE_DAILY
static getUserIdsNeverLoggedIn(int $thresholdInDays)
Get ids of all users that have never logged in.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...