return $this->tokenFunctions;
}
+ /** @var string[] */
protected static $cachedTokens = [];
/**
// but that's too expensive for this purpose
// and would break caching
global $wgUser;
- if ( !$wgUser->isAllowed( 'edit' ) ) {
+ if ( !MediaWikiServices::getInstance()->getPermissionManager()
+ ->userHasRight( $wgUser, 'edit' ) ) {
return false;
}
*/
public static function getDeleteToken( $pageid, $title ) {
global $wgUser;
- if ( !$wgUser->isAllowed( 'delete' ) ) {
+ if ( !MediaWikiServices::getInstance()->getPermissionManager()
+ ->userHasRight( $wgUser, 'delete' ) ) {
return false;
}
*/
public static function getProtectToken( $pageid, $title ) {
global $wgUser;
- if ( !$wgUser->isAllowed( 'protect' ) ) {
+ if ( !MediaWikiServices::getInstance()->getPermissionManager()
+ ->userHasRight( $wgUser, 'protect' ) ) {
return false;
}
*/
public static function getMoveToken( $pageid, $title ) {
global $wgUser;
- if ( !$wgUser->isAllowed( 'move' ) ) {
+ if ( !MediaWikiServices::getInstance()->getPermissionManager()
+ ->userHasRight( $wgUser, 'move' ) ) {
return false;
}
*/
public static function getBlockToken( $pageid, $title ) {
global $wgUser;
- if ( !$wgUser->isAllowed( 'block' ) ) {
+ if ( !MediaWikiServices::getInstance()->getPermissionManager()
+ ->userHasRight( $wgUser, 'block' ) ) {
return false;
}
*/
public static function getImportToken( $pageid, $title ) {
global $wgUser;
- if ( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
+ if ( !MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasAnyRight( $wgUser, 'import', 'importupload' ) ) {
return false;
}
$user = $this->getUser();
if ( $user->isAnon() || count( $this->everything ) == 0
- || !$user->isAllowed( 'viewmywatchlist' )
+ || !$this->getPermissionManager()->userHasRight( $user, 'viewmywatchlist' )
) {
return;
}
}
$user = $this->getUser();
- $canUnwatchedpages = $user->isAllowed( 'unwatchedpages' );
+ $canUnwatchedpages = $this->getPermissionManager()->userHasRight( $user, 'unwatchedpages' );
$unwatchedPageThreshold = $this->getConfig()->get( 'UnwatchedPageThreshold' );
if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
return;
$user = $this->getUser();
$db = $this->getDB();
- $canUnwatchedpages = $user->isAllowed( 'unwatchedpages' );
+ $canUnwatchedpages = $this->getPermissionManager()->userHasRight( $user, 'unwatchedpages' );
$unwatchedPageThreshold = $this->getConfig()->get( 'UnwatchedPageThreshold' );
if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
return;