Skip to content

Commit

Permalink
Implement #6: remove Zend_Acl** class and usefproject\amf\acl\** clas…
Browse files Browse the repository at this point in the history
…ses instead
  • Loading branch information
Bui Sy Nguyen committed Jan 22, 2016
1 parent 177d168 commit 213afde
Show file tree
Hide file tree
Showing 17 changed files with 457 additions and 566 deletions.
64 changes: 0 additions & 64 deletions fproject/Zend/Acl/Assert/Interface.php

This file was deleted.

75 changes: 0 additions & 75 deletions fproject/Zend/Acl/Resource.php

This file was deleted.

37 changes: 0 additions & 37 deletions fproject/Zend/Acl/Resource/Interface.php

This file was deleted.

75 changes: 0 additions & 75 deletions fproject/Zend/Acl/Role.php

This file was deleted.

37 changes: 0 additions & 37 deletions fproject/Zend/Acl/Role/Interface.php

This file was deleted.

11 changes: 4 additions & 7 deletions fproject/Zend/Amf/Adobe/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* @version $Id$
*/

/** @see Zend_Acl */
require_once 'Zend/Acl.php';

/** @see Zend_Xml_Security */
require_once 'Zend/Xml/Security.php';

Expand All @@ -41,7 +38,7 @@ class Zend_Amf_Adobe_Auth extends \fproject\amf\auth\AuthAbstract
/**
* ACL for authorization
*
* @var Zend_Acl
* @var \fproject\amf\acl\Acl
*/
protected $_acl;

Expand All @@ -59,7 +56,7 @@ class Zend_Amf_Adobe_Auth extends \fproject\amf\auth\AuthAbstract
*/
public function __construct($rolefile)
{
$this->_acl = new Zend_Acl();
$this->_acl = new \fproject\amf\acl\Acl();
$xml = Zend_Xml_Security::scanFile($rolefile);
/*
Roles file format:
Expand All @@ -73,7 +70,7 @@ public function __construct($rolefile)
</roles>
*/
foreach($xml->role as $role) {
$this->_acl->addRole(new Zend_Acl_Role((string)$role["id"]));
$this->_acl->addRole(new \fproject\amf\acl\Role((string)$role["id"]));
foreach($role->user as $user) {
$this->_users[(string)$user["name"]] = array("password" => (string)$user["password"],
"role" => (string)$role["id"]);
Expand All @@ -84,7 +81,7 @@ public function __construct($rolefile)
/**
* Get ACL with roles from XML file
*
* @return Zend_Acl
* @return \fproject\amf\acl\Acl
*/
public function getAcl()
{
Expand Down
6 changes: 3 additions & 3 deletions fproject/Zend/Amf/Adobe/Introspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public function introspect($serviceClass, $options = array())
/**
* Authentication handler
*
* @param Zend_Acl $acl
* @return unknown_type
* @param \fproject\amf\acl\Acl $acl
* @return bool
*/
public function initAcl(Zend_Acl $acl)
public function initAcl(\fproject\amf\acl\Acl $acl)
{
return false; // we do not need auth for this class
}
Expand Down
11 changes: 5 additions & 6 deletions fproject/Zend/Amf/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
/**
* ACL handler object
*
* @var Zend_Acl
* @var \fproject\amf\acl\Acl
*/
protected $_acl;
/**
Expand Down Expand Up @@ -166,18 +166,18 @@ public function getAuth()
/**
* Set ACL adapter
*
* @param Zend_Acl $acl
* @param \fproject\amf\acl\Acl $acl
* @return Zend_Amf_Server
*/
public function setAcl(Zend_Acl $acl)
public function setAcl(\fproject\amf\acl\Acl $acl)
{
$this->_acl = $acl;
return $this;
}
/**
* Get ACL adapter
*
* @return Zend_Acl
* @return \fproject\amf\acl\Acl
*/
public function getAcl()
{
Expand Down Expand Up @@ -244,8 +244,7 @@ protected function _checkAcl($object, $function)
if($object) {
$class = is_object($object)?get_class($object):$object;
if(!$this->_acl->has($class)) {
require_once 'Zend/Acl/Resource.php';
$this->_acl->addResource(new Zend_Acl_Resource($class));
$this->_acl->addResource(new \fproject\amf\acl\Resource($class));
}
$call = array($object, "initAcl");
if(is_callable($call) && !call_user_func($call, $this->_acl)) {
Expand Down
Loading

0 comments on commit 213afde

Please sign in to comment.