diff --git a/src/Acl.php b/src/Acl.php index 27f50d3..80717b1 100644 --- a/src/Acl.php +++ b/src/Acl.php @@ -5,17 +5,11 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ -class Acl +class Acl implements AclInterface { /** * Rule type: allow diff --git a/src/AclInterface.php b/src/AclInterface.php new file mode 100644 index 0000000..cc61b7a --- /dev/null +++ b/src/AclInterface.php @@ -0,0 +1,51 @@ +allow()). + * + * If a $privilege is not provided, then this method returns false if and only if the + * Role is denied access to at least one privilege upon the Resource. In other words, this + * method returns true if and only if the Role is allowed all privileges on the Resource. + * + * This method checks Role inheritance using a depth-first traversal of the Role registry. + * The highest priority parent (i.e., the parent most recently added) is checked first, + * and its respective parents are checked similarly before the lower-priority parents of + * the Role are checked. + * + * @param Role\RoleInterface|string $role + * @param Resource\ResourceInterface|string $resource + * @param string $privilege + * @return boolean + */ + public function isAllowed($role = null, $resource = null, $privilege = null); +} diff --git a/src/Assertion/AssertionInterface.php b/src/Assertion/AssertionInterface.php index 5cd392b..84ab695 100644 --- a/src/Assertion/AssertionInterface.php +++ b/src/Assertion/AssertionInterface.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Assertion; @@ -14,11 +13,6 @@ use Zend\Permissions\Acl\Resource\ResourceInterface; use Zend\Permissions\Acl\Role\RoleInterface; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ interface AssertionInterface { /** diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index e087eac..c1cec52 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -5,15 +5,9 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Exception; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ interface ExceptionInterface {} diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 1d08f04..e88ec39 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Exception; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface {} diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index 220e88c..608b35a 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Exception; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ class RuntimeException extends \RuntimeException implements ExceptionInterface { diff --git a/src/Resource/GenericResource.php b/src/Resource/GenericResource.php index 16aa171..b9b8946 100644 --- a/src/Resource/GenericResource.php +++ b/src/Resource/GenericResource.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Resource; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ class GenericResource implements ResourceInterface { /** diff --git a/src/Resource/ResourceInterface.php b/src/Resource/ResourceInterface.php index 6483789..1e98f46 100644 --- a/src/Resource/ResourceInterface.php +++ b/src/Resource/ResourceInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Resource; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ interface ResourceInterface { /** diff --git a/src/Role/GenericRole.php b/src/Role/GenericRole.php index c055f9c..e2c17b2 100644 --- a/src/Role/GenericRole.php +++ b/src/Role/GenericRole.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Role; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ class GenericRole implements RoleInterface { /** diff --git a/src/Role/Registry.php b/src/Role/Registry.php index 2bb2a04..0ea49d0 100644 --- a/src/Role/Registry.php +++ b/src/Role/Registry.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Role; use Zend\Permissions\Acl\Exception; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ class Registry { /** diff --git a/src/Role/RoleInterface.php b/src/Role/RoleInterface.php index f314a25..588de55 100644 --- a/src/Role/RoleInterface.php +++ b/src/Role/RoleInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Permissions */ namespace Zend\Permissions\Acl\Role; -/** - * @category Zend - * @package Zend_Permissions - * @subpackage Acl - */ interface RoleInterface { /**