Last modified: 2011-01-14 02:37:39 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 T28703, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26703 - quickUserCan() vs. createtalk vs. edit
quickUserCan() vs. createtalk vs. edit
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Page protection (Other open bugs)
1.18.x
All All
: Normal trivial (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.mediawiki.org/w/index.php?...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-13 03:00 UTC by Dan Jacobson
Modified: 2011-01-14 02:37 UTC (History)
3 users (show)

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


Attachments

Description Dan Jacobson 2011-01-13 03:00:24 UTC
Please make the function agree with the manual. My attempts to make the manual agree with the function were rejected.
Comment 1 Bawolff (Brian Wolff) 2011-01-13 03:02:41 UTC
Can you be specific what the issue is? I reverted you on the manual because I checked and you need both createpage and edit to create a page.
Comment 2 Dan Jacobson 2011-01-13 03:08:36 UTC
Yes, but following your manual page, my
if(!$sktemplate->mTitle->quickUserCan('createtalk') in
http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/51493
gave me the wrong answer.
Comment 3 Bawolff (Brian Wolff) 2011-01-13 03:17:28 UTC
While first of all you should be using quickUserCan('create') not quickUserCan('createtalk'). (The permission is called createtalk, but you're checking if the user can create not that they can createtalk)

Secondly, it is expected you check both edit and create, not just create. neither userCan( 'create' ) nor quickUserCan( 'create' ) check if you can edit, only if you can create the page. Arguably thats a little counter-intuitive, but thats the way it currently is.

For reference to anyone else reading this, the relevant edit that i reverted was http://www.mediawiki.org/w/index.php?title=Manual:Preventing_access&diff=prev&oldid=375514
Comment 4 Dan Jacobson 2011-01-13 03:42:55 UTC
(In reply to comment #3)
> While first of all you should be using quickUserCan('create') not
> quickUserCan('createtalk'). (The permission is called createtalk, but you're
> checking if the user can create not that they can createtalk)
No, I'm only interested in the talk pages, as you see further down:
>    if(!$sktemplate->mTitle->quickUserCan('createtalk')){
>      foreach(array_keys($links['namespaces']) as $ns){
>        if(strpos($ns,'talk')!==false){
On the manual page you say
> Note: Revoking the 'edit' right already prevents affected users from creating new pages and talk pages.
(which doesn't tell the user the exact code you mean too, by the way.)
However quickUserCan('createtalk') says otherwise.
> Secondly, it is expected...
One cannot know what is expected. One only reads the manual page.
Comment 5 Bawolff (Brian Wolff) 2011-01-13 04:03:37 UTC
>        if(strpos($ns,'talk')!==false){
Considering that  a non-talk namespace is allowed to have talk in its name, and a talk namespace might not have talk in its name (Especially for non-english namespace names), thats not the correct check. but thats off topic.

>No, I'm only interested in the talk pages, as you see further down
yes i knew that. I suppose you could use createtalk instead of create and a check that the title is a talk page, but everything in core seems to do userCan( 'create' ).

>On the manual page you say
>> Note: Revoking the 'edit' right already prevents affected users from creating new pages and talk pages.

While i didn't say that, someone else did, but the sentence is correct.

>However quickUserCan('createtalk') says otherwise.

like its supposed to. The sentence never said quickUserCheck('createtalk') will return false if user doesn't have edit rights. It said you can't create a talk page if you don't have edit rights. There is a very large difference. (Furthermore, that manual page is for people running mediawiki installs, not people writing php code, so talking about internals on that specific manual page would be inappropriate).
-----

Last of all, what are you requesting be changed/be done? This bug lacks a problem statement.
Comment 6 Dan Jacobson 2011-01-14 02:30:00 UTC
(In reply to comment #5)
> thats not the correct check. but thats off topic.
There is no better way for that hook.

> Furthermore, that manual page is for people running mediawiki installs, not
> people writing php code,

Does it carry such a warning? Even if it did, isn't that a rather dangerous assumption?

> what are you requesting be changed/be done? This bug lacks a problem statement.

I was hoping you would somehow make the manual page safe to read for
people writing php code too.
Comment 7 Chad H. 2011-01-14 02:37:39 UTC
quickUserCan( $permission ) returns boolean based on what permission is checked for. Permissions are not cascading, so quickUserCan( 'createtalk' ) does NOT imply 'createtalk' && 'edit'.

If someone is making use of quickUserCan() in their code, they should understand the permission model of MediaWiki, which is outlined here: http://www.mediawiki.org/wiki/Manual:User_rights

In order to create a new talkpage, both the 'edit' and 'createtalk' rights are required. Sometimes you need more than one right to do an action.

I see no bug in MediaWiki.

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


Navigation
Links