midnight/permissions 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

midnight/permissions

Composer 安装命令:

composer require midnight/permissions

包简介

Simple permissions system

README 文档

README

Check Build

midnight/permissions

ACL and RBAC weren't the permission models I was looking for. So I wrote my own.

Installation

Install midnight/permissions via Composer.

Usage

You need a Container that can provide your PermissionService with permissions. In this example, we're going to use league/container, but any container implementing Psr\Container\ContainerInterface will work.

For brevity, the user and resource are arrays in this example. Most likely, they will be objects any real-world project.

class CanDoSomething implements Midnight\Permissions\PermissionInterface
{
    public function isAllowed($user = null, $resource = null): bool {
        return $user === $resource['owner'];
    }
}

$container = new League\Container\Container();
$container->add('can_do_something', CanDoSomething::class);

$permissionService = new Midnight\Permissions\PermissionService($container);

$permissionService->isAllowed('Rudolph', 'can_do_something', ['owner' => 'Rudolph']); // true
$permissionService->isAllowed('Rudolph', 'can_do_something', ['owner' => 'Christoph']); // false

Laminas Module

There's also a Laminas module that will let you access the PermissionService via the Service Manager, add permissions via the config and give you view helpers and controller plugins. It's called midnight/permissions-module.

统计信息

  • 总下载量: 21.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固