Hi,
I have just released an experimental django-pobject, an expressive and
concise permission module for django views at goo.gl/L6h7D. It is
inspired by Q object of django.db. It supports bitwise operators AND ,
OR , XOR and invert ' ~ ' for complex permission construction. For
example, you can do something like this:

# permissions.py
def is_father(request, family_id, member_id):
    return request.user.is_father(family_id)

def is_mother(request, family_id, member_id):
    return request.user.is_father(family_id)

def is_child(request, family_id):
    return request.user.is_child(family_id)

def is_neighbor(request, family_id):
    return request.user.is_neighbor(family_id)


# views.py
@permission_required('', (P(is_father) | P(is_mother) | P(is_child)) &
~(neighbor))
def announce(request, family_id):
    # makes announcement and returns a response


It somewhat overlaps object permissions introduced in Django 1.2 and
many object permission apps out there, but I feel another alternative
is probably welcome as well. This is experimental because I am not
sure if it is even relevant, but I use it for my projects.

Comment and constructive criticism are welcome.




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

Reply via email to