Fix creating a system with the correct role, Fix need to have hold/active on creation

This commit is contained in:
Deon George 2022-03-01 22:07:08 +11:00
parent 6db16712ee
commit cf3b1947a4
2 changed files with 23 additions and 26 deletions

View File

@ -31,6 +31,7 @@ class SystemController extends Controller
*/
public function add_address(Request $request,System $o)
{
// @todo a point address is failing validation
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
@ -161,7 +162,7 @@ class SystemController extends Controller
$oo->host_id = $request->post('host_id_new');
$oo->node_id = $request->post('node_id_new');
$oo->point_id = 0;
$oo->role = Address::NODE_NC;
$oo->role = Address::NODE_ACTIVE;
$oo->active = TRUE;
$o->addresses()->save($oo);
@ -204,7 +205,7 @@ class SystemController extends Controller
$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 : Address::NODE_ACTIVE;
$oo->role = ((! $oo->point_id) && $request->post('hub')) ? Address::NODE_HC : Address::NODE_ACTIVE;
$oo->active = TRUE;
$o->addresses()->save($oo);

View File

@ -21,7 +21,6 @@
<!-- Active -->
<div class="col-2">
@if($o->exists)
@can('update',$o)
<label for="active" class="form-label">Active</label>
<div class="input-group">
@ -34,12 +33,10 @@
</div>
</div>
@endcan
@endif
</div>
<!-- Hold -->
<div class="col-2">
@if($o->exists)
@can('update',$o)
<label for="hold" class="form-label">Hold Mail</label>
<div class="input-group">
@ -52,7 +49,6 @@
</div>
</div>
@endcan
@endif
</div>
<!-- ZeroTier ID -->