Index: trunk/extensions/Translate/api/ApiTranslationReview.php |
— | — | @@ -13,11 +13,12 @@ |
14 | 14 | * @ingroup API TranslateAPI |
15 | 15 | */ |
16 | 16 | class ApiTranslationReview extends ApiBase { |
| 17 | + protected static $right = 'translate-messagereview'; |
17 | 18 | |
18 | 19 | public function execute() { |
19 | 20 | global $wgUser; |
20 | | - if ( !$wgUser->isallowed( 'translate-messagereview' ) ) { |
21 | | - $this->dieUsageMsg( 'permissiondenied' ); |
| 21 | + if ( !$wgUser->isallowed( self::$right ) ) { |
| 22 | + $this->dieUsage( 'Permission denied', 'permissiondenied' ); |
22 | 23 | } |
23 | 24 | |
24 | 25 | $params = $this->extractRequestParams(); |
— | — | @@ -104,8 +105,9 @@ |
105 | 106 | } |
106 | 107 | |
107 | 108 | public function getPossibleErrors() { |
| 109 | + $right = self::$right; |
108 | 110 | return array_merge( parent::getPossibleErrors(), array( |
109 | | - array( 'code' => 'permissiondenied', 'info' => 'You must have translate-messagereview right' ), |
| 111 | + array( 'code' => 'permissiondenied', 'info' => "You must have $right right" ), |
110 | 112 | array( 'code' => 'unknownmessage', 'info' => 'Title $1 does not belong to a message group' ), |
111 | 113 | array( 'code' => 'fuzzymessage', 'info' => 'Cannot review fuzzy translations' ), |
112 | 114 | array( 'code' => 'owntranslation', 'info' => 'Cannot review own translations' ), |
— | — | @@ -125,7 +127,7 @@ |
126 | 128 | |
127 | 129 | public static function getToken( $pageid, $title ) { |
128 | 130 | global $wgUser; |
129 | | - if ( !$wgUser->isAllowed( 'translate-messagereview' ) ) { |
| 131 | + if ( !$wgUser->isAllowed( self::$right ) ) { |
130 | 132 | return false; |
131 | 133 | } |
132 | 134 | |
— | — | @@ -134,7 +136,7 @@ |
135 | 137 | return $cachedToken; |
136 | 138 | } |
137 | 139 | |
138 | | - $cachedToken = $wgUser->editToken( 'translate-messagereview' ); |
| 140 | + $cachedToken = $wgUser->editToken( $this->getTokenSalt() ); |
139 | 141 | return $cachedToken; |
140 | 142 | } |
141 | 143 | |