Django has an authentication model of :
1. Creating users
2. Assigning them permissions or group permissions

Use Authenticate() to authenticate users.  Based on the assigned
permissions they will have access to parts of your site.  Basically you
create views and the objects in the views are available to users with
permissions.  For example :

def myview(request)
                                             #My users database has a user
'Guy" with password "1234"
myuser =
users_Users.object.values("users_Name').filter(users_Name_starts_with =
"Guy")
                                             #Permissions for this object
can be set.
myuser.has_view_permission('foo.bar')
myuser.has_add_permission('foo.bar')
myuser.has_delete_permission('foo.bar')    #where foo is the application
and bar the model
object_list = Content.objects.all()




[image: --]

Maninder Kumar
[image: http://]about.me/maninder.s.kumar
<http://about.me/maninder.s.kumar?promo=email_sig>




On Sun, Jan 19, 2020 at 3:49 PM Doddahulugappa.B <doddahuluga...@gmail.com>
wrote:

> Thank you for your response. Can you please Explain me how to do that..
>
> On Sun, Jan 19, 2020, 2:09 PM maninder singh Kumar <
> maninder.s.ku...@gmail.com> wrote:
>
>> Could it be that there is a user from each department and each user in a
>> department has a role ?
>>
>>
>> [image: --]
>>
>> Maninder Kumar
>> [image: http://]about.me/maninder.s.kumar
>> <http://about.me/maninder.s.kumar?promo=email_sig>
>>
>>
>>
>>
>> On Sun, Jan 19, 2020 at 3:04 PM Doddahulugappa.B <
>> doddahuluga...@gmail.com> wrote:
>>
>>> Hi team,
>>>
>>> How to make role based access in django. For ex.
>>>
>>> If employee names and their department in one table.
>>>
>>>  And also we assign department to user. With manytomany field.. So how
>>> can i display only the records of employees and their department which is
>>> assigned to the user.
>>>
>>> Kindly help..
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKfjjGpT_xeQaRqySC4SX_v2-aVOb7u5%2B9qoPhByQ8Wq2DM4ow%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAKfjjGpT_xeQaRqySC4SX_v2-aVOb7u5%2B9qoPhByQ8Wq2DM4ow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABOHK3TS62AWZLjR48m%2BzG%3DgWouvCQfY90KcpMAsMD_T%3DoOW1A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CABOHK3TS62AWZLjR48m%2BzG%3DgWouvCQfY90KcpMAsMD_T%3DoOW1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKfjjGqsW_FUKhEoEn4fxBR46sdF-xFhct864J_cmp-EjbbUeg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKfjjGqsW_FUKhEoEn4fxBR46sdF-xFhct864J_cmp-EjbbUeg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABOHK3TBDQ-m2p-p4RVGtanumj7TeA-o75PM0UyHfw94EbMFTQ%40mail.gmail.com.

Reply via email to