Page MenuHomePhabricator

Partially blocked admins are unable to undelete pages
Closed, ResolvedPublic2 Estimated Story Points

Description

A partially blocked admin can delete a page that they aren't blocked from, but is not able to undelete it.

The admin is able to see the page Special:Undelete/<Title> but the widget for restoring the page does not appear.

Event Timeline

Niharika triaged this task as Medium priority.Mar 26 2019, 5:23 PM
Niharika moved this task from Untriaged to Triage/To be Estimated on the Anti-Harassment board.
Niharika set the point value for this task to 2.Mar 27 2019, 7:03 PM
Niharika moved this task from Triage/To be Estimated to Zayin - ז on the Anti-Harassment board.
Niharika edited projects, added Anti-Harassment (Zayin - ז); removed Anti-Harassment.

Undeleting is complicated by the fact that, once a page is deleted, the block no longer has a restriction against it, because the page ID is no longer in the page table. That means that a user blocked from Foo could undelete the page Foo if it is deleted.

We could keep track of restrictions on deleted pages via the archive table, but IDs are not guaranteed to be stable over deletions and restorations of the same page.

What a blocked user with the 'undelete' right can access, before this task is fixed:

Type of BlockSpecial:UndeleteSpecial:Undelete/Foo
SitewideYesNo
Partial against BarYesYes, but widgets for restoring are not loaded
Partial against FooYesYes, but widgets for restoring are not loaded

What a blocked user with the 'undelete' right will be able to access, if we load the widgets whenever the block does not apply to the page:

Type of BlockSpecial:UndeleteSpecial:Undelete/Foo
SitewideYesNo
Partial against BarYesYes
Partial against FooYesYes, because Foo is deleted - but they will be blocked again if Foo is restored with the same page ID

I think we should still fix this, because users should be able to undelete pages they are not blocked from; we could address tracking restrictions of deleted pages separately if we think it's important.

Right so basically a partially blocked user with the undelete right should be to restore any page. They'll just be unable to do any other actions on it once it is restored (if the id happens to be the same after restoration)

This fails a bit lower in priority in me as we are overblocking which is the preferable failure case here, IMO. Not that we shouldn't fix it, just that it doesn't feel all that pressing.

Change 500082 had a related patch set uploaded (by Dmaza; owner: Dmaza):
[mediawiki/core@master] Fix partially blocked admin undelete permissions

https://gerrit.wikimedia.org/r/500082

Change 500082 merged by jenkins-bot:
[mediawiki/core@master] Fix partially blocked admin undelete permissions

https://gerrit.wikimedia.org/r/500082

dom_walden added a subscriber: dom_walden.

After partially blocking my admin, successfully undeleted a page via web.

If blocked from Article or sitewide, attempting to undelete get:
"The action you have requested is limited to users in one of the groups: Administrators, Oversighters, Researchers, Check users."

Which is confusing as my user is an admin. Probably not a regression, though (could not verify this on test.wikipedia as I cannot block myself due to T219240).

Was also able to successfully restore a deleted file via the API, choosing to restore only one file from the file history.

I was blocked from doing so when I was sitewide blocked.

The change is so minor that I do not feel anymore testing is necessary.

Environment:
https://en.wikipedia.beta.wmflabs.org
MediaWiki 1.33.0-alpha (9dfa200) 08:05, 2 April 2019