On Wed, Apr 23, 2008 at 3:15 PM, Christopher Arndt <[EMAIL PROTECTED]> wrote:
>
>  Jorge Vargas schrieb:
>
> > about the adaptations I got some ideas, why don't we work on some more
>  > methods that will provide a much better adaptation some ideas I have
>  > on my mind are.
>  > User.belongs_to(group)
>
>  user in group.users
>
>  > Group.has_User(user)
>
>  group in user.groups
>
>  > User.can_do(permission)
>
>  for group in user.groups:
>      if permission in group.permissions:
>          return True
>
yes I know about those but as you may know they are a bit inheficient
as they have to load many objects into memory, the methods I'm
suggesting will be more efficient creating exact queries.

>  But the last one is IMO better solved in a higher authority layer, so
>  that you can abstract thinks like
>
>  if identity.is_anonymous:
>      groups = [Group.query().get_by(group_name='anonymous').one()]
>  else:
>      groups = identity.groups + \
>        [Group.query().get_by(group_name='authenticated').one()]
>
yes that's true but I still believe we could get a specific permission
because sometimes it's nice to just ask "if user can do permission"
even if in the back it's going thru the group it's a nice idiom.

>  for group in groups:
>      if permission in group.permissions:
>          return True
>
>  Also:
>
>  Group.users
>  Group.by_group_name()           #*
>  Permission.by_permission_name() #*
>
>  * Should we also provide User.by_name(), Group.by_name() and
>  Permission.by_name() as aliases?
>
>  Chris
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to