Fix functionality and usages of SpecialUserrights::userCanChangeRights
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 23 Jan 2017 16:32:33 +0000 (17:32 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Mon, 23 Jan 2017 16:47:51 +0000 (17:47 +0100)
commit901dc6490ed2f2e893868afe46c617962903a52f
treee6caef238a21dfcd000497c798833387809a02fe
parente8263e293c56ff471b9bb17b951464608241d9a6
Fix functionality and usages of SpecialUserrights::userCanChangeRights

SpecialUserrights::userCanChangeRights is a funky method that is
called by things outside of SpecialUserrights to see if they should
display a link to it. It had some bugs and missing documentation.

* SpecialUserrights::userCanChangeRights relied on $this->isself to
  see if the acting user and target user are the same, but it gets set
  in execute() which never runs when used like this.
* It wasn't clear whether the $user parameter represented the acting
  user or the target user, resulting in incorrect usage in
  SkinTemplate.

The net effect of these bugs is that skin sidebar would display
"Change user groups" instead of "View user groups" for all users when
the current user was only allowed to change some of their own groups.

Change-Id: Ie47b9c7463b373fe17006567239aa09e824b015d
includes/skins/SkinTemplate.php
includes/specials/SpecialUserrights.php