Record whether a portal session used a private Wi-Fi address
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the device presented a private (randomized) address.
|
||||||
|
*
|
||||||
|
* Nullable, because rows written before this existed genuinely do not know —
|
||||||
|
* defaulting them to false would assert something untrue about every historical
|
||||||
|
* session.
|
||||||
|
*/
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('unifi_portal_sessions', function (Blueprint $table) {
|
||||||
|
$table->boolean('is_randomized')->nullable()->after('mac_address');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('unifi_portal_sessions', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('is_randomized');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -208,6 +208,7 @@ class PortalController extends Controller
|
|||||||
'is_active' => true,
|
'is_active' => true,
|
||||||
'authorized_at' => now(),
|
'authorized_at' => now(),
|
||||||
'expires_at' => now()->addMinutes($minutes),
|
'expires_at' => now()->addMinutes($minutes),
|
||||||
|
'is_randomized' => $isRandomized,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ class PortalSession extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id', 'mac_address', 'device_hostname', 'device_os', 'device_type',
|
'user_id', 'mac_address', 'device_hostname', 'device_os', 'device_type',
|
||||||
'ssid', 'vlan_id', 'ap_mac', 'is_active', 'authorized_at', 'expires_at',
|
'ssid', 'vlan_id', 'ap_mac', 'is_active', 'authorized_at', 'expires_at',
|
||||||
|
'is_randomized',
|
||||||
];
|
];
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_active' => 'boolean',
|
'is_active' => 'boolean',
|
||||||
'authorized_at' => 'datetime',
|
'authorized_at' => 'datetime',
|
||||||
'expires_at' => 'datetime',
|
'expires_at' => 'datetime',
|
||||||
|
'is_randomized' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user(): BelongsTo
|
public function user(): BelongsTo
|
||||||
|
|||||||
Reference in New Issue
Block a user