Last modified: 2011-03-13 18:04:55 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 10758 - Add a Title parameter to User::isAllowed()
Add a Title parameter to User::isAllowed()
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2007-07-31 00:33 UTC by Jean-Lou Dupont
Modified: 2011-03-13 18:04 UTC (History)
1 user (show)

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


Description Jean-Lou Dupont 2007-07-31 00:33:31 UTC
The proposed enhancement:
* does not disrupt the stock MediaWiki
* allows for extensions to handle rights management at a more granular level.

Proposed change to User.php:

<source lang=php>
function isAllowed($action='', $ns = null /*optional*/, $title = null /* optional */ ) 
                if ( $action === '' )
                        // In the spirit of DWIM
                        return true;
                // CHANGE begin{{
                $result = null;
                wfRunHooks('UserIsAllowed', array( &$this, $ns, $title, &$action, &$result ) );
                if ( $result !== null )
                        return $result;
                // CHANGE end }}
                return in_array( $action, $this->getRights() );

Of course it does not address the policing issues of the whole MediaWiki platform but updating this method could open up the path to enhancements to the rights management sub-system i.e. do it piece-by-piece maybe? I know I have seen discussion around 'using more' the 'Title::userCan' method but, in retrospect, after delving for many hours in the bowels of MW, I now could argue 'more intelligently' that this wouldn't be, IMO, a course of action I would follow; e.g. there are 'title/namespace' level rights and there are 'title independent' rights to manage here.
Comment 1 Brion Vibber 2007-08-08 17:22:36 UTC
Seems to duplicate existing code?
Comment 2 Jean-Lou Dupont 2007-08-08 17:27:50 UTC
Well, until an extension hooks up to the new hook 'UserIsAllowed', the above code does not change the current MediaWiki behavior.
The point is to add a hook that does not disturb the current Mediawiki whilst allowing incremental changes in the direction of better rights management.
Comment 3 Alexandre Emsenhuber [IAlex] 2010-04-04 11:13:52 UTC
We already have the getUserPermissionsErrors hook (and its old version userCan) that passes a Title object in its arguments. Adding those parameters User::isAllowed() would only duplicate code as Brion said.

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