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 truncates action name

I have been using ACL successfully for a while but ran into an issue when I tried using an action name that was more than 16 characters long. When I add adminChangePassword as an access under my users resource | get the error

Access 'adminChangePassw' does not exist in resource 'users'
#0 [internal function]: Phalcon\Acl\Adapter\Memory->_allowOrDeny('Administrators', 'users', 'adminChangePass...', 1)

But using the name adminChangePassw works fine (apart from that it is a rubbish name). It appears that the name is being truncated at some point which I presume would be a bug.

Is that what is happening or can anyone give another explanation of this error?

A quick test

I've just tried adding an access in the users resource called 12345678901234567 and the error says that 1234567890123456 does not exist - truncating the last 7...



3.3k
Accepted
answer

If you copied the ACL system from Vokuro

You can see here that the permissions table only have 16 chars for resource and action fields. https://github.com/phalcon/vokuro/blob/master/schemas/vokuro.sql#L70-L78

Just change the database structure to fit your needs.

I hadn't thought about looking in the database - I presumed it was something to do with the code itself...

Thanks, works perfectly now.