reviewboard.accounts.backends.standard¶
Standard authentication backend.
-
class
StandardAuthBackend
[source]¶ Bases:
reviewboard.accounts.backends.base.BaseAuthBackend
,django.contrib.auth.backends.ModelBackend
Authenticate users against the local database.
This will authenticate a user against their entry in the database, if the user has a local password stored. This is the default form of authentication in Review Board.
This backend also handles permission checking for users on LocalSites. In Django, this is the responsibility of at least one auth backend in the list of configured backends.
Regardless of the specific type of authentication chosen for the installation, StandardAuthBackend will always be provided in the list of configured backends. Because of this, it will always be able to handle authentication against locally added users and handle LocalSite-based permissions for all configurations.
-
settings_form
[source]¶ alias of
reviewboard.accounts.forms.auth.StandardAuthSettingsForm
-
authenticate
(request, username, password, **kwargs)[source]¶ Authenticate the user.
This will attempt to authenticate the user against the database. If the username and password are valid, a user will be returned.
Changed in version 4.0: The
request
argument is now mandatory as the first positional argument, as per requirements in Django.Parameters: - request (django.http.HttpRequest) – The HTTP request from the caller. This may be
None
. - username (unicode) – The username used for authentication.
- password (unicode) – The password used for authentication.
- **kwargs (dict, unused) – Additional keyword arguments supplied by the caller.
Returns: The authenticated user, or
None
if the user could not be authenticated for any reason.Return type: - request (django.http.HttpRequest) – The HTTP request from the caller. This may be
-
get_or_create_user
(username, request)[source]¶ Get an existing user, or create one if it does not exist.
-
get_all_permissions
(user, obj=None)[source]¶ Get a list of all permissions for a user.
If a LocalSite instance is passed as
obj
, then the permissions returned will be those that the user has on that LocalSite. Otherwise, they will be their global permissions.It is not legal to pass any other object.
-
has_perm
(user, perm, obj=None)[source]¶ Get whether or not a user has the given permission.
If a LocalSite instance is passed as
obj
, then the permissions checked will be those that the user has on that LocalSite. Otherwise, they will be their global permissions.It is not legal to pass any other object.
-