Merge "objectcache: Remove lock()/unlock() stubs from MemcachedClient"
[lhc/web/wiklou.git] / includes / api / ApiQueryUserInfo.php
index d73fbc4..ab8d93a 100644 (file)
@@ -20,6 +20,7 @@
  * @file
  */
 
+use MediaWiki\Block\AbstractBlock;
 use MediaWiki\MediaWikiServices;
 
 /**
@@ -56,10 +57,10 @@ class ApiQueryUserInfo extends ApiQueryBase {
         * Get basic info about a given block
         *
         * @deprecated since 1.34 Use ApiBlockInfoTrait::getBlockDetails() instead.
-        * @param Block $block
+        * @param AbstractBlock $block
         * @return array See ApiBlockInfoTrait::getBlockDetails
         */
-       public static function getBlockInfo( Block $block ) {
+       public static function getBlockInfo( AbstractBlock $block ) {
                wfDeprecated( __METHOD__, '1.34' );
 
                // Hack to access a private method from a trait:
@@ -158,8 +159,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                }
 
                if ( isset( $this->prop['rights'] ) ) {
-                       // User::getRights() may return duplicate values, strip them
-                       $vals['rights'] = array_values( array_unique( $user->getRights() ) );
+                       $vals['rights'] = $this->getPermissionManager()->getUserPermissions( $user );
                        ApiResult::setArrayType( $vals['rights'], 'array' ); // even if empty
                        ApiResult::setIndexedTagName( $vals['rights'], 'r' ); // even if empty
                }
@@ -179,7 +179,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
 
                if ( isset( $this->prop['preferencestoken'] ) &&
                        !$this->lacksSameOriginSecurity() &&
-                       $user->isAllowed( 'editmyoptions' )
+                       $this->getPermissionManager()->userHasRight( $user, 'editmyoptions' )
                ) {
                        $vals['preferencestoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
                }
@@ -200,7 +200,8 @@ class ApiQueryUserInfo extends ApiQueryBase {
                        $vals['realname'] = $user->getRealName();
                }
 
-               if ( $user->isAllowed( 'viewmyprivateinfo' ) && isset( $this->prop['email'] ) ) {
+               if ( $this->getPermissionManager()->userHasRight( $user, 'viewmyprivateinfo' ) &&
+                               isset( $this->prop['email'] ) ) {
                        $vals['email'] = $user->getEmail();
                        $auth = $user->getEmailAuthenticationTimestamp();
                        if ( $auth !== null ) {