geggleto/psr7-permission

Permission Layer for Slim 3

0.1.2 2015-11-16 16:24 UTC

This package is auto-updated.

Last update: 2024-11-29 05:03:15 UTC


README

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

// 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);