(bug 4860) Expose Title->userCan() as Hooks
authorRob Church <robchurch@users.mediawiki.org>
Sun, 5 Feb 2006 18:47:40 +0000 (18:47 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sun, 5 Feb 2006 18:47:40 +0000 (18:47 +0000)
RELEASE-NOTES
includes/Title.php

index c8add10..4c1f949 100644 (file)
@@ -598,6 +598,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * Reset $wgActionPaths during parser test; corrects some false failures
   in the automated test report.
 * (bug 4875) Define a div containing the shared image description
+* (bug 4860) Expose Title->userCan() as Hooks
 
 === Caveats ===
 
index 4cbaa14..4cfce2b 100644 (file)
@@ -927,6 +927,13 @@ class Title {
                wfProfileIn( $fname );
 
                global $wgUser;
+
+               $result = true;
+               if ( !wfRunHooks( 'userCan', array( &$this, &$wgUser, $action, &$result ) ) ) {
+                       wfProfileOut( $fname );
+                       return $result;
+               }
+
                if( NS_SPECIAL == $this->mNamespace ) {
                        wfProfileOut( $fname );
                        return false;
@@ -1030,6 +1037,11 @@ class Title {
        function userCanRead() {
                global $wgUser;
 
+               $result = true;
+                       if ( !wfRunHooks( 'userCan', array( &$this, &$wgUser, "read", &$result ) ) ) {
+                       return $result;
+               }
+
                if( $wgUser->isAllowed('read') ) {
                        return true;
                } else {