Changeset View
Changeset View
Standalone View
Standalone View
support/startup/PhabricatorClientRateLimit.php
| Show All 29 Lines | final class PhabricatorClientRateLimit | ||||
| } | } | ||||
| protected function getDisconnectScore(array $request_state) { | protected function getDisconnectScore(array $request_state) { | ||||
| $score = 1; | $score = 1; | ||||
| // If the user was logged in, let them make more requests. | // If the user was logged in, let them make more requests. | ||||
| if (isset($request_state['viewer'])) { | if (isset($request_state['viewer'])) { | ||||
| $viewer = $request_state['viewer']; | $viewer = $request_state['viewer']; | ||||
| if ($viewer->isLoggedIn()) { | if ($viewer->isOmnipotent()) { | ||||
| // If the viewer was omnipotent, this was an intracluster request or | |||||
| // some other kind of special request, so don't give it any points | |||||
| // toward rate limiting. | |||||
| $score = 0; | |||||
| } else if ($viewer->isLoggedIn()) { | |||||
| // If the viewer was logged in, give them fewer points than if they | |||||
| // were logged out, since this traffic is much more likely to be | |||||
| // legitimate. | |||||
| $score = 0.25; | $score = 0.25; | ||||
| } | } | ||||
| } | } | ||||
| return $score; | return $score; | ||||
| } | } | ||||
| protected function getRateLimitReason($score) { | protected function getRateLimitReason($score) { | ||||
| Show All 12 Lines | |||||