/** * @expectedException Seat\Slackbot\Exceptions\SlackSettingException */ public function testTokenException() { // pre test Seat::set('slack_token', ''); // test $job = new SlackChannelsUpdate(); $job->handle(); }
/** * @param \Seat\Web\Http\Validation\SeatSettings $request * * @return \Illuminate\Http\RedirectResponse */ public function postUpdateSettings(SeatSettings $request) { Seat::set('registration', $request->registration); Seat::set('admin_contact', $request->admin_contact); Seat::set('force_min_mask', $request->force_min_mask); Seat::set('min_character_access_mask', $request->min_character_access_mask); Seat::set('min_corporation_access_mask', $request->min_corporation_access_mask); Seat::set('allow_sso', $request->allow_sso); Seat::set('allow_tracking', $request->allow_tracking); return redirect()->back()->with('success', 'SeAT settings updated!'); }
/** * Execute the console command. * * @return mixed */ public function handle() { $this->line('SeAT Admin Email Set Tool'); $this->info('The current admin email is: ' . Seat::get('admin_contact')); $this->question('Please enter the new administrator email address:'); $email = $this->ask('Email: '); while (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // invalid email address $this->error($email . ' is not a valid email. Please try again:'); $email = $this->ask('Email: '); } $this->info('Setting the administrator email to: ' . $email); Seat::set('admin_contact', $email); }
/** * Work with settings. * * Providing a string argument will retreive a setting. * Providing an array arguement will set a setting. * * @param $name * @param bool $global * * @return mixed * @throws \Seat\Services\Exceptions\SettingException */ function setting($name, bool $global = false) { // If we received an array, it means we want to set. if (is_array($name)) { // Check that we have at least 2 keys. if (count($name) < 2) { throw new \Seat\Services\Exceptions\SettingException('Must provide a name and value when setting a setting.'); } // If we have a third element in the array, set it. $for_id = $name[2] ?? null; if ($global) { return \Seat\Services\Settings\Seat::set($name[0], $name[1], $for_id); } return \Seat\Services\Settings\Profile::set($name[0], $name[1], $for_id); } // If we just got a string, it means we want to get. if ($global) { return \Seat\Services\Settings\Seat::get($name); } return \Seat\Services\Settings\Profile::get($name); }
public function postConfiguration(ValidateConfiguration $request) { Seat::set('slack_token', $request->input('slack-configuration-token')); return redirect()->back()->with('success', 'The Slack test token has been updated'); }
/** * Retreive a client-id from the cache. If none * exists, generate one. */ private function getClientID() { $id = Seat::get('analytics_id'); if (!$id) { // Generate a V4 random UUID // https://gist.github.com/dahnielson/508447#file-uuid-php-L74 $id = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)); // Set the generated UUID in the applications config Seat::set('analytics_id', $id); } return $id; }
/** * Handle the calling of the required function to * update the EVE SDE data. */ public function handle() { // Start by warning the user about the command that will be run $this->comment('Warning! This Laravel command uses exec() to execute a '); $this->comment('mysql shell command to import an extracted dump. Due'); $this->comment('to the way the command is constructed, should someone '); $this->comment('view the current running processes of your server, they '); $this->comment('will be able to see your SeAT database users password.'); $this->line(''); $this->line('Ensure that you understand this before continuing.'); // Test that we have valid Database details. An exception // will be thrown if this fails. DB::connection()->getDatabaseName(); if (!$this->confirm('Are you sure you want to update to the latest EVE SDE?', true)) { $this->warn('Exiting'); return; } // Request the json from eveseat/resources $this->json = $this->getJsonResource(); // Ensure we got a response, else fail. if (!$this->json) { $this->warn('Unable to reach the resources endpoint.'); return; } // Check if we should attempt getting the // version string locally if ($this->option('local')) { $version_number = env('SDE_VERSION', null); if (!is_null($version_number)) { $this->comment('Using locally sourced version number of: ' . $version_number); $this->json->version = env('SDE_VERSION'); } else { $this->warn('Unable to determine the version number override. ' . 'Using remote version: ' . $this->json->version); } } // Avoid an existing SDE to be accidentally installed again // except if the user explicitly ask for it if ($this->json->version == Seat::get('installed_sde') && $this->option('force') == false) { $this->warn('You are already running the latest SDE version.'); $this->warn('If you want to install it again, run this command with --force argument.'); return; } // Ask for a confirmation before installing an existing SDE version if ($this->option('force') == true) { $this->warn('You will re-download and install the current SDE version.'); if (!$this->confirm('Are you sure ?', true)) { $this->info('Nothing has been updated.'); return; } } //TODO: Allow for tables to be specified in config file // Show a final confirmation with some info on what // we are going to be doing. $this->info('The local SDE data will be updated to ' . $this->json->version); $this->info(count($this->json->tables) . ' tables will be updated: ' . implode(', ', $this->json->tables)); $this->info('Download format will be: ' . $this->json->format); $this->line(''); $this->info('The SDE will be imported to mysql://' . config('database.connections.mysql.username') . '@' . config('database.connections.mysql.host') . '/' . config('database.connections.mysql.database')); if (!$this->confirm('Does the above look OK?', true)) { $this->warn('Exiting'); return; } if (!$this->isStorageOk()) { $this->error('Storage path is not OK. Please check permissions'); return; } // Download the SDE's $this->getSde(); $this->importSde(); Seat::set('installed_sde', $this->json->version); $this->line('SDE Update Command Complete'); // Analytics dispatch((new Analytics((new AnalyticsContainer())->set('type', 'event')->set('ec', 'queues')->set('ea', 'update_sde')->set('el', 'console')->set('ev', $this->json->version)))->onQueue('medium')); return; }
/** * @param \Seat\Web\Validation\SeatSettings $request * * @return \Illuminate\Http\RedirectResponse */ public function postUpdateSettings(SeatSettings $request) { Seat::set('registration', $request->registration); Seat::set('admin_contact', $request->admin_contact); return redirect()->back()->with('success', 'SeAT settings updated!'); }