Fix binkp remote closing connection, add/delete session details, menu item this system, minor CSS fixes, move system form editing to individual files

This commit is contained in:
Deon George
2021-07-04 21:47:23 +10:00
parent d56681a187
commit acfde97e79
21 changed files with 1293 additions and 655 deletions

View File

@@ -4,7 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\{Address,System};
use App\Models\{Address,System,Zone};
use App\Rules\{FidoInteger,TwoByteInteger};
class SystemController extends Controller
@@ -24,6 +24,7 @@ class SystemController extends Controller
*/
public function add_address(Request $request,System $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('add_address',TRUE);
@@ -182,6 +183,35 @@ class SystemController extends Controller
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id));
}
/**
* Add Session details
*
* @param Request $request
* @param System $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function add_session(Request $request,System $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('add_session',TRUE);
$validate = $request->validate([
'zone_id' => 'required|exists:zones,id',
'sespass' => 'required|string|min:4',
'pktpass' => 'required|string|min:4|max:8',
'ticpass' => 'required|string|min:4',
'fixpass' => 'required|string|min:4',
]);
$zo = Zone::findOrFail($validate['zone_id']);
$o->sessions()->attach($zo,$validate);
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id));
}
/**
* Add or edit a node
*/
@@ -225,6 +255,7 @@ class SystemController extends Controller
*/
public function del_address(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('add_address',TRUE);
@@ -236,6 +267,28 @@ class SystemController extends Controller
return redirect()->to(sprintf('ftn/system/addedit/%d',$sid));
}
/**
* Delete address assigned to a host
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function del_session(System $o,Zone $zo)
{
$this->authorize('admin',$zo);
session()->flash('add_session',TRUE);
$o->sessions()->detach($zo);
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id));
}
public function ours()
{
return view('system.ours');
}
/**
* Suspend address assigned to a host
*
@@ -245,6 +298,7 @@ class SystemController extends Controller
*/
public function sus_address(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('add_address',TRUE);