2016-09-01 18:31:39 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* ConfigurationRequest.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-05 06:52:15 +02:00
|
|
|
* This software may be modified and distributed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
*
|
|
|
|
* See the LICENSE file for details.
|
2016-09-01 18:31:39 +02:00
|
|
|
*/
|
|
|
|
|
2017-04-09 07:44:22 +02:00
|
|
|
declare(strict_types=1);
|
2016-09-01 18:31:39 +02:00
|
|
|
|
|
|
|
namespace FireflyIII\Http\Requests;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ConfigurationRequest
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Http\Requests
|
|
|
|
*/
|
|
|
|
class ConfigurationRequest extends Request
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
|
|
|
// Only allow logged in users and admins
|
2016-09-16 12:15:58 +02:00
|
|
|
return auth()->check() && auth()->user()->hasRole('owner');
|
2016-09-01 18:31:39 +02:00
|
|
|
}
|
|
|
|
|
2016-10-23 12:10:22 +02:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getConfigurationData(): array
|
|
|
|
{
|
|
|
|
return [
|
2017-01-21 08:32:23 +01:00
|
|
|
'single_user_mode' => $this->boolean('single_user_mode'),
|
|
|
|
'is_demo_site' => $this->boolean('is_demo_site'),
|
2016-10-23 12:10:22 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2016-09-01 18:31:39 +02:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
2017-09-12 21:44:31 +02:00
|
|
|
// fixed
|
2016-09-01 18:31:39 +02:00
|
|
|
$rules = [
|
2016-12-30 13:47:23 +01:00
|
|
|
'single_user_mode' => 'between:0,1|numeric',
|
|
|
|
'is_demo_site' => 'between:0,1|numeric',
|
2016-09-01 18:31:39 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
return $rules;
|
|
|
|
}
|
|
|
|
}
|