geggleto/psr7-permission

为 Slim 3 定制的权限层

0.1.2 2015-11-16 16:24 UTC

This package is auto-updated.

Last update: 2024-08-29 04:31:02 UTC


README

配置

此中间件会检查用户是否有权限访问特定资源。

中间件做出以下假设

  • 您使用所有系统应用的路线加载中间件。
  • 用户的权限表被加载到请求的 'permission' 属性中 [默认情况]

如果用户尝试访问他们无权访问的资源,将抛出异常。

使用方法

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