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

Are there wildcards in Acl roles?

Hi. I'm trying the next staff: ` foreach ($aclConfig as $role => $resources) { foreach ($resources as $controller => $actions) { $resource = new Acl\Resource($controller); if (!in_array($resource, $acl->getResources())) { $acl->addResource($resource, $actions); } if ($role == 'all') { $acl->allow('*', $controller, $actions); } `

But I catch the exception: "Role '' doesn't exist in ACL", something like this. In case I'm trying to add role "" to acl using addRole, other exeption: "Role name mustn't be '*'" raised. Documentation in Acl/Adapter/Memory said:

`

  • //Allow access to any role to browse on products
  • $acl->allow('*', 'products', 'browse'); ` Can I use this feature, or no? Thanks.


98.9k

Hi Alexey, it seems the docs need to be updated, it actually needs valid roles different than '*'