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

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
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