Skip to content

Commit

Permalink
updated bandled ZendFramework to latest stable release (ZendFramework…
Browse files Browse the repository at this point in the history
… 1.10.8) (fixes #205)

I executed the following command:
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Acl
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Acl.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Exception
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Exception.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Feed
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Feed.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Http
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Http.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Loader
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Loader.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Mail
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Mail.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Mime
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Mime.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Registry
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Registry.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Search
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Search.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Uri
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Uri.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Validate
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Validate.php
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Version
  $ svn export http://framework.zend.com/svn/framework/standard/tags/release-1.10.8/library/Zend/Version.php
  • Loading branch information
Kousuke Ebihara committed Sep 9, 2010
1 parent a75b404 commit 821abff
Show file tree
Hide file tree
Showing 340 changed files with 38,612 additions and 3,541 deletions.
14 changes: 13 additions & 1 deletion NOTICE
Expand Up @@ -32,7 +32,19 @@ This product needs the third-party softwares listed blow to run.

This product includes dependent libraries listed blow:
- symfony 1.4.1
- Zend Framework 1.7.3PL1 (partly)
- ZendFramework 1.10.8 (partly)
- Zend_Acl
- Zend_Exception
- Zend_Feed
- Zend_Http
- Zend_Loader
- Zend_Mail
- Zend_Mime
- Zend_Registry
- Zend_Search
- Zend_Uri
- Zend_Validate
- Zend_Version
- Auth OpenID 2.1.2
- PHP OAuth library
- sfFormExtraPlugin 1.0.12
Expand Down
163 changes: 147 additions & 16 deletions lib/vendor/Zend/Acl.php
Expand Up @@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Acl.php 9417 2008-05-08 16:28:31Z darby $
* @version $Id: Acl.php 22456 2010-06-18 22:41:37Z ralph $
*/


Expand All @@ -38,10 +38,22 @@
require_once 'Zend/Acl/Assert/Interface.php';


/**
* @see Zend_Acl_Role
*/
require_once 'Zend/Acl/Role.php';


/**
* @see Zend_Acl_Resource
*/
require_once 'Zend/Acl/Resource.php';


/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Acl
Expand Down Expand Up @@ -80,6 +92,21 @@ class Zend_Acl
*/
protected $_resources = array();

/**
* @var Zend_Acl_Role_Interface
*/
protected $_isAllowedRole = null;

/**
* @var Zend_Acl_Resource_Interface
*/
protected $_isAllowedResource = null;

/**
* @var String
*/
protected $_isAllowedPrivilege = null;

/**
* ACL rules; whitelist (deny everything to all) by default
*
Expand Down Expand Up @@ -118,8 +145,18 @@ class Zend_Acl
* @uses Zend_Acl_Role_Registry::add()
* @return Zend_Acl Provides a fluent interface
*/
public function addRole(Zend_Acl_Role_Interface $role, $parents = null)
public function addRole($role, $parents = null)
{
if (is_string($role)) {
$role = new Zend_Acl_Role($role);
}

if (!$role instanceof Zend_Acl_Role_Interface) {
require_once 'Zend/Acl/Exception.php';
throw new Zend_Acl_Exception('addRole() expects $role to be of type Zend_Acl_Role_Interface');
}


$this->_getRoleRegistry()->add($role, $parents);

return $this;
Expand Down Expand Up @@ -198,9 +235,11 @@ public function removeRole($role)
}
}
foreach ($this->_rules['byResourceId'] as $resourceIdCurrent => $visitor) {
foreach ($visitor['byRoleId'] as $roleIdCurrent => $rules) {
if ($roleId === $roleIdCurrent) {
unset($this->_rules['byResourceId'][$resourceIdCurrent]['byRoleId'][$roleIdCurrent]);
if (array_key_exists('byRoleId', $visitor)) {
foreach ($visitor['byRoleId'] as $roleIdCurrent => $rules) {
if ($roleId === $roleIdCurrent) {
unset($this->_rules['byResourceId'][$resourceIdCurrent]['byRoleId'][$roleIdCurrent]);
}
}
}
}
Expand Down Expand Up @@ -236,13 +275,22 @@ public function removeRoleAll()
* The $parent parameter may be a reference to, or the string identifier for,
* the existing Resource from which the newly added Resource will inherit.
*
* @param Zend_Acl_Resource_Interface $resource
* @param Zend_Acl_Resource_Interface|string $resource
* @param Zend_Acl_Resource_Interface|string $parent
* @throws Zend_Acl_Exception
* @return Zend_Acl Provides a fluent interface
*/
public function add(Zend_Acl_Resource_Interface $resource, $parent = null)
public function addResource($resource, $parent = null)
{
if (is_string($resource)) {
$resource = new Zend_Acl_Resource($resource);
}

if (!$resource instanceof Zend_Acl_Resource_Interface) {
require_once 'Zend/Acl/Exception.php';
throw new Zend_Acl_Exception('addResource() expects $resource to be of type Zend_Acl_Resource_Interface');
}

$resourceId = $resource->getResourceId();

if ($this->has($resourceId)) {
Expand All @@ -261,7 +309,8 @@ public function add(Zend_Acl_Resource_Interface $resource, $parent = null)
}
$resourceParent = $this->get($resourceParentId);
} catch (Zend_Acl_Exception $e) {
throw new Zend_Acl_Exception("Parent Resource id '$resourceParentId' does not exist");
require_once 'Zend/Acl/Exception.php';
throw new Zend_Acl_Exception("Parent Resource id '$resourceParentId' does not exist", 0, $e);
}
$this->_resources[$resourceParentId]['children'][$resourceId] = $resource;
}
Expand All @@ -275,6 +324,25 @@ public function add(Zend_Acl_Resource_Interface $resource, $parent = null)
return $this;
}

