Compare commits
No commits in common. "f4f8e9fa94f7089c3d1c03bd724ade5afc798a47" and "32d31cea90c18f4b1baff41fa82577ffee8ee23d" have entirely different histories.
f4f8e9fa94
...
32d31cea90
@ -23,12 +23,7 @@ class SystemRegisterRequest extends FormRequest
|
|||||||
|
|
||||||
// @todo Also disallow claiming this hosts system
|
// @todo Also disallow claiming this hosts system
|
||||||
|
|
||||||
return Gate::allows(
|
return Gate::allows($this->route('o')->users->count() ? 'update_nn' : 'register',$this->route('o'));
|
||||||
$this->route('o')->users->count()
|
|
||||||
? 'update_nn'
|
|
||||||
: 'register',
|
|
||||||
$this->route('o')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function messages(): array
|
public function messages(): array
|
||||||
@ -36,7 +31,6 @@ class SystemRegisterRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'hold' => 'Must be Yes or No',
|
'hold' => 'Must be Yes or No',
|
||||||
'pollmode' => 'Must be Hold, Normal or Crash',
|
'pollmode' => 'Must be Hold, Normal or Crash',
|
||||||
'pkt_msgs' => 'Sorry, only an admin can increase this above 100',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,16 +70,7 @@ class SystemRegisterRequest extends FormRequest
|
|||||||
'hold' => 'sometimes|boolean',
|
'hold' => 'sometimes|boolean',
|
||||||
'pollmode' => 'required|integer|min:0|max:2',
|
'pollmode' => 'required|integer|min:0|max:2',
|
||||||
'heartbeat' => 'nullable|integer|min:0|max:48',
|
'heartbeat' => 'nullable|integer|min:0|max:48',
|
||||||
'pkt_msgs' => [
|
'pkt_msgs' => 'nullable|integer|min:5',
|
||||||
'nullable',
|
|
||||||
function ($attribute,$value,$fail) {
|
|
||||||
if (($value > 100) && (! Gate::allows('admin')))
|
|
||||||
$fail(true);
|
|
||||||
},
|
|
||||||
'integer',
|
|
||||||
'min:5',
|
|
||||||
'max:65535',
|
|
||||||
],
|
|
||||||
] : []));
|
] : []));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,14 +19,17 @@ class NetmailPolicy
|
|||||||
*/
|
*/
|
||||||
public function view(User $user, Netmail $o): bool
|
public function view(User $user, Netmail $o): bool
|
||||||
{
|
{
|
||||||
$addresses = $user->addresses()->pluck('id');
|
$zones = $user->zc()->pluck('zone')
|
||||||
|
//->merge($user->rc()->pluck('zone'))
|
||||||
|
//->merge($user->nc()->pluck('zone'))
|
||||||
|
//->merge($user->hub()->pluck('zone'))
|
||||||
|
->merge($user->points()->pluck('zone'));
|
||||||
|
|
||||||
// Site Admins can always view
|
// Site Admins can always view
|
||||||
return (
|
return (
|
||||||
$user->isAdmin()
|
$user->isAdmin()
|
||||||
|| $user->isZC()
|
|| ($zones->contains($o->fftn->zone))
|
||||||
|| ($addresses->contains($o->fftn_id))
|
|| ($zones->contains($o->tftn->zone))
|
||||||
|| ($addresses->contains($o->tftn_id))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -159,7 +159,7 @@ use App\Models\{Mailer,User};
|
|||||||
<span class="input-group-text"><i class="bi bi-modem-fill"></i></span>
|
<span class="input-group-text"><i class="bi bi-modem-fill"></i></span>
|
||||||
<input type="text" class="form-control text-end @error('mailer_details.'.$mo->id.'.port') is-invalid @enderror" id="mailer_port_{{ $mo->id }}" placeholder="Port" name="mailer_details[{{ $mo->id }}][port]" value="{{ old('mailer_details.'.$mo->id.'.port',$x?->pivot->port) }}" @cannot($action,$o)readonly @endcannot>
|
<input type="text" class="form-control text-end @error('mailer_details.'.$mo->id.'.port') is-invalid @enderror" id="mailer_port_{{ $mo->id }}" placeholder="Port" name="mailer_details[{{ $mo->id }}][port]" value="{{ old('mailer_details.'.$mo->id.'.port',$x?->pivot->port) }}" @cannot($action,$o)readonly @endcannot>
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<input type="checkbox" class="form-control-input" name="mailer_details[{{ $mo->id }}][active]" value="1" title="Active" @if(old('mailer_details.'.$mo->id.'.active',$x?->pivot->active))checked @endif @cannot($action,$o)disabled @endcannot>
|
<input type="checkbox" class="form-control-input" name="mailer_details[{{ $mo->id }}][active]" value="1" title="Active" @if(old('mailer_details.'.$mo->id.'.active',$x?->pivot->active))checked @endif>
|
||||||
</div>
|
</div>
|
||||||
<span class="invalid-feedback" role="alert">
|
<span class="invalid-feedback" role="alert">
|
||||||
@error('mailer_details.'.$mo->id.'.port')
|
@error('mailer_details.'.$mo->id.'.port')
|
||||||
@ -177,7 +177,7 @@ use App\Models\{Mailer,User};
|
|||||||
<label for="pkt_type" class="form-label">Mail Packet</label>
|
<label for="pkt_type" class="form-label">Mail Packet</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
|
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
|
||||||
<select class="form-select @error('pkt_type') is-invalid @enderror" id="pkt_type" name="pkt_type" @cannot($action,$o)disabled @endcannot>
|
<select class="form-select @error('pkt_type') is-invalid @enderror" id="pkt_type" name="pkt_type" @cannot($action,$o)readonly @endcannot>
|
||||||
@foreach (Packet::PACKET_TYPES as $type => $class)
|
@foreach (Packet::PACKET_TYPES as $type => $class)
|
||||||
<option value="{{ $type }}" @if(old('pkt_type',$o->pkt_type ?: config('fido.packet_default')) === $type)selected @endif>{{ $type }}</option>
|
<option value="{{ $type }}" @if(old('pkt_type',$o->pkt_type ?: config('fido.packet_default')) === $type)selected @endif>{{ $type }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -217,7 +217,7 @@ use App\Models\{Mailer,User};
|
|||||||
<label for="method" class="form-label">Connection Method</label>
|
<label for="method" class="form-label">Connection Method</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text"><i class="bi bi-wifi"></i></span>
|
<span class="input-group-text"><i class="bi bi-wifi"></i></span>
|
||||||
<select class="form-select @error('method') is-invalid @enderror" id="method" name="method" @cannot($action,$o)disabled @endcannot>
|
<select class="form-select @error('method') is-invalid @enderror" id="method" name="method" @cannot($action,$o)readonly @endcannot>
|
||||||
<option></option>
|
<option></option>
|
||||||
<option value="23" @if(old('method',$o->method) == 23)selected @endif>Telnet</option>
|
<option value="23" @if(old('method',$o->method) == 23)selected @endif>Telnet</option>
|
||||||
<option value="22" @if(old('method',$o->method) == 22)selected @endif>SSH</option>
|
<option value="22" @if(old('method',$o->method) == 22)selected @endif>SSH</option>
|
||||||
@ -303,7 +303,6 @@ use App\Models\{Mailer,User};
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row p-0">
|
<div class="row p-0">
|
||||||
@can('admin',$o)
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<label for="autohold" class="form-label">Auto Hold</label>
|
<label for="autohold" class="form-label">Auto Hold</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -312,6 +311,7 @@ use App\Models\{Mailer,User};
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- @todo This is only relevant for uplinks, so hide it if this system isnt an uplink -->
|
<!-- @todo This is only relevant for uplinks, so hide it if this system isnt an uplink -->
|
||||||
|
@can('admin',$o)
|
||||||
<div class="col-6 @if((old('pollmode') === "0") || is_null($o->pollmode))d-none @endif" id="heartbeat_option">
|
<div class="col-6 @if((old('pollmode') === "0") || is_null($o->pollmode))d-none @endif" id="heartbeat_option">
|
||||||
<label for="heartbeat" class="form-label">Heartbeat <i class="bi bi-info-circle" title="Attempt contact after last seen"></i></label>
|
<label for="heartbeat" class="form-label">Heartbeat <i class="bi bi-info-circle" title="Attempt contact after last seen"></i></label>
|
||||||
<div class="input-group has-validation">
|
<div class="input-group has-validation">
|
||||||
@ -438,9 +438,7 @@ use App\Models\{Mailer,User};
|
|||||||
@else
|
@else
|
||||||
<input type="hidden" name="system_id" value="{{ $o->id }}">
|
<input type="hidden" name="system_id" value="{{ $o->id }}">
|
||||||
<span><small><strong>NOTE:</strong> You'll be able to update these details after registration is completed.</small></span>
|
<span><small><strong>NOTE:</strong> You'll be able to update these details after registration is completed.</small></span>
|
||||||
{{--
|
|
||||||
<button type="submit" class="btn btn-success float-end" name="submit" value="register">Register</button>
|
<button type="submit" class="btn btn-success float-end" name="submit" value="register">Register</button>
|
||||||
--}}
|
|
||||||
@endcan
|
@endcan
|
||||||
@else
|
@else
|
||||||
<button type="submit" class="btn btn-success float-end" name="submit" value="create">Register</button>
|
<button type="submit" class="btn btn-success float-end" name="submit" value="create">Register</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user