meteko / policyannotation
此包最新版本(dev-master)没有可用的许可证信息。
dev-master
2021-03-05 10:56 UTC
Requires
- neos/flow: *
This package is auto-updated.
Last update: 2024-09-29 05:56:27 UTC
README
该包提供了一种使用 @Policy
注解注解方法并设置角色的权限的方法。
安装
composer install meteko/policyannotation
配置
格式如下(从包中可以找到的 TestController
中提取)
<?php
namespace Meteko\PolicyAnnotation\Controller;
use Neos\Flow\Mvc\Controller\ActionController;
use Meteko\PolicyAnnotation\Annotations\Policy; #!!!This is the imported annotation
class TestController extends ActionController
{
/**
* @Policy(role="Meteko.PolicyAnnotation:TestRole", permission="grant")
*/
public function indexAction()
{
}
}
角色不需要存在于您的 Policy.yaml
文件中 - 它将自动添加到策略配置中
使用 ./flow security:listroles
命令输出预期中的角色
+----------------------------------+----------+
| Id | Label |
+----------------------------------+----------+
| Meteko.PolicyAnnotation:TestRole | TestRole |
+----------------------------------+----------+