Re: Django Roles/Permissions

266 views
Skip to first unread message

Amirouche

unread,
Jan 13, 2013, 4:25:45 AM1/13/13
to django...@googlegroups.com
Héllo Chung,

Did you have a look at https://github.com/lukaszb/django-guardian#usage it adds user permissions for objects, I don't know how it works with a Django 1.5 though.

Regards

On Sunday, January 13, 2013 1:39:45 AM UTC+1, Chung Wu wrote:
Hi there,

I am having difficulty figuring out how to structure the following problem:

Users have different roles/groups:

Admin, Manager, Author

Admins can edit every user, can view list of all users, delete all users
Manager can edit all users who are not admins or managers, ""
Author, can only edit themselves, view themselves

Users are associated with Posts

The posts would follow the same logc

Authors can only see posts they have created, Edit them etc

Is there a generic way to do this?

Currently I have views that list all users, post etc but how would I integrate roles/permissions to filter the lists, prevent the user for editing others etc.

Hope you can point me in the right direction

Thanks

Iñigo Medina

unread,
Jan 13, 2013, 7:24:29 AM1/13/13
to django...@googlegroups.com

On Sat, Jan 12, 2013 at 04:39:45PM -0800, Chung Wu wrote:
> Hi there,
>
> I am having difficulty figuring out how to structure the following problem:
>
> Users have different roles/groups:
>
> Admin, Manager, Author
>
> Admins can edit every user, can view list of all users, delete all users
> Manager can edit all users who are not admins or managers, ""
> Author, can only edit themselves, view themselves
>
> Users are associated with Posts
>
> The posts would follow the same logc
>
> Authors can only see posts they have created, Edit them etc
>
> Is there a generic way to do this?
>
> Currently I have views that list all users, post etc but how would I
> integrate roles/permissions to filter the lists, prevent the user for
> editing others etc.

You can code that by your own, creating an app for managing permissions whose
model is related to User model. Permissions model might contain the different
types of roles and the possible actions to.

Anyway, you already have Django Guardian, as said above. It allows you to
define easily permissions for a model (adding them to *Meta* class) and assign
them for any user/group.

I�igo

>
> Hope you can point me in the right direction
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/OUSzdMwTvroJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
Reply all
Reply to author
Forward
0 new messages