Thursday, October 28, 2010

Re: ACL delete

On Thu, Oct 28, 2010 at 5:58 AM, Unite <wavorster@gmail.com> wrote:
> Question is simple : I need to be able to delete a row (ARO ACO
> relationship) using the ACL component.
>
> Note :
> I do not mean setting permissions for CRUD to -1-1-1-1
> The row needs to be physically removed.
> CRUD of -1-1-1-1 DOES NOT have the same effect as the row not being
> there at all.
>
> Reason :
> I have made a ACL interface and need users to inherit permissions from
> there parent or group.

In your controller, you can use $this->Acl->Aco & $this->Acl->Aro. For
example, this is how I fetch the permissions that a Group has for
Sections:

$perms = $this->Acl->Aco->find(
'all',
array(
'fields' => array('Aco.foreign_key'),
'conditions' => array(
'Aco.model' => 'Section',
'Aco.id = Permission.aco_id'
),
'recursive' => -1,
'joins' => array(
array(
'table' => 'aros',
'alias' => 'Aro',
'type' => 'INNER',
'conditions'=> array(
'Aro.model' => 'Group',
"Aro.foreign_key = ${group_id}"
)
),
array(
'table' => 'aros_acos',
'alias' => 'Permission',
'type' => 'INNER',
'conditions'=> array(
'Permission.aro_id = Aro.id',
'Permission._read >= 0'
)
)
)
)
);

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: