Implemented echoarea/filearea security

This commit is contained in:
2023-07-29 13:17:36 +10:00
parent f1ccca25ea
commit cd140971e2
22 changed files with 548 additions and 58 deletions

View File

@@ -35,7 +35,7 @@ class SystemController extends Controller
session()->flash('accordion','address');
$request->validate([
'action' => 'required|in:region,host,node',
'action' => 'required|in:region,host,node,update',
'zone_id' => 'required|exists:zones,id',
]);
@@ -166,6 +166,7 @@ class SystemController extends Controller
$o->addresses()->save($oo);
break;
case 'update':
case 'node':
$request->validate([
'region_id' => ['required',new FidoInteger],
@@ -181,7 +182,8 @@ class SystemController extends Controller
->where('zone_id',$request->post('zone_id'))
->where('host_id',$request->post('host_id'))
->where('node_id',$value)
->where('point_id',0);
->where('point_id',0)
->where('id','<>',$request->post('submit'));
});
if ($o->count()) {
@@ -202,7 +204,8 @@ class SystemController extends Controller
->where('zone_id',$request->post('zone_id'))
->where('host_id',$request->post('host_id'))
->where('node_id',$request->post('node_id'))
->where('point_id',$value);
->where('point_id',$value)
->where('id','<>',$request->post('submit'));
});
if ($o->count()) {
@@ -212,16 +215,19 @@ class SystemController extends Controller
],
'hub' => 'required|boolean',
'hub_id' => 'nullable|exists:addresses,id',
'security' => 'required|integer|min:0|max:7',
]);
$oo = new Address;
$oo = Address::findOrNew($request->post('submit'));
$oo->zone_id = $request->post('zone_id');
$oo->region_id = $request->post('region_id');
$oo->host_id = $request->post('host_id');
$oo->node_id = $request->post('node_id');
$oo->point_id = $request->post('point_id');
$oo->hub_id = $request->post('hub_id') > 0 ? $request->post('hub_id') : NULL;
$oo->role = ((! $oo->point_id) && $request->post('hub')) ? Address::NODE_HC : ($request->post('point_id') ? Address::NODE_POINT : Address::NODE_ACTIVE);
if (is_null($oo->role))
$oo->role = ((! $oo->point_id) && $request->post('hub')) ? Address::NODE_HC : ($request->post('point_id') ? Address::NODE_POINT : Address::NODE_ACTIVE);
$oo->security = $request->post('security');
$oo->active = TRUE;
$o->addresses()->save($oo);
@@ -317,6 +323,11 @@ class SystemController extends Controller
->map(function($item) { return ['id'=>(string)$item->id,'value'=>$item->ftn4d]; });
}
public function api_address_get(Address $o)
{
return $o;
}
/**
* Systems with no owners
*/