meteko/policyannotation

Last activity 05 Mar 2021 7
composer require meteko/policyannotation

dev-master

Version
dev-master
Type
neos-package
Release Date
Mar 05, 2021 10:56
Source
git
Distribution
zip
Requires
50d7ce814dc344b266e777022d10c0a5fa96e349

Policy configuration from method annotation

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 |
+----------------------------------+----------+
The content of the readme is provided by Github
The same vendor provides 7 package(s).