lliure/permission
最新稳定版本:v1.0.0
Composer 安装命令:
composer require lliure/permission
包简介
Data encryption package
README 文档
README
Package for validating permissions with two levels
The first step to perform your tests is to create a class using the trait LlPermission\Permission.
File exPermission.php
<?php
class exPermission {
use \LlPermission\Permission;
}
The second step is to build the object with the user's permissions.
$permissions = (new \LlPermission\PermissionSet())
->setRole('use');
$permissions->setClass(exPermission::class)
->setScope('read')
->setScopes(['create', 'delete']);
Finally, you can perform tests using the created class exPermission, which receives the created object as a parameter.
$testPermission = new exPermission($permissions);
if (!$testPermission->create()) {
throw new Exception('Unauthorized', 401);
}
echo 'Hello world!';
Please note that this translation assumes that the code provided is correct and functions as intended.
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-01