After a brief planning discussion with Tim a few days ago, I'm
re-working the Title::userCan method. Once I'm done, and after code
review, on failure, the method will return, instead of false (although
that will still be returned for unexplainable events) an array
consisting of a message name, followed by a number of parameters which
are the arguments to the message. For example, being unable to edit
due to a block will return:
array ( $block->mAuto ? 'autoblockedtext' : 'blockedtext', $id,
$reason, $ip, $name, $blockid, $blockExpiry, $intended );
And being unable to edit due to cascading protection will return:
array( 'cascadeprotected', array_len( $cascadingSources ), $pages );
The purpose of these changes is to streamline the way access failures
are reported to the client. Currently, if userCan returns false, a
correct error message is guessed by the calling method. After these
changes, the message will be generated when the access failure is
detected. In addition, this method will be the only method that needs
to be called in order to ascertain whether a user can perform a
specific action on a specific page: block checks, readonly checks, and
other stuff is being folded into it, too.
This alteration is part of an effort I'm putting in to clean up and
streamline the permissions system.
Questions, comments, objections, abuse, and other feedback is welcome,
and will be appreciated.