meteko/policyannotation

There is no license information available for the latest version (dev-master) of this package.

dev-master 2021-03-05 10:56 UTC

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 |
+----------------------------------+----------+