<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aviblock.com &#187; Zend Framework</title>
	<atom:link href="http://www.aviblock.com/blog/tag/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aviblock.com/blog</link>
	<description>My musings on web development</description>
	<lastBuildDate>Thu, 03 Jun 2010 13:40:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Alternative to Zend_Form ViewScript decorator</title>
		<link>http://www.aviblock.com/blog/2009/11/29/alternative-to-zend_form-viewscript-decorator/</link>
		<comments>http://www.aviblock.com/blog/2009/11/29/alternative-to-zend_form-viewscript-decorator/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 16:34:04 +0000</pubDate>
		<dc:creator>Avi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ViewScript decorator]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Form]]></category>

		<guid isPermaLink="false">http://www.aviblock.com/blog/?p=79</guid>
		<description><![CDATA[Zend_Form is great for prototyping forms. It takes a lot of the drudge work out, and makes forms easily &#8220;reusable&#8221;. The decorator system, which is admittedly a little scary for the uninitiated, is actually very powerful. I&#8217;m suer that eventually, however, we&#8217;ve all reached that point. The point where you spend more time configuring the [...]]]></description>
			<content:encoded><![CDATA[<p>Zend_Form is great for prototyping forms. It takes a lot of the drudge work out, and makes forms easily &#8220;reusable&#8221;. The decorator system, which is admittedly a little scary for the uninitiated, is actually very powerful. I&#8217;m suer that eventually, however, we&#8217;ve all reached that point. The point where you spend more time configuring the form to do what you want, then actually doing something with it.<span id="more-79"></span><br />
This is especially more important when working with talented designers who know their HTML/CSS, and know exactly what theywant to do with the form. Trying to mangle the form to do what they want in that case is generally a waste of time. It also makes it much harder for the designer to apply his CSS magic. You might look and smile at how beautiful <?=$this->form?> looks, abstracting away all you hard work. However the designer will likely have to see the generated html to get an understanding of the structure. Want to add a CSS class? Good luck.<br />
Eventually, we discover the ViewScript decorator. Although the code in that viewscript can be a bit complex, we once again have panacea. The designer gets a viewscript with which he can muck around. You get to set one or two decorators and we&#8217;re back to <?=$this->form?> again.<br />
How does the ViewScript decorator work? The workhorse of it involves setting up a partial, and pushing in to the &#8220;model&#8221; of the partial, the form under the alias &#8220;element&#8221;. Now, anybody who&#8217;s read the Zend Framework performance guide, will have noticed that use of partials is somewhat discouraged. To create a partial, it involves cloning Zend_View, and is somewhat of an unneeded overhead.<br />
So is there an an alternative? It hit me today, that there&#8217;s absolutely nothing wrong with just outputting the form in the viewscript it self. Instead of:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">renderViewHelper</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/form&gt;</pre></div></div>

<p>In a form ViewScript, just output that directly into your viewscript!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">renderViewHelper</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/form&gt;</pre></div></div>

<p>If you want the script to be reusable, just use the render viewhelper, as recommended in the performance guide.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aviblock.com/blog/2009/11/29/alternative-to-zend_form-viewscript-decorator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ACL in Zend Framework</title>
		<link>http://www.aviblock.com/blog/2009/03/19/acl-in-zend-framework/</link>
		<comments>http://www.aviblock.com/blog/2009/03/19/acl-in-zend-framework/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 20:21:23 +0000</pubDate>
		<dc:creator>Avi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Acl]]></category>

		<guid isPermaLink="false">http://www.aviblock.com/blog/?p=22</guid>
		<description><![CDATA[When I first started using the Zend Framework, one of the most confusing things was the ACL component. Even after I succesfully implemented an ACL solution in my app, something seemed wrong with it.
I would like to argue that the proper use for the Zend ACL is actually impossible, since there is a reported bug [...]]]></description>
			<content:encoded><![CDATA[<p>When I first started using the Zend Framework, one of the most confusing things was the ACL component. Even after I succesfully implemented an ACL solution in my app, something seemed wrong with it.</p>
<p>I would like to argue that the proper use for the Zend ACL is actually impossible, since there is a reported <a href="http://zendframework.com/issues/browse/ZF-1721">bug in the code</a> which, to my knowledge, has not been fixed.</p>
<p>The use case I will discuss is where you want to only authors to edit articles and only to articles authored by themselves. I think this is a fairly common case.<br />
<span id="more-22"></span></p>
<p>How does the ACL help us? The ACL allows the developer to setup access rules for arbitrary resources and arbitrary roles. The key word here is &#8220;arbitrary&#8221;, and I&#8217;ll get back to that in a moment.</p>
<p>My feeling is that when most people start out with the ACL, they assume that resources are controllers (or some combination of module and controller), and permissions are actions.  So, for example, let&#8217;s say you had a controller called &#8220;Article&#8221; with an action called &#8220;edit&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> ArticleController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Action <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> editAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//do stuff</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>So an ACL would be set up with something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$acl</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Acl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$acl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Zend_Acl_Resource<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'article'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$acl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addRole</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Zend_Acl_Role<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$acl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">deny</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$acl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allow</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'article'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This looks farely straight forward. Some place before the action is dispatched, like in a plugin, action helper or whatever you want, you would do a check against this acl.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$acl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAllowed</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$role</span><span style="color: #339933;">,</span> <span style="color: #000088;">$resource</span><span style="color: #339933;">,</span> <span style="color: #000088;">$permission</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>There are two problems with this approach, one obvious and one not so obvious.</p>
<p>The obvious one is that, while this may be successful in blocking regular users from editing the articles, it doesn&#8217;t block another author from editing the article.</p>
<p>In order to do that, we need to add in an additional assertion:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$acl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allow</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'article'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> AssertionIsArticleAuthor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The problem then becomes: in this assertion, how do you know which article it is? How do you know who the current author is? These can be very tricky questions. You might have to somehow stick the request object in there, and access the Zend_Auth singleton. While these certaintly are viable solutions, they just &#8220;smell&#8221; bad.</p>
<p>The other not so obvious problem is seen by taking a few steps back and looking at the whole problem from the beginning. The first question to ask is, what exactly are we trying to solve here? We want to restrict access to an article. So what did we do instead? We restricted access to a controller? What kind of sense does that make? Additionally, we are now tying in our ACL implementation to the url structure of the site. That is primarily a function presentation. If we would want to change that, it would require changing our ACL implentation. While Zend_Acl is certainly a &#8220;Zend&#8221; component, it has nothing directly to do with Zend MVC, but this approach ties us down to Zend MVC. What if we decided one day that we did not like the MVC components of ZF and wanted to move to Symfony or <a href="http://www.apteno.net/AptitudeCMS/trac/wiki/MVCnPHPProject">MVCnPHP</a>?</p>
<p>Zend Framework is  primarily a presentation framework. It helps in providing a clear and organized way to bring the presentation layer to the user. And that&#8217;s what it excels at. That, I believe, is the number one reason why they don&#8217;t ship with a &#8220;model&#8221; component. The model layer must be provided by yourself, and this part is probably the hardest part of the whole game. But if you keep some simple principles in mind, and keep focused, you can reapproach this whole problem in a new light.</p>
<p>We&#8217;ll start with our model layer. This should be fully functional without ZF. Pretend you&#8217;re writing a desktop app. Or a shell script. Whether or not the model layer should be tied to the database or separated from that as well, is a different question. </p>
<p>My personal approach, one which is fairly common in the Java world, is to work with Business objects, which are just &#8220;POPOs&#8221;&#8230;Plain Old PHP Classes. These business objects represent all the entities in my application&#8230;but this is a post for later. Let&#8217;s not digress too much.</p>
<p>In our model layer, we have two objects, an Article and an Author.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Article <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$body</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #009933; font-style: italic;">/**
   * @var Author
   */</span>
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$author</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Author <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Any business logic in your app should either take place within these objects, or within other objects that act as a service layer. Your controllers should either talk to these service layer objects or to the business objects themselves.</p>
<p>When you retrieve data from the database, instead of keeping it around as array, put it in one of these objects. You can also use a custom Zend_Db_Row object for this to if you want to make things really simple.</p>
<p>Now that we&#8217;re dealing with objects, we can see that we want to restrict access to an Article object to the Author object contained within it. So our resource becomes the Article and the role is the Author. How do you define these as resources and roles? All we have to do is have our objects implement the Zend_Acl_Resource and Zend_Acl_Role interfaces! So we will modify the previous code to something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Article implements Zend_Acl_Resource_Interface <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$body</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #009933; font-style: italic;">/**
   * @var Author
   */</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$author</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getResourceId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'article'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Author implements Zend_Acl_Role_Interface <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getRoleId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'user'</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now we write our custom assertion:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Chintion_Acl_Assert_AssertIsArticleAuthor implements Zend_Acl_Assert_Interface
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">assert</span><span style="color: #009900;">&#40;</span>Zend_Acl <span style="color: #000088;">$acl</span><span style="color: #339933;">,</span> Zend_Acl_Role_Interface  <span style="color: #000088;">$author</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span>
    Zend_Acl_Resource_Interface <span style="color: #000088;">$article</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$privilege</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
          <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">article</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">author</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$author</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now when you have your Article object, you can take your Author object (which you can either store in Zend_Auth or construct it from the data in Zend_Auth), and do a check like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$acl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAllowed</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$author</span><span style="color: #339933;">,</span> <span style="color: #000088;">$article</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Very nice, clean and simple.</p>
<p>Except&#8230;..</p>
<p>It won&#8217;t work. By the time the assertion gets a hold of the instance of Zend_Acl_Role_Interface, its been demoted to plain old Zend_Acl_Role. Ditto for Zend_Acl_Resource_Interface. It doesn&#8217;t have our fancy beefed up role or resource.</p>
<p>This I think is due to the bug report that I linked to at the beginning. Fortunately, for the moment, there&#8217;s a work around:</p>
<p>We have to override the method Zend_Acl::get(Zend_Acl_Resource_Interface $resource) and the method Zend_Acl_Role_Registry::get(Zend_Acl_Role_Interface $role);</p>
<p>To do this, you have to subclass Zend_Acl and overridde the get method as such:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$resource</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$resource</span> instanceof Zend_Acl_Resource_Interface<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$resource</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resource</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>and similary for Zend_Acl_Role_Registry:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> RoleRegistry <span style="color: #000000; font-weight: bold;">extends</span> Zend_Acl_Role_Registry <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$role</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$role</span> instanceof Zend_Acl_Role_Interface<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$role</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$role</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>and in your subclassed Zend_Acl:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_roleRegistry <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RoleRegistry<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.aviblock.com/blog/2009/03/19/acl-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
