PHPackages                             opscale-co/nova-authorization - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. opscale-co/nova-authorization

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

opscale-co/nova-authorization
=============================

Secure your Nova resources with roles and permissions

1.1.2(1mo ago)048↓50%1MITPHPPHP &gt;=8.2CI passing

Since Mar 26Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/opscale-co/nova-authorization)[ Packagist](https://packagist.org/packages/opscale-co/nova-authorization)[ Docs](https://github.com/opscale-co/nova-authorization)[ RSS](/packages/opscale-co-nova-authorization/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (28)Versions (10)Used By (0)

Support us
----------

[](#support-us)

Support Opscale

At Opscale, we’re passionate about contributing to the open-source community by providing solutions that help businesses scale efficiently. If you’ve found our tools helpful, here are a few ways you can show your support:

⭐ **Star this repository** to help others discover our work and be part of our growing community. Every star makes a difference!

💬 **Share your experience** by leaving a review on [Trustpilot](https://www.trustpilot.com/review/opscale.co) or sharing your thoughts on social media. Your feedback helps us improve and grow!

📧 **Send us feedback** on what we can improve at . We value your input to make our tools even better for everyone.

🙏 **Get involved** by actively contributing to our open-source repositories. Your participation benefits the entire community and helps push the boundaries of what’s possible.

💼 **Hire us** if you need custom dashboards, admin panels, internal tools or MVPs tailored to your business. With our expertise, we can help you systematize operations or enhance your existing product. Contact us at  to discuss your project needs.

Thanks for helping Opscale continue to scale! 🚀

Description
-----------

[](#description)

Secure your Nova resources with roles and permissions.

One of the most basic needs for a dashboard is differentiated user access, allowing each profile to manage and view specific information. Confidently manage access to your data with roles and permissions.

[![Authorization demo](https://raw.githubusercontent.com/opscale-co/nova-authorization/refs/heads/main/screenshots/nova-authorization.gif)](https://raw.githubusercontent.com/opscale-co/nova-authorization/refs/heads/main/screenshots/nova-authorization.gif)

Installation
------------

[](#installation)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1a0a1df1ca6e644d09caaa954831865886ad87416fc2a3482cdc59cf78412afb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f707363616c652d636f2f6e6f76612d617574686f72697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opscale-co/nova-authorization)

You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require opscale-co/nova-authorization
```

Next up, you must register the tool with Nova. This is typically done in the `tools` method of the `NovaServiceProvider`.

```
// in app/Providers/NovaServiceProvider.php
// ...
public function tools()
{
    return [
        // ...
        new \Opscale\NovaAuthorization\Tool(),
    ];
}
```

This package uses [Spatie Permissions](https://spatie.be/docs/laravel-permission/v6/introduction) internally to manage roles and permissions structure. Follow the installation instructions for this package.

Then modify the following items in Spatie permissions configuration file (permissions.php):

- `'permission' => Opscale\NovaAuthorization\Models\Permission::class,`
- `'role' => Opscale\NovaAuthorization\Models\Role::class,`
- `'register_permission_check_method' => false,`
- `'events_enabled' => true,`

Important

This packages uses its own cache strategy, so we need to disable the default behavior with register\_permission\_check\_method.

Then add the roles relationship to your User resource:

```
// in app/Nova/User.php
// ...
use Opscale\NovaAuthorization\Nova\Fields\RoleTag;

public function fields(NovaRequest $request): array
{
    return [
        // ...
        RoleTag::make(__('Roles'))
            ->hideFromIndex(),
    ];
}
```

Important

Use `RoleTag` instead of Nova's `Tag` field for roles. `RoleTag` uses Spatie's `assignRole()` and `removeRole()` methods internally, ensuring that `RoleAttached` and `RoleDetached` events are fired. Nova's default `Tag` field uses `sync()` directly on the relationship, bypassing the event system and preventing cache invalidation.

Usage
-----

[](#usage)

You will see a "Roles" item in your menu by default. You can create your roles here and assign them to users.

You can also automate the initial permissions setup using our built-in commands:

- `php artisan create-permissions` to automatically read all your resources and create the related permissions
- `php artisan create-role` to create a role assigning the selected permissions
- `php artisan assign-role` to assign an existing role for an user
- `php artisan clear-cache` to clear the permissions cache for users

### Custom policies

[](#custom-policies)

This package create a dynamic Policy class for each Model class associated to *your Nova app resources*. If you want to use authorization for other resources or modify the logic for your resources, you can create your own policy and register it in `nova-authorization` config file.

### Cache

[](#cache)

Important

This package caches the permissions for each user, the cache last 24 hours and it's flushed any time a role is attached or detached from an user or a permission is attached or detached from a role.

If you want to avoid caching permission you can disable this behavior in `nova-authorization` config file.

Testing
-------

[](#testing)

```
npm run test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/opscale-co/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Opscale](https://github.com/opscale-co)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance88

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Recently: every ~8 days

Total

8

Last Release

52d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3722594?v=4)[opscale](/maintainers/opscale)[@opscale](https://github.com/opscale)

---

Top Contributors

[![opscale-development](https://avatars.githubusercontent.com/u/181295122?v=4)](https://github.com/opscale-development "opscale-development (15 commits)")[![pedro-findex](https://avatars.githubusercontent.com/u/141655744?v=4)](https://github.com/pedro-findex "pedro-findex (6 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (6 commits)")

---

Tags

laravelpackagetoolauthorizationpermissionnovaroleopscale

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/opscale-co-nova-authorization/health.svg)

```
[![Health](https://phpackages.com/badges/opscale-co-nova-authorization/health.svg)](https://phpackages.com/packages/opscale-co-nova-authorization)
```

###  Alternatives

[sereny/nova-permissions

Laravel Nova - Roles &amp; Permissions

86388.6k1](/packages/sereny-nova-permissions)[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136387.1k](/packages/pktharindu-nova-permissions)[silvanite/novatoolpermissions

Laravel Nova Permissions (Roles and Permission based Access Control (ACL))

100256.7k2](/packages/silvanite-novatoolpermissions)[efficiently/authority-controller

AuthorityController is an PHP authorization library for Laravel 5 which restricts what resources a given user is allowed to access.

15533.2k](/packages/efficiently-authority-controller)[sametsahindogan/laravel-jwtredis

This package allows JWT-authenticated users to be stored and management in Redis with their roles, permissions, statuses and anything you want.

1221.9k](/packages/sametsahindogan-laravel-jwtredis)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
