* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A special page that lists tags for edits
*
$out->wrapWikiMsg( "<div class='mw-tags-intro'>\n$1\n</div>", '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 ) {
protected function showDeleteTagForm( $tag ) {
$user = $this->getUser();
- if ( !$user->isAllowed( 'deletechangetags' ) ) {
+ if ( !MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $user, 'deletechangetags' ) ) {
throw new PermissionsError( 'deletechangetags' );
}
$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' );
$actionStr = $activate ? 'activate' : 'deactivate';
$user = $this->getUser();
- if ( !$user->isAllowed( 'managechangetags' ) ) {
+ if ( !MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $user, 'managechangetags' ) ) {
throw new PermissionsError( 'managechangetags' );
}
$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
$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();