Is there any way to determine if a specific resource/action is registered in the ACL?

I see that there is a isResource($resourceName) method on the memory ACL but is there a way to tell if a specific resource and action combination is registered for any roles? So instead of isAllowed I want to be able to see if redirecting to that action is valid for any user/role.

I'm working on an Exception Plugin for the dispatcher and I'm not sure if I can detect and handle an infinite loop there. Perhaps it is best to handle it in the Exception Plugin but I'm not all of the way through implementing that and so I'm unsure if I can perfect that with what is built-in.



1.5k

Nope. in the original acl in phalcon there isnt.



19.6k

So you want to do a type of isAllowed before redirecting to save time?

You could create a function in your Exception plugin (or where you want), passing through it, as arguments, the role and the resource/action. Inside, use an INI file (which has the roles associated to valid resource/actions) and return something like strcmp($ini[$argRol], $argResourceAction) === 0 (the return logic will change in function of the number of resource/actions per role).

Maybe this will do a workaround.