[Flow] [FLOW] RFC - Use functions on Policy

Andreas Förthner andreas.foerthner at netlogix.de
Thu Feb 6 11:47:00 CET 2014


Hi Jan,

you can easily achieve that already. Just register your service class
(maybe not name it test ;-) ) as a global object in your AOP settings.

E.g. in your Settings.yaml:

TYPO3.Flow.aop.globalObjects.mySpecialAccountService =
'\My\VendorNamespace\Services\MyAccountServiceŒ).

After that you can use methods of this service in pointcut expressions of
your Policy:

policy:
  ressource:
    entities:
      'your\package\test':
        you_package_example: 'inArray("stuff",this.var) ||
current.mySpecialAccountService.account == current.securityContext.account'



Hope that helps.

Greets Andi

Am 06.02.14 11:35 schrieb "Jan Herzog" unter
<Jan-christoph-herzog at gmx.net>:

>Hello,
>
>i dont know if this is the right place. I want to request an feature:
>I would love to be able to use functions in Policy. This would make
>policy much more flexible and dynamic.
>
>An example:
>class test
>{
>    $var = array("stuff","otherStuff");
>    private $account=\TYPO3\Flow\Securty\Account;
>
>    public function gotAccount($account)
>    {
>        return $this->account==$account;
>    }
>}
>
>policy:
>ressource:
>  entities:
>    'your\package\test':
>      you_package_example: 'inArray("stuff",this.var) ||
>this.gotAccount(current.securityContext.account)'
>
Andreas Förthner
Leiter Web-Entwicklung

Telefon: +49 (911) 539909 - 0
E-Mail: andreas.foerthner at netlogix.de
Website: media.netlogix.de



--------------------
Geben Sie Cyber-Kriminellen keine Chance
Lückenloser Schutz mit Security-Lösungen von Sophos: Erfahren Sie, wie Sie Ihr Unternehmen wirksam schützen und gewinnen Sie einen Boomball Pro Mini-Lautsprecher:
https://www.cyber-gesindel-a.de/netlogix
--------------------



--
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Neuwieder Straße 10 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



_______________________________________________
>Flow mailing list
>Flow at lists.typo3.org
>http://lists.typo3.org/cgi-bin/mailman/listinfo/flow



More information about the Flow mailing list