Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Check permissions methods expects any model, not a user model only #270

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions django-stubs/contrib/auth/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ class UserManager(BaseUserManager[_T]):
username: str,
email: str | None = ...,
password: str | None = ...,
**extra_fields: Any
**extra_fields: Any,
) -> _T: ...
def create_superuser(
self,
username: str,
email: str | None,
password: str | None,
**extra_fields: Any
**extra_fields: Any,
) -> _T: ...
def with_perm(
self,
Expand All @@ -78,13 +78,11 @@ class PermissionsMixin(models.Model):
is_superuser = models.BooleanField()
groups = models.ManyToManyField[Group, Any](Group)
user_permissions = models.ManyToManyField[Permission, Any](Permission)
def get_user_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def get_all_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
def has_perm(self, perm: str, obj: _AnyUser | None = ...) -> bool: ...
def has_perms(
self, perm_list: Iterable[str], obj: _AnyUser | None = ...
) -> bool: ...
def get_user_permissions(self, obj: Model | None = ...) -> set[str]: ...
def get_group_permissions(self, obj: Model | None = ...) -> set[str]: ...
def get_all_permissions(self, obj: Model | None = ...) -> set[str]: ...
def has_perm(self, perm: str, obj: Model | None = ...) -> bool: ...
def has_perms(self, perm_list: Iterable[str], obj: Model | None = ...) -> bool: ...
def has_module_perms(self, app_label: str) -> bool: ...

class AbstractUser(AbstractBaseUser, PermissionsMixin):
Expand Down
Loading