public static function Update() { // Learn about all of the banned calls that // we are aware of $banned_calls = \EveBannedCall::all(); // For every banned call that we have, prepare // a notification to send foreach ($banned_calls as $banned_call) { // Super users will be receiving this notification, // so loop over the current superusers that we // have foreach (\Auth::findAllUsersWithAccess('superuser') as $super_user) { // Compile the full notification $notification_type = 'API'; $notification_title = 'Banned Call'; $notification_text = 'The SeAT backend has banned the ' . $banned_call->scope . '\\' . $banned_call->api . ' API call for key ' . $banned_call->ownerID . '. Reason: ' . $banned_call->reason . PHP_EOL . 'Key characters: ' . PHP_EOL; // Add some information about the characters on this key foreach (\EveAccountAPIKeyInfoCharacters::where('keyID', $banned_call->ownerID)->get() as $character) { $notification_text .= ' - ' . $character->characterName . PHP_EOL; } // Send the notification BaseNotify::sendNotification($super_user->id, $notification_type, $notification_title, $notification_text); } } }
public function getRemoveAllBans() { // Ensure that this is SuperUser if (!\Auth::isSuperUser()) { App::abort(404); } // Trash all of the banned calls information EveBannedCall::truncate(); // Enable all of the keys SeatKey::where('isOk', 0)->update(array('isOk' => 1, 'lastError' => null)); // Redirect with a message return Redirect::action('ApiKeyController@getAll')->with('success', 'All API keys have been enabled and their bans removed.'); }
public static function isBannedCall($api, $scope, $owner = 0, $accessMask = 0) { // Check if we should retreive the current access mask if ($accessMask == 0) { $accessMask = \EveAccountAPIKeyInfo::where('keyID', '=', $owner)->pluck('accessMask'); } $hash = BaseApi::makeCallHash($api, $scope, $owner . $accessMask); $banned = \EveBannedCall::where('hash', '=', $hash)->first(); if ($banned) { return true; } else { return false; } }