ZF2 Runtime Constraints like Flow3

264 views Asked by At

How would Flow3 runtime constraints be done ZF2?

Here's snippet from Flow3's documentation.

Runtime constraints

Runtime constraints are a very poweful feature of FLOW3’s AOP framework. A full reference of the possibilities can be found in the AOP chapter of this documentation. However, this features was mainly implemented to support sophisticated policy definitions and therefore here is a short introduction by two simple examples on how to use it:

Example: runtime constraints usage in the security policy

 -   
     resources:
     methods:
       TYPO3_FooPackage_firstResource: 'method(TYPO3\FooPackage\SomeClass->updateProject(title != "FLOW3"))'
       TYPO3_FooPackage_secondResource: TYPO3_FooPackage_firstResource && evaluate(current.securityContext.party.name == "Andi")

The above configuration defines a resource that matches on the updateProject method only if it is not called with the title arugment equal to “FLOW3”. The second resource matches if the first one matches and the name property of the currently authenticated party is equal to “Andi”.

http://flow3.typo3.org/documentation/guide/partiii/security.html

2

There are 2 answers

0
Rob Allen On BEST ANSWER

There's nothing directly equivalent. I would look at using Zend\Acl's Assertions system.

0
lisachenko On

I want to introduce an aspect-oriented programming with Go! AOP library and Zend Framework 2. Here is an example to show the power of AOP ZF2 with Aspect-Oriented Programming (just clone and install dependencies with composer)