Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ACL allows access to forbidden resources #1303

Closed
ghost opened this issue Sep 27, 2013 · 0 comments
Closed

[BUG] ACL allows access to forbidden resources #1303

ghost opened this issue Sep 27, 2013 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 27, 2013

Looks like the normal behavior was broken in 6da8921

Test case:

<?php
$acl = new Phalcon\Acl\Adapter\Memory();

//Default action is deny access
$acl->setDefaultAction(Phalcon\Acl::DENY);

//Add "Guests" role to acl
$acl->addRole( new Phalcon\Acl\Role('Guests') );

//Add "Designers" role to acl
$acl->addRole('Designers');

//Define the "Customers" resource
$customersResource = new Phalcon\Acl\Resource('Customers', 'Customers management');

//Add "customers" resource with a couple of operations
$acl->addResource($customersResource, 'search');
$acl->addResource($customersResource, array('create', 'update'));

//Set access level for roles into resources
$acl->allow('Guests', 'Customers', 'search');
$acl->allow('Guests', 'Customers', 'create');
$acl->deny('Guests', 'Customers', 'update');

//Check whether role has access to the operations
echo $acl->isAllowed('Guests', 'Customers', 'edit') . "
"; // should return 0 but returns 1 !!!
echo $acl->isAllowed('Guests', 'Customers', 'update'); // should return 0 but returns 1 !!!

See #1251 (comment)

This happens both in 1.2.4 and 1.3.0

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants