Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -92,6 +92,20 @@ |
93 | 93 | // Special handling for the main module: $parent === $this |
94 | 94 | parent :: __construct($this, $this->mInternalMode ? 'main_int' : 'main'); |
95 | 95 | |
| 96 | + if (!$this->mInternalMode) { |
| 97 | + |
| 98 | + // Impose module restrictions. |
| 99 | + // If the current user cannot read, |
| 100 | + // Remove all modules other than login & help |
| 101 | + global $wgUser, $wgWhitelistRead; |
| 102 | + if (!$wgUser->isAllowed('read')) { |
| 103 | + self::$Modules = array( |
| 104 | + 'login' => self::$Modules['login'], |
| 105 | + 'help' => self::$Modules['help'] |
| 106 | + ); |
| 107 | + } |
| 108 | + } |
| 109 | + |
96 | 110 | $this->mModules = self :: $Modules; |
97 | 111 | $this->mModuleNames = array_keys($this->mModules); // todo: optimize |
98 | 112 | $this->mFormats = self :: $Formats; |