Download the PHP package stoykov/ohrana without Composer

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

Ohrana - Role-Based Access Control List for Lumen framework

TO DOs

How does it work

Ohrana is a granular role-and-rule-based access control list. What does 'granular' mean? It means that you can give a role permissions for a specific method in a specific controller in a specific namespace, or you can give a role access to a whole namespace, or you can give a role global access, all that without changing a single line in your code.

Permissions are rule-based and are bound to roles, which means that every role has it's own set of permissions, unlike traditional ACL libraries where you have general permissions such as 'Edit Post' which can be attached to multiple roles. Rules are simple strings with delimiters that describe the access that that permission grants.

App\Http\Controllers\ExampleController@example grants access to the example method of ExampleController. App\Http\Controllers\ExampleController@example;test;foo grants access to the example, test, foo methods of ExampleController. App\Http\Controllers\ExampleController@All grants access to all methods in ExampleController. App\Http\Controllers\ grants access to all controllers in the App\Http\Controllers\ namespace. All grants global access.

Pros?

This model of ACL is very flexible and granular. You can say that Junior Staff members can access BlogController@view and BlogController@edit, but not BlogController@delete until they have 20 days of service.

Cons?

As already mentioned this model is very granular and requires a lot of managing if you want to use it's full capabilities.

Installation

How to use

Adding middleware

In order to protect a route you need to register the OhranaMiddleware in your app and add it to your routes.

Adding traits to user model

stoykov\Ohrana\Traits\OhranaRole trait needs to be added to your user model. This adds the hasPermission method which checks whether this user has access to the resource requested.

Repositories

You can have your own Role and Permission models. All you need to do is write your own repositories implementing stoykov\Ohrana\Repositories\Role and stoykov\Ohrana\Repositories\Permission interfaces respectfully and change the two namespaces in the configuration file.

Scaning paths

Ohrana scans paths for controllers, when it finds a controller it gets all it's methods and caches them. By default only the app/Http/Controllers/* path is scanned for controllers, but you can add more paths in the configuration file. To list all available Namespaces/Controllers/Methods call the Ohrana::all() method from the Ohrana facade. Or you can always write your rules by hand.

Adding roles
Attaching permissions

All versions of ohrana with dependencies

PHP Build Version
Package Version
Requires laravel/lumen-framework Version 5.5.*
laravel-doctrine/orm Version 1.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 stoykov/ohrana contains the following files

Loading the files please wait ....