We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

ACL function based access and database adapter

Hi! I use this acl database adapter. But as I can see it does not support function based access.

How can I save and use my business rules in the database?

edited Mar '16

Well. This function based access is done for Memory adapter and its available from 2.1.x phalcon. If you want to use database adapter it needs to be updated. I will look into it when i have time. But there is a problem - cuz database adapter means that we define acl in database. And in memory adapter you have all acl just in code, as well as business rules for acl, but how to store them in database? Serialize/desarialize ?

ALSO serialize/deserialize for closures dont work in php - so you need here some custom class for storing functions, for example https://www.htmlist.com/development/extending-php-5-3-closures-with-serialization-and-reflection/

You can check what changes has been made to Memory adapter in 2.1.x here:

https://github.com/phalcon/cphalcon/commit/577219c94c960a5ecdae1447912fdd46a9c645fc

And figure it out yourself how to do the same for Database adapter.

Also there is https://github.com/phalcon/incubator/tree/2.1.x/Library/Phalcon/Acl/Adapter already done for just working it - but its not implementing business rules in the database adapter, just for fixing compatibility with 2.1.x

Also there is mistake in docs, this features are available from 2.1.x phalcon.