Skip to content

Commit

Permalink
fixes pylint 2.13.4 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wiwski committed Mar 31, 2022
1 parent c8edc0c commit 3959253
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions lab/admin/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,35 +79,30 @@ def has_delete_permission(
>= self.lab_permissions.delete_permission
)

@staticmethod
def has_module_permission(request: HttpRequest) -> bool:
# pylint: disable=no-self-use
def has_module_permission(self, request: HttpRequest) -> bool:
return request.user.is_staff


class LabAdminAllowedMixin:
"""Gives permission to every action to lab admin and restricts others."""

@staticmethod
# pylint: disable=unused-argument
def has_module_permission(request: HttpRequest) -> bool:
# pylint: disable=unused-argument,no-self-use
def has_module_permission(self, request: HttpRequest) -> bool:
return request.user.is_staff and is_lab_admin(request.user)

@staticmethod
# pylint: disable=unused-argument
def has_view_permission(request: HttpRequest, obj: Optional[T] = None):
# pylint: disable=unused-argument,no-self-use
def has_view_permission(self, request: HttpRequest, obj: Optional[T] = None):
return request.user.is_staff and is_lab_admin(request.user)

@staticmethod
# pylint: disable=unused-argument
def has_add_permission(request: HttpRequest, obj: Optional[T] = None):
# pylint: disable=unused-argument,no-self-use
def has_add_permission(self, request: HttpRequest, obj: Optional[T] = None):
return request.user.is_staff and is_lab_admin(request.user)

@staticmethod
# pylint: disable=unused-argument
def has_change_permission(request: HttpRequest, obj: Optional[T] = None):
# pylint: disable=unused-argument,no-self-use
def has_change_permission(self, request: HttpRequest, obj: Optional[T] = None):
return request.user.is_staff and is_lab_admin(request.user)

@staticmethod
# pylint: disable=unused-argument
def has_delete_permission(request: HttpRequest, obj: Optional[T] = None):
# pylint: disable=unused-argument,no-self-use
def has_delete_permission(self, request: HttpRequest, obj: Optional[T] = None):
return request.user.is_staff and is_lab_admin(request.user)

0 comments on commit 3959253

Please sign in to comment.