Download the PHP package silvanite/novatoolpermissions without Composer

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

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

Add Access Control by means of User based Roles and Permissions to your Nova installation. Includes default User and Role Policies which can be managed through your Nova Admin Panel.

Tool Demo

This tool uses the Silvanite\Brandenburg package under the hood to manage user roles. Brandenburg is used because 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.

Package maintenance

Unfortunately I am no longer actively working in the Laravel ecosystem and as such am unable to maintian this package. If anyone would like to take over the maintenance of the package please get in touch (open an issue or contact me on Twitter).

Installation

Install the tool through composer

Run the migrations to add the database tables required by Brandenburg.

Add the HasRoles trait to your User model as per the Brandenburg installation instructions.

Load it into your Nova Tools to display the Roles within your Resources

You can assign Users to Roles from the Role resource, however if you want to assign Roles from your User resource you will need to add an additional relationship ...

If you are not using the defaul App\Nova\User Resource you can customise this by publishing the `novatoolpermissions config and setting your User resource model.

Remove the default viewNova Gate to use the Gate included by this package. You will need to keep the gate() method in place, just empty it. Note: Nova will always allow access in development environments.

Usage

Once installed, go ahead and create your first Role. E.g. Administrator and assign all permissions to your new Role.

Create/Edit Roles

Finally assign the Administrator Role to your user account.

Attach Role to User

Roles index with User count

Note: By default, the package allows anyone access to a permission if no single user has access to it. This is to prevent you from locking yourself out of features. As such, it is important to define your primary admin role which has access to all permissions, meaning nobody else has access unless you specifically grant it.

Default Permissions

This package comes with a set of default permissions to provide full access control to the package's functionality. Permissions come with default english translations to provide a better user experience. You are free to replace these with translations in your applications json translations.

Custom permissions

To create your own permissions, simply define them in your service provider and create a Policy for your resource/model. Let's work with a common Blog example and assume that you have a Blog Model and Resource in your application.

Create a Policy for your Nova Resource

Create a new policy for your blog

Let's assign the Policy and define our Gates.

Finally, specify the access control in your Policy as per the Nova documentation.

And add your labels to your translations to keep everything tidy.

This example is a super-simple implementation. You can define your Gates as in any standard Laravel Application and can simply add the additional checks to validate them against your assigned Roles and Permissions.

Access Control

Sometimes you might want to prevent some users from accessing content, but not others. To achieve this, use the included HasAccessControl.php trait on your model.

To check if a user has the correct permissions to view your content, either load the AccessControlServiceProvider to register the accessControl gate globally. Or include the AccessControlGate trait on your models policy.

On your Nova resource, add the AccessControl field. This will display all roles with the canBeGivenAccess permission. To protect content from being accessed, at least one Role has to be given access to the model, otherwise the resource will be available to everyone.

Support

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


All versions of novatoolpermissions with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
laravel/framework Version >=5.6.0
silvanite/brandenburg Version ^1.0
silvanite/novafieldcheckboxes Version ^1.0
benjaminhirsch/nova-slug-field Version ^1.2.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 silvanite/novatoolpermissions contains the following files

Loading the files please wait ....