/**
* Adds a Resource having an identifier unique to the ACL
*
* The $parent parameter may be a reference to, or the string identifier for,
* the existing Resource from which the newly added Resource will inherit.
*
* @deprecated in version 1.9.1 and will be available till 2.0. New code
* should use addResource() instead.
*
* @param Zend_Acl_Resource_Interface $resource
* @param Zend_Acl_Resource_Interface|string $parent
* @throws Zend_Acl_Exception
* @return Zend_Acl Provides a fluent interface
*/
public function add(Zend_Acl_Resource_Interface $resource, $parent = null)
{
return $this->addResource($resource, $parent);
}

/**
* Returns the identified Resource
*
Expand Down Expand Up @@ -340,7 +408,8 @@ public function inherits($resource, $inherit, $onlyParent = false)
$resourceId = $this->get($resource)->getResourceId();
$inheritId = $this->get($inherit)->getResourceId();
} catch (Zend_Acl_Exception $e) {
throw $e;
require_once 'Zend/Acl/Exception.php';
throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e);
}

if (null !== $this->_resources[$resourceId]['parent']) {
Expand Down Expand Up @@ -378,7 +447,8 @@ public function remove($resource)
try {
$resourceId = $this->get($resource)->getResourceId();
} catch (Zend_Acl_Exception $e) {
throw $e;
require_once 'Zend/Acl/Exception.php';
throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e);
}

$resourcesRemoved = array($resourceId);
Expand Down Expand Up @@ -629,13 +699,17 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr
}
continue;
}
if ($type === $rules['allPrivileges']['type']) {

if (isset($rules['allPrivileges']['type']) &&
$type === $rules['allPrivileges']['type'])
{
unset($rules['allPrivileges']);
}
} else {
foreach ($privileges as $privilege) {
if (isset($rules['byPrivilegeId'][$privilege]) &&
$type === $rules['byPrivilegeId'][$privilege]['type']) {
$type === $rules['byPrivilegeId'][$privilege]['type'])
{
unset($rules['byPrivilegeId'][$privilege]);
}
}
Expand Down Expand Up @@ -683,12 +757,27 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr
*/
public function isAllowed($role = null, $resource = null, $privilege = null)
{
// reset role & resource to null
$this->_isAllowedRole = null;
$this->_isAllowedResource = null;
$this->_isAllowedPrivilege = null;

if (null !== $role) {
// keep track of originally called role
$this->_isAllowedRole = $role;
$role = $this->_getRoleRegistry()->get($role);
if (!$this->_isAllowedRole instanceof Zend_Acl_Role_Interface) {
$this->_isAllowedRole = $role;
}
}

if (null !== $resource) {
// keep track of originally called resource
$this->_isAllowedResource = $resource;
$resource = $this->get($resource);
if (!$this->_isAllowedResource instanceof Zend_Acl_Resource_Interface) {
$this->_isAllowedResource = $resource;
}
}

if (null === $privilege) {
Expand Down Expand Up @@ -716,6 +805,7 @@ public function isAllowed($role = null, $resource = null, $privilege = null)

} while (true); // loop terminates at 'allResources' pseudo-parent
} else {
$this->_isAllowedPrivilege = $privilege;
// query on one privilege
do {
// depth-first search on $role if it is not 'allRoles' pseudo-parent
Expand Down Expand Up @@ -964,8 +1054,18 @@ protected function _getRuleType(Zend_Acl_Resource_Interface $resource = null, Ze
$rule = $rules['byPrivilegeId'][$privilege];
}

// check assertion if necessary
if (null === $rule['assert'] || $rule['assert']->assert($this, $role, $resource, $privilege)) {
// check assertion first
if ($rule['assert']) {
$assertion = $rule['assert'];
$assertionValue = $assertion->assert(
$this,
($this->_isAllowedRole instanceof Zend_Acl_Role_Interface) ? $this->_isAllowedRole : $role,
($this->_isAllowedResource instanceof Zend_Acl_Resource_Interface) ? $this->_isAllowedResource : $resource,
$this->_isAllowedPrivilege
);
}

if (null === $rule['assert'] || $assertionValue) {
return $rule['type'];
} else if (null !== $resource || null !== $role || null !== $privilege) {
return null;
Expand Down Expand Up @@ -1033,4 +1133,35 @@ protected function &_getRules(Zend_Acl_Resource_Interface $resource = null, Zend
return $visitor['byRoleId'][$roleId];
}


/**
* @return array of registered roles (Deprecated)
* @deprecated Deprecated since version 1.10 (December 2009)
*/
public function getRegisteredRoles()
{
trigger_error('The method getRegisteredRoles() was deprecated as of '
. 'version 1.0, and may be removed. You\'re encouraged '
. 'to use getRoles() instead.');

return $this->_getRoleRegistry()->getRoles();
}

/**
* @return array of registered roles
*/
public function getRoles()
{
return array_keys($this->_getRoleRegistry()->getRoles());
}

/**
* @return array of registered resources
*/
public function getResources()
{
return array_keys($this->_resources);
}

}

6 changes: 3 additions & 3 deletions lib/vendor/Zend/Acl/Assert/Interface.php
Expand Up @@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 8861 2008-03-16 14:30:18Z thomas $
* @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
*/


Expand All @@ -41,7 +41,7 @@
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Acl_Assert_Interface
Expand Down
6 changes: 3 additions & 3 deletions lib/vendor/Zend/Acl/Exception.php
Expand Up @@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 8861 2008-03-16 14:30:18Z thomas $
* @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/


Expand All @@ -29,7 +29,7 @@
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Acl_Exception extends Zend_Exception
Expand Down
16 changes: 13 additions & 3 deletions lib/vendor/Zend/Acl/Resource.php
Expand Up @@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Resource.php 8861 2008-03-16 14:30:18Z thomas $
* @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $
*/


Expand All @@ -29,7 +29,7 @@
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Acl_Resource implements Zend_Acl_Resource_Interface
Expand Down Expand Up @@ -62,4 +62,14 @@ public function getResourceId()
return $this->_resourceId;
}

/**
* Defined by Zend_Acl_Resource_Interface; returns the Resource identifier
* Proxies to getResourceId()
*
* @return string
*/
public function __toString()
{
return $this->getResourceId();
}
}

0 comments on commit 821abff

Please sign in to comment.