Index: branches/wmf/1.17wmf1/extensions/SecurePoll/SecurePoll.i18n.php |
— | — | @@ -75,6 +75,7 @@ |
76 | 76 | 'securepoll-not-logged-in' => 'You must log in to vote in this election', |
77 | 77 | 'securepoll-too-few-edits' => 'Sorry, you cannot vote. You need to have made at least $1 {{PLURAL:$1|edit|edits}} to vote in this election, you have made $2.', |
78 | 78 | 'securepoll-blocked' => 'Sorry, you cannot vote in this election if you are currently blocked from editing.', |
| 79 | + 'securepoll-blocked-centrally' => 'Sorry, you cannot vote in this election if you are blocked on $1 or more {{PLURAL:$1|wiki|wikis}}.', |
79 | 80 | 'securepoll-bot' => 'Sorry, accounts with the bot flag are not allowed to vote in this election.', |
80 | 81 | 'securepoll-not-in-group' => 'Only members of the "$1" group can vote in this election.', |
81 | 82 | 'securepoll-not-in-list' => 'Sorry, you are not in the predetermined list of users authorised to vote in this election.', |
Index: branches/wmf/1.17wmf1/extensions/SecurePoll/includes/entities/Election.php |
— | — | @@ -31,6 +31,10 @@ |
32 | 32 | * True if a voter is not allowed to change their vote |
33 | 33 | * encrypt-type |
34 | 34 | * The encryption module name |
| 35 | + * not-centrally-blocked |
| 36 | + * True if voters need to not be blocked on more than X projects |
| 37 | + * central-block-threshold |
| 38 | + * Number of blocks across projects that disqualify a user from voting. |
35 | 39 | * |
36 | 40 | * See the other module for documentation of the following. |
37 | 41 | * |
— | — | @@ -169,6 +173,14 @@ |
170 | 174 | if ( $notBlocked && $isBlocked ) { |
171 | 175 | $status->fatal( 'securepoll-blocked' ); |
172 | 176 | } |
| 177 | + |
| 178 | + # Centrally blocked on more than X projects |
| 179 | + $notCentrallyBlocked = $this->getProperty( 'not-centrally-blocked' ); |
| 180 | + $centralBlockCount = isset( $props['central-block-count'] ) ? $props['central-block-count'] : 0; |
| 181 | + $centralBlockThreshold = $this->getProperty( 'central-block-threshold', 1 ); |
| 182 | + if ( $centralBlockCount >= $centralBlockThreshold ) { |
| 183 | + $status->fatal( 'securepoll-blocked-centrally', $centralBlockThreshold ); |
| 184 | + } |
173 | 185 | |
174 | 186 | # Bot |
175 | 187 | $notBot = $this->getProperty( 'not-bot' ); |
— | — | @@ -198,6 +210,7 @@ |
199 | 211 | $status = Status::newFatal( 'securepoll-custom-unqualified', $errorMsg ); |
200 | 212 | } |
201 | 213 | } |
| 214 | + |
202 | 215 | return $status; |
203 | 216 | } |
204 | 217 | |
Index: branches/wmf/1.17wmf1/extensions/SecurePoll/includes/user/Auth.php |
— | — | @@ -209,6 +209,7 @@ |
210 | 210 | 'properties' => array( |
211 | 211 | 'wiki' => wfWikiID(), |
212 | 212 | 'blocked' => $user->isBlocked(), |
| 213 | + 'central-block-count' => $this->getCentralBlockCount( $user ), |
213 | 214 | 'edit-count' => $user->getEditCount(), |
214 | 215 | 'bot' => $user->isAllowed( 'bot' ), |
215 | 216 | 'language' => $user->getOption( 'language' ), |
— | — | @@ -216,6 +217,7 @@ |
217 | 218 | 'lists' => $this->getLists( $user ) |
218 | 219 | ) |
219 | 220 | ); |
| 221 | + |
220 | 222 | wfRunHooks( 'SecurePoll_GetUserParams', array( $this, $user, &$params ) ); |
221 | 223 | return $params; |
222 | 224 | } |
— | — | @@ -239,6 +241,30 @@ |
240 | 242 | } |
241 | 243 | return $lists; |
242 | 244 | } |
| 245 | + |
| 246 | + /** |
| 247 | + * Checks how many central wikis the user is blocked on |
| 248 | + * @param $user User |
| 249 | + * @return Integer the number of wikis the user is blocked on. |
| 250 | + */ |
| 251 | + function getCentralBlockCount( $user ) { |
| 252 | + if ( ! class_exists( 'CentralAuthUser' ) ) { |
| 253 | + return 0; |
| 254 | + } |
| 255 | + |
| 256 | + $centralUser = new CentralAuthUser( $user ); |
| 257 | + |
| 258 | + $attached = $centralUser->queryAttached(); |
| 259 | + $blockCount = 0; |
| 260 | + |
| 261 | + foreach( $attached as $wiki => $data ) { |
| 262 | + if ( $data['blocked'] ) { |
| 263 | + $blockCount++; |
| 264 | + } |
| 265 | + } |
| 266 | + |
| 267 | + return $blockCount; |
| 268 | + } |
243 | 269 | } |
244 | 270 | |
245 | 271 | /** |
Property changes on: branches/wmf/1.17wmf1/extensions/SecurePoll |
___________________________________________________________________ |
Added: svn:mergeinfo |
246 | 272 | Merged /branches/sqlite/extensions/SecurePoll:r58211-58321 |
247 | 273 | Merged /trunk/phase3/extensions/SecurePoll:r79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,80406,81833,83212,83590 |
248 | 274 | Merged /branches/new-installer/phase3/extensions/SecurePoll:r43664-66004 |
249 | 275 | Merged /branches/wmf-deployment/extensions/SecurePoll:r60970 |
250 | 276 | Merged /branches/REL1_15/phase3/extensions/SecurePoll:r51646 |
251 | 277 | Merged /branches/wmf/1.16wmf4/extensions/SecurePoll:r67177,69199,76243,77266 |
252 | 278 | Merged /trunk/extensions/SecurePoll:r89020 |