zend framework - isAllowed() is not taking the parameters value -
class application_plugin_accesscheck extends zend_controller_plugin_abstract { private $_auth=null; private $_acl=null; public function __construct() { $auth = zend_auth::getinstance(); $acl = new zend_acl; $this->_auth = $auth; $this->_acl = $acl; } public function predispatch(zend_controller_request_abstract $request) { $resource = $request->getcontrollername(); $action = $request->getactionname(); $identity = $this->_auth->getstorage()->read(); $role = $identity->role; if(!$this->_acl->isallowed($role,$resource,$action)){ $request->setcontrollername('auth') ->setactionname('login'); } //echo '<pre>';print_r('inside plugins......success');die(); } } acl plugin page using. in particular line if(!$this->_acl->isallowed($role,$resource,$action)) function isallowed not taking parameters, url comes blank. if assign if(!$this->_acl->isallowed($role=null,$resource=null,$action=null)), page opens doesn't have meaning if set null. seeking adding model class "asiaacl.php" more clearification class model_asian_acl extends zend_acl{ public function __construct(){ $this->add(new zend_acl_resource('data')); $this->add(new zend_acl_resource('updatecat'),'data'); $this->add(new zend_acl_resource('detelecategory'),'data'); $this->add(new zend_acl_resource('datas')); $this->add(new zend_acl_resource('listcat'),'datas'); $this->addrole(new zend_acl_role('user')); $this->addrole(new zend_acl_role('admin'),'user'); $this->allow('user','datas','listcat'); $this->allow('admin','data','updatecat'); $this->allow('admin','data','deletecategory'); } } thanks.
i hope not blind acl empty object. see have not assigned roles , access control acl.
with isallowed() check role , resource there nothing acl has check against. have either create/extend own acl class or assign roles , controls on fly in plugin.
see acl doku
update
great, have own acl class not using it!
$acl = new zend_acl; // empty default acl, no roles nothing // should connect own acl class $acl = new model_asian_acl;
if haven't @ acl class closely think should work.
Comments
Post a Comment