meteko / policyannotation
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 0
Open Issues: 0
Type:neos-package
Requires
- neos/flow: *
This package is auto-updated.
Last update: 2024-11-29 06:22:38 UTC
README
The package provides a way to annotate methods with a @Policy
annotation and set permission for a role.
Install
composer install meteko/policyannotation
Configuration
The format looks like this (taken from the TestController
you can find in this package)
<?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()
{
}
}
The roles does not need to exist in your Policy.yaml
file - it will automatically be added to the policy configuration
Using the ./flow security:listroles
commands output the roles as expected
+----------------------------------+----------+
| Id | Label |
+----------------------------------+----------+
| Meteko.PolicyAnnotation:TestRole | TestRole |
+----------------------------------+----------+