* notification: do not notify expired or inactive users

This commit is contained in:
Klaus Leithoff 2011-11-08 08:18:36 +00:00
parent f9e8d7312d
commit 389f385701

View File

@ -367,7 +367,16 @@ final class notifications {
try { try {
// system or non-system user // system or non-system user
if($receiver->account_id && is_numeric($receiver->account_id)) { if($receiver->account_id && is_numeric($receiver->account_id)) {
// system user // system user, collect data and check for Status and expire state, skip notification if expired or not active
$userData = $GLOBALS['egw']->accounts->read($receiver->account_id);
//error_log(__METHOD__.__LINE__." fetched data for User:".array2string($userData['account_lid']).'#'.$userData['account_type'].'#'.$userData['account_status'].'#'.$GLOBALS['egw']->accounts->is_expired($userData).'#');
if ($userData && $userData['account_type'] === 'u' &&
($userData['account_status'] != 'A' || $GLOBALS['egw']->accounts->is_expired($userData)))
{
//error_log(__METHOD__.__LINE__." skipped notification for User with Data:".array2string($userData));
$notification_chain = 'disable';
continue;
}
$receiver->handle = $receiver->account_lid; $receiver->handle = $receiver->account_lid;
// check if the receiver has rights to run the notifcation app // check if the receiver has rights to run the notifcation app
$ids = $GLOBALS['egw']->accounts->memberships($receiver->account_id,true); $ids = $GLOBALS['egw']->accounts->memberships($receiver->account_id,true);