mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 05:32:39 +01:00
a7048ee61d
* Fixes for company factor * Add dates to create test data * Fixes for transformers, use faker to generate random dates * Bump to PHP 7.4git add app/Http/Requests/User/DetachCompanyUserRequest.php * Fixes for route model binding
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
*
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
|
*
|
|
* @license https://opensource.org/licenses/AAL
|
|
*/
|
|
|
|
namespace App\Http\Requests\User;
|
|
|
|
use App\Http\Requests\Request;
|
|
use App\Models\User;
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
class AttachCompanyUserRequest extends Request
|
|
{
|
|
use MakesHash;
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
|
|
public function authorize() : bool
|
|
{
|
|
return auth()->user()->isAdmin();
|
|
}
|
|
|
|
protected function prepareForValidation()
|
|
{
|
|
|
|
$this->replace([
|
|
'is_admin' => isset($request->input('is_admin')) ? $request->input('is_admin') : false,
|
|
'permissions' => isset($request->input('permissions')) ? $request->input('permissions') : '',
|
|
'settings' => isset($request->input('settings')) ? $request->input('settings') : json_encode(DefaultSettings::userSettings()),
|
|
'is_locked' => isset($request->input('is_locked')) ? $request->input('is_locked') : false,
|
|
'is_owner' => false,
|
|
]);
|
|
}
|
|
|
|
|
|
} |