Fixes for saving a new system
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 41s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 2m8s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s

This commit is contained in:
2024-06-03 22:31:38 +10:00
parent 434226f8bc
commit 27cdb02b06
6 changed files with 23 additions and 12 deletions

View File

@@ -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'));
}