It's kind of hard to tell what you are trying to do by the description
you have, but you can check out my app:
https://bitbucket.org/mhall119/django-extauth/wiki/Home

It will let you create user roles like "document owner", and then set
your specific permissions to the role.  Then, in your code, you just
have to see if the user has that permission against a specific instance
of a document, and it will check to see if the user qualifies for a role
with that permission.

-- 
Michael <mhall...@gmail.com>

On Sat, 2010-10-09 at 11:12 -0700, stargazer wrote:
> It seems I have to implement quite complex permission system and I
> want to avoid writing many if- statements... Let me describe:
> 
> There are two types of users in the application. Let say users of type
> A and B
> 
> Users of type A (like a authors of a blog) can create let say a
> Document (could be similar to a blog post) Users of type B can add
> comments to the document and can do, let say, some actions with the
> document.
> Users of type A can do some actions with the document too.
> 
> Now the actions A-users and B-users depends on:
> -attributes of A-user
> -attributes of B-user
> -attributes of the Document
> Imagine something like "only premium members can do this..."
> 
> To check all these things with "if" statements will be a nightmare.
> I can imagine some state machine driven by a transition table, where
> all these attributes of A, B and Document are inputs and the actions
> are output.
> 
> Any alternatives?
> Any ready-to-use state-machine implementation which fits for this
> task?
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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