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
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()]
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
-~----------~----~----~----~------~----~------~--~---