/** @var CommentStoreComment|null */
protected $mComment;
- /** @var Title */
+ /** @var Title */
protected $mTitle; // TODO: we only need the title for permission checks!
/** @var RevisionSlots */
*
* @param Title $title The title of the page this Revision is associated with.
* @param RevisionSlots $slots The slots of this revision.
- * @param bool|string $wikiId the wiki ID of the site this Revision belongs to,
- * or false for the local site.
+ * @param bool|string $dbDomain DB domain of the relevant wiki or false for the current one.
*
* @throws MWException
*/
- function __construct( Title $title, RevisionSlots $slots, $wikiId = false ) {
- Assert::parameterType( 'string|boolean', $wikiId, '$wikiId' );
+ function __construct( Title $title, RevisionSlots $slots, $dbDomain = false ) {
+ Assert::parameterType( 'string|boolean', $dbDomain, '$dbDomain' );
$this->mTitle = $title;
$this->mSlots = $slots;
- $this->mWiki = $wikiId;
+ $this->mWiki = $dbDomain;
// XXX: this is a sensible default, but we may not have a Title object here in the future.
$this->mPageId = $title->getArticleID();
} else {
$permissions = [ 'deletedhistory' ];
}
+
+ // XXX: How can we avoid global scope here?
+ // Perhaps the audience check should be done in a callback.
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$permissionlist = implode( ', ', $permissions );
if ( $title === null ) {
wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
- return $user->isAllowedAny( ...$permissions );
+ foreach ( $permissions as $perm ) {
+ if ( $permissionManager->userHasRight( $user, $perm ) ) {
+ return true;
+ }
+ }
+ return false;
} else {
$text = $title->getPrefixedText();
wfDebug( "Checking for $permissionlist on $text due to $field match on $bitfield\n" );
- $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
-
foreach ( $permissions as $perm ) {
if ( $permissionManager->userCan( $perm, $user, $title ) ) {
return true;