-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Problem with ACL inheriting (Gentoo, PHP-FPM 5.4) #448
Comments
This line must be: $acl->addRole($roleAdmins, "Guests"); The object-syntax is now supported in 1.0.0 |
Ok, but how I can do inheriting from multiple roles? |
You could call: $acl->addRole($roleAdmins, "Guests1");
$acl->addRole($roleAdmins, "Guests2"); |
I tried on latest versions 1.0, roles-inheriting does not work: setDefaultAction(Phalcon\Acl::DENY); try { // Create some roles $roleAdmins = new \Phalcon\Acl\Role("Administrators", "Super-User role"); $roleManager = new \Phalcon\Acl\Role("Manager"); $roleGuests = new \Phalcon\Acl\Role("Guests"); ``` $acl->addRole($roleGuests); $acl->addRole($roleManager); // Add "Administrators" role inheriting from "Guests" its accesses $acl->addRole($roleManager, "Guests"); $acl->addRole($roleAdmins, "Manager"); $acl->addResource(new Phalcon\Acl\Resource('main'), ['view', 'moderator']); // allow resource for Guests $acl->allow("Guests", 'main', 'view'); echo " Guests: " . $acl->isAllowed("Guests", 'main', 'view'); echo " Manager: " . $acl->isAllowed("Manager", 'main', 'view'); echo " Administrators: " . $acl->isAllowed("Administrators", 'main', 'view'); ``` } catch (\Phalcon\Exception $e) { echo get_class($e), ": ", $e->getMessage(), "\n"; echo " File=", $e->getFile(), "\n"; echo " Line=", $e->getLine(), "\n"; echo $e->getTraceAsString(); } ... Guests: 1 Manager: 0 Administrators: 0 |
The same problem. Check forum discussion please: |
Is any news about this bug? |
This is fixed in the 1.0.0 branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Phalcon\Acl\Exception: Role 'Guests' does not exist in the role list
File=/home/site/stage/_config.php
Line=46
#0 [internal function]: Phalcon\Acl\Adapter\Memory->addInherit('Administrators', Object(Phalcon\Acl\Role))
#1 /home/site/stage/_config.php(46): Phalcon\Acl\Adapter\Memory->addRole(Object(Phalcon\Acl\Role), Object(Phalcon\Acl\Role))
#2 /home/site/stage/_loader.php(63): require_once('/home/site/stag...')
#3 /home/site/stage/index.php(9): require_once('/home/site/stag...')
#4 {main}
The text was updated successfully, but these errors were encountered: