Skip to content
Snippets Groups Projects
Commit 8533b3eb authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

preserve global user switch in cronjob, fixes #2242

Closes #2242

Merge request studip/studip!1475
parent 331c534a
No related branches found
No related tags found
No related merge requests found
...@@ -94,6 +94,8 @@ class SendMailNotificationsJob extends CronJob ...@@ -94,6 +94,8 @@ class SendMailNotificationsJob extends CronJob
*/ */
public function execute($last_result, $parameters = []) public function execute($last_result, $parameters = [])
{ {
$cli_user = $GLOBALS['user'];
$notification = new ModulesNotification(); $notification = new ModulesNotification();
$query = "SELECT DISTINCT user_id $query = "SELECT DISTINCT user_id
...@@ -112,6 +114,8 @@ class SendMailNotificationsJob extends CronJob ...@@ -112,6 +114,8 @@ class SendMailNotificationsJob extends CronJob
return; return;
} }
$GLOBALS['user'] = new Seminar_user($user);
$ok = false; $ok = false;
$mailmessage = $notification->getAllNotifications($user->id); $mailmessage = $notification->getAllNotifications($user->id);
...@@ -135,5 +139,7 @@ class SendMailNotificationsJob extends CronJob ...@@ -135,5 +139,7 @@ class SendMailNotificationsJob extends CronJob
} }
} }
); );
$GLOBALS['user'] = $cli_user;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment