Last modified: 2011-01-14 02:37:39 UTC
Please make the function agree with the manual. My attempts to make the manual agree with the function were rejected.
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.
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.
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
(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.
> 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.
(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.
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.