Wi-Fi access becomes an explicit per-role allow-list
This commit is contained in:
@@ -32,7 +32,7 @@ class PortalController extends Controller
|
||||
{
|
||||
$data = $request->validate([
|
||||
'group_name' => 'required|string|max:255',
|
||||
'match_type' => 'required|in:ou,group,email_domain,default',
|
||||
'match_type' => 'required|in:ou,group,email_domain,role',
|
||||
'match_value' => 'required|string|max:255',
|
||||
'vlan_id' => 'required|integer|min:1|max:4094',
|
||||
'max_devices' => 'required|integer|min:1|max:50',
|
||||
@@ -51,7 +51,7 @@ class PortalController extends Controller
|
||||
{
|
||||
$data = $request->validate([
|
||||
'group_name' => 'required|string|max:255',
|
||||
'match_type' => 'required|in:ou,group,email_domain,default',
|
||||
'match_type' => 'required|in:ou,group,email_domain,role',
|
||||
'match_value' => 'required|string|max:255',
|
||||
'vlan_id' => 'required|integer|min:1|max:4094',
|
||||
'max_devices' => 'required|integer|min:1|max:50',
|
||||
@@ -256,7 +256,16 @@ class PortalController extends Controller
|
||||
'email_domain' => str_ends_with($user->email ?? '', '@' . $mapping->match_value),
|
||||
'group' => $user->groups?->contains('name', $mapping->match_value) ?? false,
|
||||
'ou' => str_contains($user->ou ?? '', $mapping->match_value),
|
||||
'default' => true,
|
||||
/*
|
||||
* Roles are the platform's own authority and need no external
|
||||
* sync to be correct, which is why quotas key off them.
|
||||
*
|
||||
* `default` is deliberately absent. It matched everybody, so its
|
||||
* existence made this an advisory list rather than an allow-list.
|
||||
* Returning null here is already the deny path: captiveCallback
|
||||
* renders "No WiFi access configured for your account."
|
||||
*/
|
||||
'role' => $user->hasRole($mapping->match_value),
|
||||
default => false,
|
||||
};
|
||||
if ($matched) return $mapping;
|
||||
|
||||
Reference in New Issue
Block a user