From ee8b210549eb81e86ce76fb58db153936fb5a791 Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Thu, 21 Mar 2024 10:33:07 +0100 Subject: [PATCH] Allow the `SessionHandler` as `$user` parameter, too --- .../system/comment/manager/AbstractCommentManager.class.php | 3 ++- .../files/lib/system/comment/manager/ICommentManager.class.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php index b2fb5fd579..3ecfbeb525 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php @@ -7,6 +7,7 @@ use wcf\data\comment\response\CommentResponse; use wcf\data\DatabaseObjectDecorator; use wcf\data\user\UserProfile; use wcf\system\bbcode\BBCodeHandler; +use wcf\system\session\SessionHandler; use wcf\system\SingletonFactory; use wcf\system\WCF; @@ -162,7 +163,7 @@ abstract class AbstractCommentManager extends SingletonFactory implements IComme } #[\Override] - public function canModerateObject(int $objectTypeID, int $objectID, UserProfile $user): bool + public function canModerateObject(int $objectTypeID, int $objectID, SessionHandler|UserProfile $user): bool { return (bool)$user->getPermission($this->permissionCanModerate); } diff --git a/wcfsetup/install/files/lib/system/comment/manager/ICommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/ICommentManager.class.php index 5500208cd3..99d8a1f6da 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/ICommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/ICommentManager.class.php @@ -5,6 +5,7 @@ namespace wcf\system\comment\manager; use wcf\data\comment\Comment; use wcf\data\comment\response\CommentResponse; use wcf\data\user\UserProfile; +use wcf\system\session\SessionHandler; /** * Default interface for comment managers. @@ -77,7 +78,7 @@ interface ICommentManager * Returns true if the user may moderate content identified by * object type id and object id. */ - public function canModerateObject(int $objectTypeID, int $objectID, UserProfile $user): bool; + public function canModerateObject(int $objectTypeID, int $objectID, SessionHandler|UserProfile $user): bool; /** * Returns the amount of comments per page. -- 2.20.1