On Dec 10, 8:41 am, Adonis <achrysoch...@hotmail.com> wrote:
> Hi,
>
> I am trying to figure out the best way to do this.
> I have built a django application where users are members in projects.
> Thus, i need to assign users different permission sets that correspond
> to different projects. The django core permission system cannot solve
> this by itself. I took a look at django-autority extenion which seems
> able enough to solve this but could not figure out how to do this.
>
> {% ifhasperm [permission_label].[check_name] [user] [*objs] %}
>     lalala
> {% else %}
>     meh
> {% endifhasperm %}
>
> in the example above, i can check a permission of a user in an object
> (e.g a project in my app).
> I would need multiple views of auth_user_user_permissions such as:
> project1_user1_permset1, project2_user1_permset3 etc.
>
> Any suggestions will be appreciated!

There are some details about your implementation I have to guess at,
but what about using a many2many with a through object.

So you have Project objects, and your User objects

Projects have a m2m to Users through a ProjectMember object and that
contains what permissions the user has.

All the views that need to check the permissions should be able to
look up that object and act accordingly.

http://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany

-Preston

--

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