You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/authorization.rst
+26-1Lines changed: 26 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
Authorization in Django
2
2
=======================
3
3
4
-
There are two main ways you may want to limit access to data when
4
+
There are several ways you may want to limit access to data when
5
5
working with Graphene and Django: limiting which fields are accessible
6
6
via GraphQL and limiting which objects a user can access.
7
7
@@ -108,3 +108,28 @@ method to your ``DjangoObjectType``.
108
108
if post.published or context.user == post.owner:
109
109
return post
110
110
returnNone
111
+
112
+
Adding login required
113
+
---------------------
114
+
115
+
If you want to use the standard Django LoginRequiredMixin_ you can create your own view, which includes the ``LoginRequiredMixin`` and subclasses the ``GraphQLView``:
116
+
117
+
.. code:: python
118
+
119
+
from django.contrib.auth.mixins import LoginRequiredMixin
0 commit comments