ACL problems

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ACL problems

Asger Hallas-2

Hi,

 

I’m trying to convert to the new ACL, but I’m having quite some difficulties.

 

I have been adding some group-roles:

 

$this->_acl->addRole(new Zend_Acl_Role($groupname));

 

Then I try to add some rules for each group like this:

 

$this->_acl->allow($groupName, array(1,2,3));

 

But I get the exception:

 

Resource '1’ not found

 

Can anybody tell me what I’m doing wrong?

Been trying to get info from the manual, but it excludes examples on resources for simplicity’s sake…

 

/Asger

 

 

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/
Reply | Threaded
Open this post in threaded view
|

Re: ACL problems

Andris Paikens
Hi Asger,

You should define resources like this:
$this->_acl->add(new Zend_Acl_Resource('resourceIdOrNameHere'));

So, all picture is like this:

//define role
$this->_acl->addRole(new Zend_Acl_Role($groupname));
//define resource
$this->_acl->add(new Zend_Acl_Resource('resource1'));
$this->_acl->add(new Zend_Acl_Resource('resource2'));

//and then You can "allow":
$resourceArray = array('resource1', 'resource2');
$this->_acl->allow($groupname, $resourceArray);
//acl->allow can have third parameter - type of action allowed, for
example 'view"
//$this->_acl->allow($groupname, $resourceArray, 'view');

Hope this helps,
Andris

On 19/12/06, Asger Hallas - butterflies <[hidden email]> wrote:

>
>
>
>
> Hi,
>
>
>
> I'm trying to convert to the new ACL, but I'm having quite some
> difficulties.
>
>
>
> I have been adding some group-roles:
>
>
>
> $this->_acl->addRole(new Zend_Acl_Role($groupname));
>
>
>
> Then I try to add some rules for each group like this:
>
>
>
> $this->_acl->allow($groupName, array(1,2,3));
>
>
>
> But I get the exception:
>
>
>
> Resource '1' not found
>
>
>
> Can anybody tell me what I'm doing wrong?
>
> Been trying to get info from the manual, but it excludes examples on
> resources for simplicity's sakeā€¦
>
>
>
> /Asger
>
>
>
>   ###########################################
>
> This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
> For more information, connect to http://www.f-secure.com/


--
Andris Paikens
-------------------------
+371 29 3565 29
http://webshaman.blogspot.com/