可能です、毎回使っています。まず、Zend_Aclが検証するリソースは任意のエンティティ(文字列)であり、特定のモジュールやコントローラーに関連している必要はないことを忘れないでください。文字列「hello」を指定できます。プログラムでは、ユーザーがリソース「hello」にアクセスできるかどうかを確認できます。Zend_Navigationにリンクを表示するために、「ログインボタン」、「ログアウトボタン」などの任意のリソースをよく使用します。
あなたの場合、リソースを(aclで)モジュール/コントローラーレイアウトにマップできる文字列として定義する必要があります。たとえば、モジュールfooとコントローラーバーの場合、リソース「foo.bar」を定義します。アクセスチェック手順では、モジュールとコントローラーの名前を読み取り、それらを文字列にマージしてリソースを取得します。
実用的な例では:
class Application_Plugin_AccessCheck extends Zend_Controller_Plugin_Abstract {
...
public function preDispatch(Zend_Controller_Request_Abstract $request){
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
...
$resource = $module . '.' . $controller; //we create the custom resource according to the model we have defined
...
$role=NULL;
if($this->_auth->hasIdentity()){
$identity = $this->_auth->getStorage()->read(); //depending on your implementation
$role = $identity->role; //depending on your implementation
}
...
if(!$this->_acl->isAllowed($role, $resource, $action)){
//deny access
}
//allow access
}
}