Index: trunk/extensions/Translate/TranslateTasks.php |
— | — | @@ -167,6 +167,14 @@ |
168 | 168 | $callback = $this->options->getPagingCB(); |
169 | 169 | call_user_func( $callback, $this->options->getOffset(), $left, $total ); |
170 | 170 | } |
| 171 | + |
| 172 | + /** |
| 173 | + * Override this method if the task depends on user rights. |
| 174 | + * @return \string |
| 175 | + */ |
| 176 | + public function isAllowedFor( User $user ) { |
| 177 | + return true; |
| 178 | + } |
171 | 179 | } |
172 | 180 | |
173 | 181 | /** |
— | — | @@ -343,6 +351,10 @@ |
344 | 352 | $this->collection->filter( 'reviewer', true, $wgUser->getId() ); |
345 | 353 | $this->collection->filter( 'last-translator', true, $wgUser->getId() ); |
346 | 354 | } |
| 355 | + |
| 356 | + public function isAllowedFor( User $user ) { |
| 357 | + return $user->isAllowed( 'translate-messagereview' ); |
| 358 | + } |
347 | 359 | } |
348 | 360 | |
349 | 361 | /** |
Index: trunk/extensions/Translate/specials/SpecialTranslate.php |
— | — | @@ -262,13 +262,16 @@ |
263 | 263 | /* Selectors ahead */ |
264 | 264 | |
265 | 265 | protected function taskSelector( $pageTranslation = false ) { |
| 266 | + global $wgUser; |
266 | 267 | $selector = new XmlSelect( 'task', 'task' ); |
267 | 268 | $selector->setDefault( $this->options['task'] ); |
268 | 269 | |
269 | 270 | $isPageTranslation = $this->group instanceof WikiPageMessageGroup; |
270 | 271 | foreach ( TranslateTasks::getTasks( $isPageTranslation ) as $id ) { |
271 | | - $label = TranslateTask::labelForTask( $id ); |
272 | | - $selector->addOption( $label, $id ); |
| 272 | + if ( TranslateTasks::getTask( $id )->isAllowedFor( $wgUser ) ) { |
| 273 | + $label = TranslateTask::labelForTask( $id ); |
| 274 | + $selector->addOption( $label, $id ); |
| 275 | + } |
273 | 276 | } |
274 | 277 | |
275 | 278 | return $selector->getHTML(); |