我实际上需要一个能够评估来自get的参数的断言。
以下是一些代码片段
class Something_Acl_RestrictedAssertion implements Zend_Acl_Assert_Interface
{
public function assert(Zend_Acl $acl,
Zend_Acl_Role_Interface $role = null,
Zend_Acl_Resource_Interface $resource = null,
$privilege = null)
{
//Gets the model and db queries
$Service = Application_Model_ServiceFactory::getInstance();
$member = Zend_Auth::getInstance()->getIdentity()->getRoles();
foreach ($member as $entity)
{
//Ruolo del superviewer convenzioni
if ($entity->id = 1)
{
if (something->getRequest()->getParam('hello'))
{
//Black magick
}
}
...}
}
我正在寻找一种方法来获取断言正在检查的页面的参数,如果可能的话,避免创建子类或包装器。
提前谢谢!
答案 0 :(得分:1)
简单地说,
$request = Zend_Controller_Front::getInstance()->getRequest();
$action = $request->getParam('action');
//$request is a Zend_Controller_Request_Abstract instance
希望有所帮助
答案 1 :(得分:0)
无论是一般方式,ZF都不允许这样做:
isset($_GET['hello']);
或者
$get = $this->getRequest()->getQuery();
isset($get->hello);
// or if this throws a warning:
property_exists($get, 'hello');
http://framework.zend.com/manual/2.0/en/modules/zend.http.request.html http://framework.zend.com/manual/1.5/en/zend.controller.request.html#zend.controller.request.http.dataacess