Fixes for saving a new system
This commit is contained in:
@@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
use App\Classes\FTN\Packet;
|
||||
use App\Models\Setup;
|
||||
|
||||
class SystemRegisterRequest extends FormRequest
|
||||
{
|
||||
@@ -19,12 +18,10 @@ class SystemRegisterRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(Request $request)
|
||||
{
|
||||
if (! $request->post())
|
||||
if (! $request->post() || (! $this->route('o')))
|
||||
return TRUE;
|
||||
|
||||
// Cannot claim this site
|
||||
if ($this->route('o')->id === Setup::findOrFail(config('app.id'))->system_id)
|
||||
return FALSE;
|
||||
// @todo Also disallow claiming this hosts system
|
||||
|
||||
return Gate::allows($this->route('o')->users->count() ? 'update_nn' : 'register',$this->route('o'));
|
||||
}
|
||||
|
Reference in New Issue
Block a user