View Single Post
  #1 (permalink)  
Old 01-21-2008, 06:01 PM
ickmund ickmund is offline
Junior Member
 
Join Date: Jan 2008
Posts: 1
Default "subclassing" the resources in ACL

Sorry if the topic is misleading, I can't figure out a better way to describe it.

§ 2.2.1 in the ZF docs talk about setting up resources in a way that I can't quote see the benefit of.

PHP Code:
<?php
$acl
->add(new Zend_Acl_Resource('news'));                 // news
$acl->add(new Zend_Acl_Resource('latest'), 'news');       // latest news
You would check if a user could view latest news with something like
PHP Code:
isAllowed('staff''latest''view'
The thing I don't understand here is what is gained using this method compared to setting up the resource with
PHP Code:
$acl->add(new Zend_Acl_Resource('latest news'));       // latest news 
If I was to several different feeds, say 'news' and 'notices', and wanted to set up a 'latest' for both of those, checking isAllowed('staff', 'latest', 'view') wouldn't cut it anymore.

This wouldn't work:
PHP Code:
$acl->add(new Zend_Acl_Resource('news'));                 // news
$acl->add(new Zend_Acl_Resource('notices'));              // notices
$acl->add(new Zend_Acl_Resource('latest'), 'news');       // latest news
$acl->add(new Zend_Acl_Resource('latest'), 'notices');    // latest notices

isAllowed('staff''latest''view'); 
Is there a way to do something like "is allowed to view latest that subclass news"?

If not, why should you set up your resources like that?

I'm hoping I've made *some* sense... evaluating the framework, so I'm pretty new to it still...

//Magnus
Reply With Quote