Re: ACL - delete groups?

2012-10-18 Thread Adam Strom
Thanks, Jeremy - that's just the answer I needed.  The docs seemed to 
indicate that this type of handling would be taken care of by the Acl 
component of Cake, so thanks for clearing it up.  I appreciate the help!

Best,

Adam

On Thursday, 18 October 2012 00:49:54 UTC-4, Jeremy Burns wrote:
>
> The first thing to fix is referential integrity in your database so that a 
> group that has users cannot be deleted. If your db won't support RI (if 
> you're using MyIsam instead of InnoDB, for example) then at least put some 
> checks in your code before you do the delete. If you don't, the users 
> belong to a now vanished group. That will confuse the Acl tables as they do 
> not deploy RI out of the box (they should have relations between aros => 
> aros_acos <= acos, but they don't), and even then it's hard to restrict 
> group deletes there as the foreign key to either groups.id or users.id is 
> stored in the same field in the aros table, although you can add RI from 
> aros.parent_id => aros.id. If the group that contains the users is 
> removed from the aros table, the parent id points to an id that doesn't 
> exist and the code will explode.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com 
>
> On 18 Oct 2012, at 04:53:25, Vanja Dizdarević 
> > 
> wrote:
>
> Can you post some code maybe?
>
> On Thursday, October 18, 2012 1:25:22 AM UTC+2, Adam Strom wrote:
>>
>> Hi All -
>>
>> I've completed the Acl tutorial in the 2.0 docs and it says: "...anytime 
>> you create or delete a user/group the Aro table is updated." 
>>
>> Yet when I delete a group that has users assigned to it, any further 
>> edits to those users throws an error:
>>
>> "Error: [CakeException] AclNode::node() - Couldn't find Aro node 
>> identified by "Array
>> (
>> [Aro0.model] => User
>> [Aro0.foreign_key] => 16
>> )"
>>
>> Even if I assign them to an existing group, the update occurs within the 
>> Users table but the aros table never gets a new entry for that user.
>>
>> Any thoughts? 
>>
>> Thanks!
>>
>> Adam
>>
>
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> cake-php+u...@googlegroups.com .
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>  
>  
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: ACL - delete groups?

2012-10-17 Thread Jeremy Burns | Class Outfit
The first thing to fix is referential integrity in your database so that a 
group that has users cannot be deleted. If your db won't support RI (if you're 
using MyIsam instead of InnoDB, for example) then at least put some checks in 
your code before you do the delete. If you don't, the users belong to a now 
vanished group. That will confuse the Acl tables as they do not deploy RI out 
of the box (they should have relations between aros => aros_acos <= acos, but 
they don't), and even then it's hard to restrict group deletes there as the 
foreign key to either groups.id or users.id is stored in the same field in the 
aros table, although you can add RI from aros.parent_id => aros.id. If the 
group that contains the users is removed from the aros table, the parent id 
points to an id that doesn't exist and the code will explode.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 18 Oct 2012, at 04:53:25, Vanja Dizdarević  wrote:

> Can you post some code maybe?
> 
> On Thursday, October 18, 2012 1:25:22 AM UTC+2, Adam Strom wrote:
> Hi All -
> 
> I've completed the Acl tutorial in the 2.0 docs and it says: "...anytime you 
> create or delete a user/group the Aro table is updated." 
> 
> Yet when I delete a group that has users assigned to it, any further edits to 
> those users throws an error:
> 
> "Error: [CakeException] AclNode::node() - Couldn't find Aro node identified 
> by "Array
> (
> [Aro0.model] => User
> [Aro0.foreign_key] => 16
> )"
> 
> Even if I assign them to an existing group, the update occurs within the 
> Users table but the aros table never gets a new entry for that user.
> 
> Any thoughts? 
> 
> Thanks!
> 
> Adam
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> 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+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>  
>  

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: ACL - delete groups?

2012-10-17 Thread Vanja Dizdarević
Can you post some code maybe?

On Thursday, October 18, 2012 1:25:22 AM UTC+2, Adam Strom wrote:
>
> Hi All -
>
> I've completed the Acl tutorial in the 2.0 docs and it says: "...anytime 
> you create or delete a user/group the Aro table is updated." 
>
> Yet when I delete a group that has users assigned to it, any further edits 
> to those users throws an error:
>
> "Error: [CakeException] AclNode::node() - Couldn't find Aro node 
> identified by "Array
> (
> [Aro0.model] => User
> [Aro0.foreign_key] => 16
> )"
>
> Even if I assign them to an existing group, the update occurs within the 
> Users table but the aros table never gets a new entry for that user.
>
> Any thoughts? 
>
> Thanks!
>
> Adam
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




ACL - delete groups?

2012-10-17 Thread Adam Strom
Hi All -

I've completed the Acl tutorial in the 2.0 docs and it says: "...anytime 
you create or delete a user/group the Aro table is updated." 

Yet when I delete a group that has users assigned to it, any further edits 
to those users throws an error:

"Error: [CakeException] AclNode::node() - Couldn't find Aro node identified 
by "Array
(
[Aro0.model] => User
[Aro0.foreign_key] => 16
)"

Even if I assign them to an existing group, the update occurs within the 
Users table but the aros table never gets a new entry for that user.

Any thoughts? 

Thanks!

Adam

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: ACL delete

2010-10-28 Thread cricket
On Thu, Oct 28, 2010 at 5:58 AM, Unite  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


ACL delete

2010-10-28 Thread Unite
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.

Thanks

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: ACL - Delete/ other CRUD operations.

2006-08-11 Thread calzone

I have run into this same problem and filed a ticket for it.  If I knew
how to find tickets I've filed on trac, I would track it down for you
and post the number here.

In the meantime, I have written a fairly extensive component + plugin
for managing ACLs that I can share witih you, although I didn't feel it
was 100% ready for sharing, it might save you a lot of time to
implement if I just also give you some documentation about some stuff
about it.

The upshot is, in order to delete ACOs and AROs, I have created two
roots in each of my tables, one called root and the other called
deleted. When I delete something, I move it under deleted instead of
actually deleting it.

Another bug I've found is that you can't "demote" an ACO or ARO into
any node that is an ancestor of the node you want to "demote."  It
refuses to do it.  So I created a reparent routine that moves the node
in question to deleted first, then back  under the target node.

Final bug: you can't reparent a node if it has children of it's own.
Well, you can, but your table ends up corrupted.  So I added logic to
prevent reparenting with children through the UI.

UPDATE:

ok, so I found the bugs on trac:

https://trac.cakephp.org/ticket/1232
https://trac.cakephp.org/ticket/1233
https://trac.cakephp.org/ticket/1234
https://trac.cakephp.org/ticket/1235

Please let me know if you want me to share my code with you. I plan to
soon put it up as a package people can download from cakeforge.  For
now, it does require editing two core files, so that's one reason why
it's not yet primetime.

chris


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



ACL - Delete/ other CRUD operations.

2006-08-11 Thread Jeff

I'm starting to work with ACL and am having problems deleting ACOs.
When I do the ACO->remove($id) it removes it from the DB, but doesn't
run any sort of _syncTable.  Is this logic I have to do myself?  Or, is
there a way to have cake finish doing it's job, and sync up the table
for me when I remove an item?

Thanks,


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---