Listing 6.11 shows the controller-centric rule functions, allow() and deny() which proxy through to the
underlying Acl object.
Listing 6.10: Acl action helper
/**
* Proxy to the underlying Zend_Acl's allow() function.
*
* We use the controller's name as the resource and the
* action name(s) as the privilege(s)
*
* @param Zend_Acl_Role_Interface|string|array $roles
* @param string|array $actions
* @uses Zend_Acl::setRule()
* @return Places_Controller_Action_Helper_Acl Provides a fluent interface
*/
public function allow($roles = null, $actions = null)
{
$resource = $this->_controllerName;
$this->_acl->allow($roles, $resource, $actions);
return $this;
}
/**
* Proxy to the underlying Zend_Acl's deny() function.
*
* We use the controller's name as the resource and the
* action name(s) as the privilege(s)
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
*
* @param Zend_Acl_Role_Interface|string|array $roles
* @param string|array $actions
* @uses Zend_Acl::setRule()
* @return Places_Controller_Action_Helper_Acl Provides a fluent interface
*/
public function deny($roles = null, $actions = null)
{
$resource = $this->_controllerName;
$this->_acl->allow($roles, $resource, $actions);
return $this;
}
(annotation) <#1.
Pages:
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208