HomePhabricator

Respect CheckUser permissions when linking

Authored by saper on Jun 14 2012, 8:24 PM.

Description

Respect CheckUser permissions when linking

Links to [[Special:CheckUser]] and [[Special:CheckUserLog]]
where shown regardless whether the actual user
had 'checkuser' and 'checkuser-log' permissions.

It is normally not a problem since the 'checkuser'
default group has both permissions, but if one
of the abovementioned permissions is taken away
links point to the "Permissions errors" page.

Implementation notes:

  1. Introduce CheckUserBase class to reduce copy+paste and boilerplate code in CheckUser and SpecialCheckUserLog classes
  1. Now every class is responsible for knowing its own special page Title, which can be accessed using static method "title()". This way ugly and redundant getCheckUserFormTitle() and getCheckUserLogTitle() can be avoided.
  1. CheckUser and SpecialCheckUserLog are now responsible for producing links to themselves.

    Static methods have been added to facilitate easy linking to the checkuser form and the log:

    CheckUser::linkMsg, CheckUser::linkIP, CheckUser::linkSubIP, CheckUser::linkXFFIP SpecialCheckUserLOg::linkTargetMsg

    Those methods are responsible for checking permissions, therefore they accepts User object as their first parameter.

Interface messages and i18n:

  • rename "checkuser-log-return" to "checkuser-log-main-form" since we are not longer returning somewhere since Special:CheckUserLog is a special page on its own
  • use "Go to CheckUser main form" instead of "Switch..."
  • document "checkuser-contribs" while we are dealing with links

Change-Id: Icba78d78c41eeb2f895b24ebfdf3a1de7fea616b

Details