Download the PHP package eminiarts/nova-permissions without Composer

On this page you can find all versions of the php package eminiarts/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

Latest Version on Github

A Laravel Nova Tool that allows you to group your Permissions into Groups and attach it to Users. It uses Spatie's laravel-permission.

We have a Migration, Seed, Policy and Resource ready for a good Authorization Experience.

  1. Installation
  2. Permissions with Groups
    • Detail View
    • Edit View
    • Database Seeding
    • Create a Model Policy
    • Super Admin
    • Scope Resource for User
  3. Customization
    • Use your own Resources
  4. Credits

image

Installation

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

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.

If you want to hide the tool from certain users, you can write your custom logic for the ability to see the tool:

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

Add the Spatie\Permission\Traits\HasRoles trait to your User model(s):

A new menu item called Permissions & Roles will appear in your Nova app after installing this package.

Permissions with Groups

Detail View

image

Edit View

image

Database Seeding

Publish our Seeder with the following command:

This is just an example on how you could seed your Database with Roles and Permissions. Modify RolesAndPermissionsSeeder.php in database/seeds. List all your Models you want to have Permissions for in the $collection Array and change the email for the Super-Admin:

Now you can seed the Database. Add $this->call(RolesAndPermissionsSeeder::class); to the DatabaseSeeder.

Note: If this doesn't work, run composer dumpautoload to autoload the Seeder.

Create a Model Policy

You can extend Eminiarts\NovaPermissions\Policies\Policy and have a very clean Model Policy that works with Nova.

For Example: Create a new Contact Policy with php artisan make:policy ContactPolicy 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.

Note: Only extend the Policy if you have created your Permissions according to our Seeding Example. Otherwise, make sure to have view contacts, view own contacts, manage contacts, manage own contacts, restore contacts, forceDelete contacts as Permissions in your Table in order to extend our Policy.

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

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

Super Admin

A Super Admin can do everything. If you extend our Policy, make sure to add a isSuperAdmin() Function to your App\User Model:

You can modify this function as you please.

Scope Resource for User

If you use our Policy and Seeder, the user will still be able to see other Entries. In order to only allow a User to view his own Entries and no others, you can extens our Eminiarts\NovaPermissions\Nova\ResourceForUser Class like this:

Note: ResourceForUser assumes the Resource has a user_id column in the Database. If you are using another column, feel free to copy the contents of the Resource and modify it.

Customization

Use your own Resources

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

Credits

This Package is inspired by vyuldashev/nova-permission and silvanite/novatoolpermissions. I wanted to have a combination of both. Thanks to both authors. Also, a huge thanks goes to Spatie spatie/laravel-permission for their amazing work!


All versions of nova-permissions with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
spatie/laravel-permission Version 3.*
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 eminiarts/nova-permissions contains the following files

Loading the files please wait ....