feat(permissions): full permission catalogue grouped by section

- Migration: add 'group' and 'description' columns to the permissions table.
- PermissionCatalogSeeder (idempotent updateOrCreate): full catalogue across 11
  sections — Proyectos, Fases y progreso, Capas y elementos, Inspecciones,
  Incidencias, Empresas, Usuarios, Roles, Informes, Archivos, General. Sets
  group + description on existing and creates the new ones; does NOT touch role
  assignments. Registered in DatabaseSeeder.
- RoleView: group permission toggles by the 'group' column in a defined section
  order and show each permission's description.
DB updated locally (migrate + seed run).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 17:32:16 +02:00
parent 5587026446
commit 433c15a183
5 changed files with 145 additions and 4 deletions
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
$table = config('permission.table_names.permissions', 'permissions');
Schema::table($table, function (Blueprint $table) {
if (! Schema::hasColumn($table->getTable(), 'group')) {
$table->string('group')->nullable()->after('name');
}
if (! Schema::hasColumn($table->getTable(), 'description')) {
$table->string('description')->nullable()->after('group');
}
});
}
public function down(): void
{
$table = config('permission.table_names.permissions', 'permissions');
Schema::table($table, function (Blueprint $table) {
foreach (['group', 'description'] as $col) {
if (Schema::hasColumn($table->getTable(), $col)) {
$table->dropColumn($col);
}
}
});
}
};