1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #30037 -- Added request arg to RemoteUserBackend.configure_user().

This commit is contained in:
Joshua Cannon
2018-12-13 10:14:03 -06:00
committed by Tim Graham
parent 4ca2820ff5
commit db1b10ef0d
7 changed files with 100 additions and 9 deletions

View File

@@ -29,6 +29,9 @@ details on these changes.
* ``django.contrib.staticfiles.storage.CachedStaticFilesStorage`` will be
removed.
* ``RemoteUserBackend.configure_user()`` will require ``request`` as the first
positional argument.
.. _deprecation-removed-in-3.0:
3.0

View File

@@ -611,13 +611,22 @@ The following backends are available in :mod:`django.contrib.auth.backends`:
information) prior to using it to get or create a user object. Returns
the cleaned username.
.. method:: configure_user(user)
.. method:: configure_user(request, user)
Configures a newly created user. This method is called immediately
after a new user is created, and can be used to perform custom setup
actions, such as setting the user's groups based on attributes in an
LDAP directory. Returns the user object.
``request`` is an :class:`~django.http.HttpRequest` and may be ``None``
if it wasn't provided to :func:`~django.contrib.auth.authenticate`
(which passes it on to the backend).
.. versionchanged:: 2.2
The ``request`` argument was added. Support for method overrides
that don't accept it will be removed in Django 3.1.
.. method:: user_can_authenticate()
Returns whether the user is allowed to authenticate. This method

View File

@@ -55,7 +55,8 @@ Minor features
:mod:`django.contrib.auth`
~~~~~~~~~~~~~~~~~~~~~~~~~~
* ...
* The ``HttpRequest`` is now passed as the first positional argument to
:meth:`.RemoteUserBackend.configure_user`, if it accepts it.
:mod:`django.contrib.contenttypes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -505,3 +506,7 @@ Miscellaneous
* ``django.contrib.staticfiles.storage.CachedStaticFilesStorage`` is
deprecated due to the intractable problems that is has. Use
:class:`.ManifestStaticFilesStorage` or a third-party cloud storage instead.
* :meth:`.RemoteUserBackend.configure_user` is now passed ``request`` as the
first positional argument, if it accepts it. Support for overrides that don't
accept it will be removed in Django 3.1.