summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTobias Bengfort <tobias.bengfort@posteo.de>2019-03-24 00:40:44 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-06-05 13:56:37 +0200
commit581a0f45453f178b8abc0d09bd16ce06309ed33a (patch)
treeb9ac48689168b46346dbb6aabe726f3285f67531 /docs
parent75337a60509fdfdd321a5caf8e30d57fff6b9518 (diff)
Refs #30226 -- Added User.get_user_permissions() method.
Added to mirror the existing User.get_group_permissions().
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/auth.txt17
-rw-r--r--docs/releases/3.0.txt4
-rw-r--r--docs/topics/auth/customizing.txt12
3 files changed, 30 insertions, 3 deletions
diff --git a/docs/ref/contrib/auth.txt b/docs/ref/contrib/auth.txt
index 17197e9fc7..877ec168e5 100644
--- a/docs/ref/contrib/auth.txt
+++ b/docs/ref/contrib/auth.txt
@@ -191,6 +191,15 @@ Methods
:meth:`~django.contrib.auth.models.User.set_unusable_password()` has
been called for this user.
+ .. method:: get_user_permissions(obj=None)
+
+ .. versionadded:: 3.0
+
+ Returns a set of permission strings that the user has directly.
+
+ If ``obj`` is passed in, only returns the user permissions for this
+ specific object.
+
.. method:: get_group_permissions(obj=None)
Returns a set of permission strings that the user has, through their
@@ -467,14 +476,18 @@ The following backends are available in :mod:`django.contrib.auth.backends`:
A base class that provides default implementations for all required
methods. By default, it will reject any user and provide no permissions.
+ .. method:: get_user_permissions(user_obj, obj=None)
+
+ Returns an empty set.
+
.. method:: get_group_permissions(user_obj, obj=None)
Returns an empty set.
.. method:: get_all_permissions(user_obj, obj=None)
- Uses :meth:`get_group_permissions` to get the set of permission strings
- the ``user_obj`` has.
+ Uses :meth:`get_user_permissions` and :meth:`get_group_permissions` to
+ get the set of permission strings the ``user_obj`` has.
.. method:: has_perm(user_obj, perm, obj=None)
diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt
index 43eb07c78c..1ba81c5643 100644
--- a/docs/releases/3.0.txt
+++ b/docs/releases/3.0.txt
@@ -72,6 +72,10 @@ Minor features
* Added :class:`~django.contrib.auth.backends.BaseBackend` class to ease
customization of authentication backends.
+* Added :meth:`~django.contrib.auth.models.User.get_user_permissions()` method
+ to mirror the existing
+ :meth:`~django.contrib.auth.models.User.get_group_permissions()` method.
+
:mod:`django.contrib.contenttypes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt
index becf30e7e6..282eb8ca91 100644
--- a/docs/topics/auth/customizing.txt
+++ b/docs/topics/auth/customizing.txt
@@ -180,7 +180,8 @@ Handling authorization in custom backends
Custom auth backends can provide their own permissions.
The user model will delegate permission lookup functions
-(:meth:`~django.contrib.auth.models.User.get_group_permissions()`,
+(:meth:`~django.contrib.auth.models.User.get_user_permissions()`,
+:meth:`~django.contrib.auth.models.User.get_group_permissions()`,
:meth:`~django.contrib.auth.models.User.get_all_permissions()`,
:meth:`~django.contrib.auth.models.User.has_perm()`, and
:meth:`~django.contrib.auth.models.User.has_module_perms()`) to any
@@ -898,6 +899,15 @@ methods and attributes:
Boolean. Designates that this user has all permissions without
explicitly assigning them.
+ .. method:: models.PermissionsMixin.get_user_permissions(obj=None)
+
+ .. versionadded:: 3.0
+
+ Returns a set of permission strings that the user has directly.
+
+ If ``obj`` is passed in, only returns the user permissions for this
+ specific object.
+
.. method:: models.PermissionsMixin.get_group_permissions(obj=None)
Returns a set of permission strings that the user has, through their