From 4ce6e9774d70885ec7e93ffc7d05b23912053166 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 16 Jul 2014 14:59:18 +0200 Subject: [PATCH] Added ability to check for access within notification events --- .../user/notification/UserNotificationHandler.class.php | 5 ++++- .../event/AbstractUserNotificationEvent.class.php | 7 +++++++ .../notification/event/IUserNotificationEvent.class.php | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 42b10e8514..966a374984 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -5,7 +5,6 @@ use wcf\data\user\notification\event\recipient\UserNotificationEventRecipientLis use wcf\data\user\notification\event\UserNotificationEventList; use wcf\data\user\notification\UserNotification; use wcf\data\user\notification\UserNotificationAction; -use wcf\data\user\notification\UserNotificationList; use wcf\data\user\User; use wcf\data\user\UserEditor; use wcf\data\user\UserProfile; @@ -385,6 +384,10 @@ class UserNotificationHandler extends SingletonFactory { $notification->timesTriggered ); + if (!$class->checkAccess()) { + continue; + } + if (isset($authorToNotification[$notification->notificationID])) { $eventAuthors = array(); foreach ($authorToNotification[$notification->notificationID] as $userID) { diff --git a/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php index bacaef722d..c61a4b2249 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php @@ -232,4 +232,11 @@ abstract class AbstractUserNotificationEvent extends DatabaseObjectDecorator imp public function supportsEmailNotification() { return true; } + + /** + * @see \wcf\system\user\notification\event\IUserNotificationEvent::checkAccess() + */ + public function checkAccess() { + return true; + } } diff --git a/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php index c77fa8f11d..b258146f3c 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php @@ -126,4 +126,12 @@ interface IUserNotificationEvent extends IDatabaseObjectProcessor { * @return boolean */ public function supportsEmailNotification(); + + /** + * Validates if the related object is still accessible, in case this check fails + * the event should take the appropriate actions to resolve this. + * + * @return boolean + */ + public function checkAccess(); } -- 2.20.1