Last modified: 2011-03-13 18:04:55 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 T12758, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10758 - Add a Title parameter to User::isAllowed()
Add a Title parameter to User::isAllowed()
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.11.x
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  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: ---


Attachments

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() );
        }
</source>

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.


Navigation
Links