}
/**
- * @param int $field one of DELETED_* bitfield constants
+ * @param int $field One of DELETED_* bitfield constants
*
* @return bool
*/
* operations and other such meta-modifications.
*
* @param DatabaseBase $dbw
- * @param int $pageId: ID number of the page to read from
+ * @param int $pageId ID number of the page to read from
* @param string $summary Revision's summary
* @param bool $minor Whether the revision should be considered as minor
* @param User|null $user User object to use or null for $wgUser
*/
public static function userCanBitfield( $bitfield, $field, User $user = null ) {
if ( $bitfield & $field ) { // aspect is deleted
- if ( $bitfield & self::DELETED_RESTRICTED ) {
- $permission = 'suppressrevision';
- } elseif ( $field & self::DELETED_TEXT ) {
- $permission = 'deletedtext';
- } else {
- $permission = 'deletedhistory';
- }
- wfDebug( "Checking for $permission due to $field match on $bitfield\n" );
if ( $user === null ) {
global $wgUser;
$user = $wgUser;
}
- return $user->isAllowed( $permission );
+ if ( $bitfield & self::DELETED_RESTRICTED ) {
+ $permissions = array( 'suppressrevision', 'viewsuppressed' );
+ } elseif ( $field & self::DELETED_TEXT ) {
+ $permissions = array( 'deletedtext' );
+ } else {
+ $permissions = array( 'deletedhistory' );
+ }
+ $permissionlist = implode( ', ', $permissions );
+ wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
+ return call_user_func_array( array( $user, 'isAllowedAny' ), $permissions );
} else {
return true;
}