codersandip/role-permission-visualizer

A visual mapping and conflict detection tool for Laravel Roles & Permissions

Maintainers

Package info

github.com/codersandip/role-permission-visualizer

Language:JavaScript

pkg:composer/codersandip/role-permission-visualizer

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-29 19:29 UTC

This package is auto-updated.

Last update: 2026-05-01 14:37:37 UTC


README

A developer-friendly UI tool to visualize and manage roles, permissions, and users in an interactive graph-based interface. This package extends the functionality of the spatie/laravel-permission ecosystem, providing immediate insights and conflict detection.

Package Preview

๐Ÿ“Œ Requirements

  • PHP ^8.0.2
  • Laravel 8.x | 9.x | 10.x | 11.x | 12.x
  • spatie/laravel-permission ^5.0 or ^6.0

๐Ÿš€ Features

  • Interactive Graph Canvas: Navigate your Access Control List visually using React Flow.
  • Color-Coded Nodes: Easily identify Users (orange), Roles (blue), and Permissions (green).
  • Intelligent Conflict Detection:
    • Spots and alerts you when a user has conflicting roles.
    • Detects redundant (duplicate) permission inheritance across multiple roles.
  • Filtering System: Toggle visibility between users, roles, and permissions in real-time.
  • Exporting: Download an image (PNG) snapshot of your entire RBAC landscape.

๐Ÿ›  Installation

You can install the package via composer into your local project. Since the package is unpublished, you'll install it from a local file path or custom VCS repository:

composer require codersandip/role-permission-visualizer

Publish the config and the compiled frontend assets to your public directory:

php artisan vendor:publish --tag=visualizer-config
php artisan vendor:publish --tag=visualizer-assets

โš™๏ธ Configuration

The package comes with sensible defaults. In your config/permission-visualizer.php, you can customize:

return [
    'route' => [
        'prefix' => 'role-permission-visualizer',
        'middleware' => ['web', 'visualizer.access'],
    ],

    // Overwrite the user model manually, or leave null to automatically extract it from auth.providers.
    'user_model' => null,

    'cache' => [
        'enabled' => false,
        'ttl' => 3600, // 1 hour caching for immense production graphs
    ],
];

๐Ÿ”’ Access Control (Authorization)

By default, the dashboard is only available when the application environment is set to local.

If you want to view it in production, or restrict who can access it locally, you should define a built-in Gate in your App\Providers\AuthServiceProvider boots method:

use Illuminate\Support\Facades\Gate;

public function boot()
{
    $this->registerPolicies();

    Gate::define('viewRolePermissionVisualizer', function ($user) {
        // e.g., Only allow Super Admins
        return $user->hasRole('Super Admin');
    });
}

๐ŸŒ Usage

Simply navigate to:

http://your-app.test/role-permission-visualizer

Use the Sidebar to tweak visibility or evaluate conflicts. Clicking over any node will invoke the contextual Inspector to observe exact DB values mapping.

๐Ÿ— Development & Modification

Because this package contains a bundled React frontend, if you modify the interface inside resources/js, you need to recompile the assets:

cd vendor/codersandip/role-permission-visualizer
npm install
npm run build

Then republish the assets back to the parent Laravel application.

๐Ÿงช Testing

To run the package's testing suite locally:

composer test
# or
./vendor/bin/phpunit

๐Ÿ“„ License

The MIT License (MIT). Please see License File for more information.