Skip to content

Commit 46d136f

Browse files
author
Jens Timmerman
committed
added documentation, info to the readme, changelog and added myself to contributors
1 parent 233498f commit 46d136f

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Diego Garcia
1717
Bas van Oostveen
1818
Bart Merenda
1919
Paul Oswald
20+
Jens Timmerman

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Changelog
100100
Development
101101
~~~~~~~~~~~
102102

103+
* #396: added an IsAuthenticatedOrTokenHasScope Permission
103104
* #357: Support multiple-user clients by allowing User to be NULL for Applications
104105

105106
0.10.0 [2015-12-14]

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Changelog
44
Development
55
~~~~~~~~~~~
66

7+
* #396: added an IsAuthenticatedOrTokenHasScope Permission
78
* #357: Support multiple-user clients by allowing User to be NULL for Applications
89

910

docs/rest-framework/permissions.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,21 @@ When the request's method is one of "non safe" methods, the access is allowed on
6363
required_scopes = ['music']
6464
6565
The `required_scopes` attribute is mandatory (you just need inform the resource scope).
66+
67+
68+
IsAuthenticatedOrTokenHasScope
69+
------------------------------
70+
The `TokenHasResourceScope` permission class allows the access only when the current access token has been authorized for **all** the scopes listed in the `required_scopes` field of the view but according of request's method.
71+
And also allows access to Authenticated users who are authenticated in django, but were not authenticated trought the OAuth2Authentication class.
72+
This allows for protection of the api using scopes, but still let's users browse the full browseable API.
73+
To restrict users to only browse the parts of the browseable API they should be allowed to see, you can combine this wwith the DjangoModelPermission or the DjangoObjectPermission.
74+
75+
For example:
76+
77+
.. code-block:: python
78+
79+
class SongView(views.APIView):
80+
permission_classes = [IsAuthenticatedOrTokenHasScope, DjangoModelPermission]
81+
required_scopes = ['music']
82+
83+
The `required_scopes` attribute is mandatory.

0 commit comments

Comments
 (0)