Download the PHP package pktharindu/nova-permissions without Composer

On this page you can find all versions of the php package pktharindu/nova-permissions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nova-permissions

Laravel Nova Grouped Permissions (RBAC)

banner that says Nova Permissions

GitHub Packagist Packagist

Add Permissions based authorization for your Nova installation via Role-Based Access Control (RBAC). Roles are defined in the database whereas Permissions are defined in the code base. It allows you to group your Permissions into Groups and attach it to Users.

Nova 4 v3.x
<= Nova 3 v2.x

If you like this package, show some love by starring the repo. 🙏

This package is inspired by Silvanite\Brandenburg as it has clear separation of concerns.

Roles are defined in the Database

and

Permissions are defined in the Codebase

As a result, you won't see any Permissions resource. The Roles resource will get the permissions from the Gates defined in your code.

Tool Demo

Installation

You can install the package in to a Laravel app that uses Nova via composer:

Publish the Configuration with the following command:

Configuration file includes some dummy permissions for your refference. Feel free to remove them and add your own permissions.

Publish the Migration with the following command:

Migrate the Database:

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

Create a new policy:

After that, register the RolePolicy along with any other policies you may have and define the gates in the boot method of the AuthServiceProvider like below.

Then, use HasRoles Traits in your User model.

Finally, add BelongsToMany fields to you app/Nova/User resource:

A new resource called Roles will appear in your Nova app after installing this package.

Permissions with Groups

Index View

Detail View

Detail View

Detail View

Edit View

Edit View

Usage

Create a Model Policy

To check permissions, you can create Model Policies that works with Laravel Nova.

Note: This package doesn't come with any Model Policies built-in. The dummy permissions defined in the config are for your reference only. For each Nova Resource including the Role and User resources, that you want to authorize user actions against, you need to create a Model Policy. Please refer to the Laravel Docs and Laravel Nova Docs for additional information.

For Example: Create a new Post Policy with php artisan make:policy PostPolicy with the following code:

It should now work as exptected. Just create a Role, modify its Permissions and the Policy should take care of the rest.

Note: Don't forget to add your Policy to your $policies in App\Providers\AuthServiceProvider and define the permissions in config\nova-permissions.php.

hasPermissionTo() method determine if any of the assigned roles to this user have a specific permission.

hasAnyPermission() method determine if the model has any of the given permissions.

hasAllPermissions() method determine if the model has all of the given permissions.

view own posts is superior to view posts and allows the User to only view his own posts.

manage own posts is superior to manage posts and allows the User to only manage his own posts.

Customization

Use your own Resources

If you want to use your own role resource, you can define it when you register the tool:

Then extend the Pktharindu\NovaPermissions\Nova\Role in your role resource:

Support

If you require any support please contact me on Twitter or open an issue on this repository.

Credits

This Package is inspired by eminiarts/nova-permissions and silvanite/novatoolpermissions. I wanted to have a combination of both. Thanks to both authors.

License

Copyright © 2018-2020 P. K. Tharindu and contributors

Licensed under the MIT license, see LICENSE for details.


All versions of nova-permissions with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pktharindu/nova-permissions contains the following files

Loading the files please wait ....