r41465 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41464‎ | r41465 | r41466 >
Date:07:51, 1 October 2008
Author:nicdumz
Status:old (Comments)
Tags:
Comment:
Adding a new right, move-rootuserpages.
This is a feature request by French crats :
the idea is to prevent users from wrongly attempting to userrename through Special:Movepage/User:xx . When this happens, a 'crat has to revert the move (deleting the redirects, sometimes with a lot of subpages) before being able to rename the user.

Default permission scheme still allows users to move root userpages
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesFr.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2616,6 +2616,7 @@
26172617 In those cases, you will have to move or merge the page manually if desired.",
26182618 'movearticle' => 'Move page:',
26192619 'movenotallowed' => 'You do not have permission to move pages on {{SITENAME}}.',
 2620+'moverootuserpagesnotallowed' => 'You do not have permission to move root user pages on {{SITENAME}}.',
26202621 'newtitle' => 'To new title:',
26212622 'move-watch' => 'Watch this page',
26222623 'movepagebtn' => 'Move page',
Index: trunk/phase3/languages/messages/MessagesFr.php
@@ -2120,6 +2120,7 @@
21212121 Dans ce cas, vous devrez renommer ou fusionner la page manuellement si vous le désirez.',
21222122 'movearticle' => 'Renommer l’article',
21232123 'movenotallowed' => 'Vous n’avez pas la permission de renommer des pages sur ce wiki.',
 2124+'moverootuserpagesnotallowed' => 'Vous n’avez pas la permission de renommer des pages utilisateurs racines sur ce wiki.',
21242125 'newtitle' => 'Nouveau titre',
21252126 'move-watch' => 'Suivre cette page',
21262127 'movepagebtn' => 'Renommer l’article',
Index: trunk/phase3/includes/Title.php
@@ -2379,6 +2379,8 @@
23802380 * @return \type{\mixed} True on success, getUserPermissionsErrors()-like array on failure
23812381 */
23822382 public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) {
 2383+ global $wgUser;
 2384+
23832385 $errors = array();
23842386 if( !$nt ) {
23852387 // Normally we'd add this to $errors, but we'll get
@@ -2421,12 +2423,16 @@
24222424 }
24232425
24242426 if ( $auth ) {
2425 - global $wgUser;
24262427 $errors = wfArrayMerge($errors,
24272428 $this->getUserPermissionsErrors('move', $wgUser),
24282429 $this->getUserPermissionsErrors('edit', $wgUser),
24292430 $nt->getUserPermissionsErrors('move', $wgUser),
24302431 $nt->getUserPermissionsErrors('edit', $wgUser));
 2432+
 2433+ # Root userpage ?
 2434+ if ( $nt->getNamespace() == NS_USER && !$nt->isSubpage() && !$wgUser->isAllowed('move-rootuserpages') ) {
 2435+ $errors[] = array('moverootuserpagesnotallowed');
 2436+ }
24312437 }
24322438
24332439 $match = EditPage::matchSpamRegex( $reason );
@@ -2435,7 +2441,6 @@
24362442 $errors[] = array('spamprotectiontext');
24372443 }
24382444
2439 - global $wgUser;
24402445 $err = null;
24412446 if( !wfRunHooks( 'AbortMove', array( $this, $nt, $wgUser, &$err, $reason ) ) ) {
24422447 $errors[] = array('hookaborted', $err);
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1126,6 +1126,7 @@
11271127 // Implicit group for all logged-in accounts
11281128 $wgGroupPermissions['user' ]['move'] = true;
11291129 $wgGroupPermissions['user' ]['move-subpages'] = true;
 1130+$wgGroupPermissions['user' ]['move-rootuserpages'] = true; // can move root userpages
11301131 $wgGroupPermissions['user' ]['read'] = true;
11311132 $wgGroupPermissions['user' ]['edit'] = true;
11321133 $wgGroupPermissions['user' ]['createpage'] = true;
@@ -1164,6 +1165,7 @@
11651166 $wgGroupPermissions['sysop']['importupload'] = true;
11661167 $wgGroupPermissions['sysop']['move'] = true;
11671168 $wgGroupPermissions['sysop']['move-subpages'] = true;
 1169+$wgGroupPermissions['sysop']['move-rootuserpages'] = true;
11681170 $wgGroupPermissions['sysop']['patrol'] = true;
11691171 $wgGroupPermissions['sysop']['autopatrol'] = true;
11701172 $wgGroupPermissions['sysop']['protect'] = true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r41466Fixes for incomplete r41465.siebrand08:08, 1 October 2008
r41534Update RELEASE-NOTES for r41465siebrand08:51, 2 October 2008
r41595Better implementation of r41465 (Adding a new right, move-rootuserpages.) whi...nicdumz10:20, 3 October 2008
r41961* Reintroduce user page move permission as per r41465, generally useful regar...tstarling08:26, 11 October 2008

Comments

#Comment by Raymond (talk | contribs)   12:18, 1 October 2008

> "Default permission scheme still allows users to move root userpages"

I suggest to set this right to 'false' for 'user'. I see no need for a normal user to move its userrootpage, at least for WMF wikis.

#Comment by NicDumZ (talk | contribs)   01:55, 3 October 2008

This was an attempts not to break the current behavior ; but the motivation for this was of course to set it to true on WMF wikis.

Also, using "userrootpage" might be better than my poor "root-userpages" attempt, true.

#Comment by Brion VIBBER (talk | contribs)   16:33, 1 October 2008

Such a move *should* not interfere with a later rename at all. I would recommend fixing that problem instead of introducing this extra hurdle.

#Comment by TheFearow (talk | contribs)   09:55, 3 October 2008

This was (accidentally) partially reverted in r41569, as part of a svn merge mistake.

#Comment by Siebrand (talk | contribs)   23:45, 3 October 2008

Fixed in r41596 I guess.

#Comment by Tim Starling (talk | contribs)   05:46, 11 October 2008

No, it's still wrong. There's no reason to have such a hook in the Renameuser extension. Even wikis without Renameuser may want to prohibit user page renames, this is a commonly-requested feature. I don't see anything specific to Renameuser in the original complaint: renaming users appears to work just fine when the destination pages already exist, such pages are silently skipped.

#Comment by Tim Starling (talk | contribs)   11:55, 11 October 2008

See my idea of how it should be done in r41961/r41962/r41963.

Status & tagging log