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 best practice to update user session

Hi all

I'm building web modules application and I store the user permissions in session after log in.

When the administrator modify roles/permissions I need to update the user session with the new permissions.

How I can proceed? thx in advance

Store user information in memcache where key is php session. After changing user roles/permissions get his active session(if any) and update proper key in memcache, this is how I solve it at least.


Thanks Wojciech

Do you have a code example on how I can do what you recommend

Just use event afterUpdate and access proper service from di there and save new values to cache, nothing fancy. Don't have an actual code but it's easy to do it yourself.