X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flogging%2FLogFormatter.php;h=b4a682583c28a9bee830ee220efde6a2d50fc3c6;hb=9283760f340c6971d748fb574a35453fa7928807;hp=e8dd8982b5ad3f215e9325e8849ddcec877051c0;hpb=46492c38ea9943b51c561bee45ad926a25be0639;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index e8dd8982b5..b4a682583c 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -153,6 +153,21 @@ class LogFormatter { : self::FOR_PUBLIC; } + /** + * Check if a log item type can be displayed + * @return bool + */ + public function canViewLogType() { + // If the user doesn't have the right permission to view the specific + // log type, return false + $logRestrictions = $this->context->getConfig()->get( 'LogRestrictions' ); + $type = $this->entry->getType(); + return !isset( $logRestrictions[$type] ) + || MediaWikiServices::getInstance() + ->getPermissionManager() + ->userHasRight( $this->context->getUser(), $logRestrictions[$type] ); + } + /** * Check if a log item can be displayed * @param int $field LogPage::DELETED_* constant @@ -161,9 +176,10 @@ class LogFormatter { protected function canView( $field ) { if ( $this->audience == self::FOR_THIS_USER ) { return LogEventsList::userCanBitfield( - $this->entry->getDeleted(), $field, $this->context->getUser() ); + $this->entry->getDeleted(), $field, $this->context->getUser() ) && + self::canViewLogType(); } else { - return !$this->entry->isDeleted( $field ); + return !$this->entry->isDeleted( $field ) && self::canViewLogType(); } }