| Index: trunk/phase3/includes/api/ApiMain.php |
| — | — | @@ -179,12 +179,19 @@ |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | | - * This method will simply cause an error if the write mode was disabled for this api. |
| | 183 | + * This method will simply cause an error if the write mode was disabled |
| | 184 | + * or if the current user doesn't have the right to use it |
| 184 | 185 | */ |
| 185 | 186 | public function requestWriteMode() { |
| | 187 | + global $wgUser; |
| 186 | 188 | if (!$this->mEnableWrite) |
| 187 | | - $this->dieUsage('Editing of this site is disabled. Make sure the $wgEnableWriteAPI=true; ' . |
| 188 | | - 'statement is included in the site\'s LocalSettings.php file', 'noapiwrite'); |
| | 189 | + $this->dieUsage('Editing of this wiki through the API' . |
| | 190 | + ' is disabled. Make sure the $wgEnableWriteAPI=true; ' . |
| | 191 | + 'statement is included in the wiki\'s ' . |
| | 192 | + 'LocalSettings.php file', 'noapiwrite'); |
| | 193 | + if (!$wgUser->isAllowed('writeapi')) |
| | 194 | + $this->dieUsage('You\'re not allowed to edit this ' . |
| | 195 | + 'wiki through the API', 'writeapidenied'); |
| 189 | 196 | } |
| 190 | 197 | |
| 191 | 198 | /** |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -1083,6 +1083,7 @@ |
| 1084 | 1084 | $wgGroupPermissions['*' ]['edit'] = true; |
| 1085 | 1085 | $wgGroupPermissions['*' ]['createpage'] = true; |
| 1086 | 1086 | $wgGroupPermissions['*' ]['createtalk'] = true; |
| | 1087 | +$wgGroupPermissions['*' ]['writeapi'] = true; |
| 1087 | 1088 | |
| 1088 | 1089 | // Implicit group for all logged-in accounts |
| 1089 | 1090 | $wgGroupPermissions['user' ]['move'] = true; |
| — | — | @@ -1090,6 +1091,7 @@ |
| 1091 | 1092 | $wgGroupPermissions['user' ]['edit'] = true; |
| 1092 | 1093 | $wgGroupPermissions['user' ]['createpage'] = true; |
| 1093 | 1094 | $wgGroupPermissions['user' ]['createtalk'] = true; |
| | 1095 | +$wgGroupPermissions['user' ]['writeapi'] = true; |
| 1094 | 1096 | $wgGroupPermissions['user' ]['upload'] = true; |
| 1095 | 1097 | $wgGroupPermissions['user' ]['reupload'] = true; |
| 1096 | 1098 | $wgGroupPermissions['user' ]['reupload-shared'] = true; |
| — | — | @@ -1107,6 +1109,7 @@ |
| 1108 | 1110 | $wgGroupPermissions['bot' ]['autopatrol'] = true; |
| 1109 | 1111 | $wgGroupPermissions['bot' ]['suppressredirect'] = true; |
| 1110 | 1112 | $wgGroupPermissions['bot' ]['apihighlimits'] = true; |
| | 1113 | +$wgGroupPermissions['bot' ]['writeapi'] = true; |
| 1111 | 1114 | #$wgGroupPermissions['bot' ]['editprotected'] = true; // can edit all protected pages without cascade protection enabled |
| 1112 | 1115 | |
| 1113 | 1116 | // Most extra permission abilities go to this group |