Last modified: 2014-02-14 10:14:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45790, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43790 - Add JavaScript variable for whether user can edit the page
Add JavaScript variable for whether user can edit the page
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.21.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Matthew Flaschen
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-09 20:31 UTC by Matthew Flaschen
Modified: 2014-02-14 10:14 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Matthew Flaschen 2013-01-09 20:31:37 UTC
This will make it easier for extensions and gadgets to determine if the current user can edit the current page.

Right now, you either have to hack it by looking for an edit tab, or try to figure it out from wgRestrictionEdit and wgUserGroups.  But wgRestrictionEdit has weird things like MediaWiki pages being an empty array when logically it should be ["sysop"]), and doesn't take into account important features like cascading protections and TitleBlacklist.

I think the right way may be to use Title::userCan.
Comment 1 spage 2013-01-10 00:31:20 UTC
Definitely useful.  Use Title::quickUserCan( 'edit' ) which sets $doExpensiveQueries false to skip "potentially expensive cascading permission checks". Comment says "May provide false positives, but should never provide a false negative", maybe name JS variable wcsUserCanProbablyEdit (* wikipedia client-side, I need to make a separate proposal).
Comment 2 Matthew Flaschen 2013-05-23 04:34:29 UTC
Gerrit at https://gerrit.wikimedia.org/r/65009 .  I used the name wgIsProbablyEditable, since I did go with quickUserCan (same as SkinTemplate).
Comment 3 Gerrit Notification Bot 2013-07-04 05:23:22 UTC
Change 65009 merged by jenkins-bot:
Add wgIsProbablyEditable for editability based on quickUserCan.

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links