Skip to content

Commit

Permalink
BaseBackend.get_user: Relax user_id param type (#2121)
Browse files Browse the repository at this point in the history
In theory, this pk could be anything, given that `AUTH_USER_MODEL` can resolved
to any custom model (often a `AbstractBaseUser` subclass.)

See also:
- https://docs.djangoproject.com/en/5.0/topics/auth/customizing/#substituting-a-custom-user-model
- https://github.com/django/django/blob/5.0.4/django/contrib/auth/backends.py
  • Loading branch information
tony authored May 3, 2024
1 parent 50fdc5a commit 9b6c3b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django-stubs/contrib/auth/backends.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ UserModel: Any

class BaseBackend:
def authenticate(self, request: HttpRequest | None, **kwargs: Any) -> AbstractBaseUser | None: ...
def get_user(self, user_id: int) -> AbstractBaseUser | None: ...
def get_user(self, user_id: Any) -> AbstractBaseUser | None: ...
def get_user_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
def get_group_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
def get_all_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
Expand Down

0 comments on commit 9b6c3b3

Please sign in to comment.