X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialTags.php;h=34665dd99e648b2bf3ab1495886c1e5a463e07cc;hp=110fb1ff042f04e61bb466058717446ad8367b54;hb=a1ef77b2d80830fbcb617a83961d78cff9d6e384;hpb=a38af7ba26579bb3004f673e44d39710887763aa diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index 110fb1ff04..34665dd99e 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -21,6 +21,8 @@ * @ingroup SpecialPage */ +use MediaWiki\MediaWikiServices; + /** * A special page that lists tags for edits * @@ -50,6 +52,7 @@ class SpecialTags extends SpecialPage { function execute( $par ) { $this->setHeaders(); $this->outputHeader(); + $this->addHelpLink( 'Manual:Tags' ); $request = $this->getRequest(); switch ( $par ) { @@ -76,9 +79,10 @@ class SpecialTags extends SpecialPage { $out->wrapWikiMsg( "
\n$1\n
", 'tags-intro' ); $user = $this->getUser(); - $userCanManage = $user->isAllowed( 'managechangetags' ); - $userCanDelete = $user->isAllowed( 'deletechangetags' ); - $userCanEditInterface = $user->isAllowed( 'editinterface' ); + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); + $userCanManage = $permissionManager->userHasRight( $user, 'managechangetags' ); + $userCanDelete = $permissionManager->userHasRight( $user, 'deletechangetags' ); + $userCanEditInterface = $permissionManager->userHasRight( $user, 'editinterface' ); // Show form to create a tag if ( $userCanManage ) { @@ -328,7 +332,9 @@ class SpecialTags extends SpecialPage { protected function showDeleteTagForm( $tag ) { $user = $this->getUser(); - if ( !$user->isAllowed( 'deletechangetags' ) ) { + if ( !MediaWikiServices::getInstance() + ->getPermissionManager() + ->userHasRight( $user, 'deletechangetags' ) ) { throw new PermissionsError( 'deletechangetags' ); } @@ -375,6 +381,7 @@ class SpecialTags extends SpecialPage { $form = HTMLForm::factory( 'ooui', $fields, $this->getContext() ); $form->setAction( $this->getPageTitle( 'delete' )->getLocalURL() ); + // @phan-suppress-next-line PhanUndeclaredProperty $form->tagAction = 'delete'; // custom property on HTMLForm object $form->setSubmitCallback( [ $this, 'processTagForm' ] ); $form->setSubmitTextMsg( 'tags-delete-submit' ); @@ -387,7 +394,9 @@ class SpecialTags extends SpecialPage { $actionStr = $activate ? 'activate' : 'deactivate'; $user = $this->getUser(); - if ( !$user->isAllowed( 'managechangetags' ) ) { + if ( !MediaWikiServices::getInstance() + ->getPermissionManager() + ->userHasRight( $user, 'managechangetags' ) ) { throw new PermissionsError( 'managechangetags' ); } @@ -425,6 +434,7 @@ class SpecialTags extends SpecialPage { $form = HTMLForm::factory( 'ooui', $fields, $this->getContext() ); $form->setAction( $this->getPageTitle( $actionStr )->getLocalURL() ); + // @phan-suppress-next-line PhanUndeclaredProperty $form->tagAction = $actionStr; $form->setSubmitCallback( [ $this, 'processTagForm' ] ); // tags-activate-submit, tags-deactivate-submit @@ -433,6 +443,12 @@ class SpecialTags extends SpecialPage { $form->show(); } + /** + * @param array $data + * @param HTMLForm $form + * @return bool + * @suppress PhanUndeclaredProperty $form->tagAction + */ public function processTagForm( array $data, HTMLForm $form ) { $context = $form->getContext(); $out = $context->getOutput();