Let each role, and each person, choose where they land after signing in

A role now has a start page: the dashboard, files, upload, groups,
clients or the activity log (the last two for staff only). Anyone can
override their role's choice in their profile. The administrator role
takes a start page too, while everything else about it stays locked.

A choice is only used if the account can open that page now. Otherwise
the next one down is tried, ending at the dashboard, so a permission
removed later never lands somebody on a 403. A role cannot be saved
with a start page its own permissions block. A link followed before
signing in still wins, and a waiting getting-started or what's-new page
still goes first.

Applies to password, two-factor and provider sign-ins, and to the site
root for someone already signed in. StartPageTest opens every page for
real, with and without its permission, so the enum cannot drift from
the routes.

Requested by @Zodiac1978 in #1777.
This commit is contained in:
ignacionelson
2026-09-13 15:05:40 -03:00
parent c21658f6f7
commit 495f3ae471
18 changed files with 859 additions and 17 deletions
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
// Where somebody lands after signing in: a StartPage value, or null
// for the dashboard. The role holds the default for everyone in it;
// the user column is that person's own choice, and wins. Plain
// strings rather than an enum column, and not cast to the enum
// either — a value a later version stops offering must fall back to
// the dashboard, not fail to load the account. See StartPages.
Schema::table('roles', function (Blueprint $table) {
$table->string('start_page', 32)->nullable()->after('client_scoped');
});
Schema::table('users', function (Blueprint $table) {
$table->string('start_page', 32)->nullable()->after('timezone');
});
}
public function down(): void
{
Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('start_page');
});
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('start_page');
});
}
};