Fixed inconsistent indentation in docs/ref/contrib/auth.txt.

This commit is contained in:
Tobias Bengfort 2018-11-03 16:07:44 +01:00 committed by Tim Graham
parent d207ac1568
commit 9a63d840ff
1 changed files with 30 additions and 29 deletions

View File

@ -549,7 +549,7 @@ The following backends are available in :mod:`django.contrib.auth.backends`:
Returns whether the ``user_obj`` has any permissions on the app Returns whether the ``user_obj`` has any permissions on the app
``app_label``. ``app_label``.
.. method:: ModelBackend.user_can_authenticate() .. method:: user_can_authenticate()
Returns whether the user is allowed to authenticate. To match the Returns whether the user is allowed to authenticate. To match the
behavior of :class:`~django.contrib.auth.forms.AuthenticationForm` behavior of :class:`~django.contrib.auth.forms.AuthenticationForm`
@ -582,45 +582,46 @@ The following backends are available in :mod:`django.contrib.auth.backends`:
If you need more control, you can create your own authentication backend If you need more control, you can create your own authentication backend
that inherits from this class and override these attributes or methods: that inherits from this class and override these attributes or methods:
.. attribute:: RemoteUserBackend.create_unknown_user .. attribute:: create_unknown_user
``True`` or ``False``. Determines whether or not a user object is created ``True`` or ``False``. Determines whether or not a user object is
if not already in the database Defaults to ``True``. created if not already in the database Defaults to ``True``.
.. method:: RemoteUserBackend.authenticate(request, remote_user) .. method:: authenticate(request, remote_user)
The username passed as ``remote_user`` is considered trusted. This method The username passed as ``remote_user`` is considered trusted. This
simply returns the user object with the given username, creating a new method simply returns the user object with the given username, creating
user object if :attr:`~RemoteUserBackend.create_unknown_user` is ``True``. a new user object if :attr:`~RemoteUserBackend.create_unknown_user` is
``True``.
Returns ``None`` if :attr:`~RemoteUserBackend.create_unknown_user` is Returns ``None`` if :attr:`~RemoteUserBackend.create_unknown_user` is
``False`` and a ``User`` object with the given username is not found in the ``False`` and a ``User`` object with the given username is not found in
database. the database.
``request`` is an :class:`~django.http.HttpRequest` and may be ``None`` if ``request`` is an :class:`~django.http.HttpRequest` and may be ``None``
it wasn't provided to :func:`~django.contrib.auth.authenticate` (which if it wasn't provided to :func:`~django.contrib.auth.authenticate`
passes it on to the backend). (which passes it on to the backend).
.. method:: RemoteUserBackend.clean_username(username) .. method:: clean_username(username)
Performs any cleaning on the ``username`` (e.g. stripping LDAP DN Performs any cleaning on the ``username`` (e.g. stripping LDAP DN
information) prior to using it to get or create a user object. Returns the information) prior to using it to get or create a user object. Returns
cleaned username. the cleaned username.
.. method:: RemoteUserBackend.configure_user(user) .. method:: configure_user(user)
Configures a newly created user. This method is called immediately after a Configures a newly created user. This method is called immediately
new user is created, and can be used to perform custom setup actions, such after a new user is created, and can be used to perform custom setup
as setting the user's groups based on attributes in an LDAP directory. actions, such as setting the user's groups based on attributes in an
Returns the user object. LDAP directory. Returns the user object.
.. method:: RemoteUserBackend.user_can_authenticate() .. method:: user_can_authenticate()
Returns whether the user is allowed to authenticate. This method returns Returns whether the user is allowed to authenticate. This method
``False`` for users with :attr:`is_active=False returns ``False`` for users with :attr:`is_active=False
<django.contrib.auth.models.User.is_active>`. Custom user models that don't <django.contrib.auth.models.User.is_active>`. Custom user models that
have an :attr:`~django.contrib.auth.models.CustomUser.is_active` field are don't have an :attr:`~django.contrib.auth.models.CustomUser.is_active`
allowed. field are allowed.
.. class:: AllowAllUsersRemoteUserBackend .. class:: AllowAllUsersRemoteUserBackend