Dont let users increase pkt_msgs above 100
This commit is contained in:
parent
32d31cea90
commit
38fd1539a6
@ -23,7 +23,12 @@ class SystemRegisterRequest extends FormRequest
|
||||
|
||||
// @todo Also disallow claiming this hosts system
|
||||
|
||||
return Gate::allows($this->route('o')->users->count() ? 'update_nn' : 'register',$this->route('o'));
|
||||
return Gate::allows(
|
||||
$this->route('o')->users->count()
|
||||
? 'update_nn'
|
||||
: 'register',
|
||||
$this->route('o')
|
||||
);
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
@ -31,6 +36,7 @@ class SystemRegisterRequest extends FormRequest
|
||||
return [
|
||||
'hold' => 'Must be Yes or No',
|
||||
'pollmode' => 'Must be Hold, Normal or Crash',
|
||||
'pkt_msgs' => 'Sorry, only an admin can increase this above 100',
|
||||
];
|
||||
}
|
||||
|
||||
@ -70,7 +76,16 @@ class SystemRegisterRequest extends FormRequest
|
||||
'hold' => 'sometimes|boolean',
|
||||
'pollmode' => 'required|integer|min:0|max:2',
|
||||
'heartbeat' => 'nullable|integer|min:0|max:48',
|
||||
'pkt_msgs' => 'nullable|integer|min:5',
|
||||
'pkt_msgs' => [
|
||||
'nullable',
|
||||
function ($attribute,$value,$fail) {
|
||||
if (($value > 100) && (! Gate::allows('admin')))
|
||||
$fail(true);
|
||||
},
|
||||
'integer',
|
||||
'min:5',
|
||||
'max:65535',
|
||||
],
|
||||
] : []));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user