I feel like I understand but dont seem o get thsi to work.
Here is my main page:
require_once 'Zend/Acl.php';
$acl=new Zend_Acl();
require_once 'Test.php';
$test = new Test($acl);
require_once('Zend/Acl/Role.php');
$acl->addRole(new Zend_Acl_Role('guest'))
->addRole(new Zend_Acl_Role('member'));
require_once('Zend/Acl/Resource.php');
$acl->add(new Zend_Acl_Resource('test'));
$acl->deny('guest', 'test');
$acl->allow('member', 'test');
echo $acl->isAllowed('guest', 'test') ? 'allowed' : 'denied';
echo $test->echoHello();
I am trying to deny the echoHello from happening.
Here is my Test.php class
require_once 'Zend/Acl/Resource/Interface.php';
class Test implements Zend_Acl_Resource_Interface
{
public function __construct(Zend_Acl $acl) {
$this->_acl = $acl;
}
public function getResourceId()
{
return 'test';
}
public function echoHello(){
if (!$this->_acl->isAllowed('guest', __CLASS__, __FUNCTION__)) {
throw new Exception('ACCESS DENIED!');
}
return 'hello';
}
}
--
View this message in context:
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18389571.html
Sent from the Zend Framework mailing list archive at Nabble.com.