Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/geggleto/psr7-permission


https://github.com/geggleto/psr7-permission

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

# psr7-permission

## Configuration

This Middleware checks to see if a User has permission to access a specific resource.

The Middleware makes the following assumptions:
- That you load the middleware with all of the routes the system is applied to.
- That the user's permission table is loaded into the Requests 'permission' attribute [by default]

If a user attempts to access a resource they are not allowed an Exception is raised.

## Usage

```php

// In Slim 3

$permission = new Geggleto\Service\Permission($container['system_routes']);
// This will add the permission middleware to the entire site.
// This is not likely what you want since non-logged in users will not be able to access anything.
$app->add($permission);

```