Skip to content

Commit

Permalink
auth: remove unused obj parameter from check_global_permission
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Oct 11, 2023
1 parent 785b166 commit f7e515d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion weblate/auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def has_perm(self, perm: str, obj=None):
"""Permission check."""
# Weblate global scope permissions
if perm in GLOBAL_PERM_NAMES:
return check_global_permission(self, perm, obj)
return check_global_permission(self, perm)

# Compatibility API for admin interface
if is_django_permission(perm):
Expand Down
6 changes: 3 additions & 3 deletions weblate/auth/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def wrap_perm(function):
return wrap_perm


def check_global_permission(user, permission, obj):
def check_global_permission(user, permission):
"""Generic permission check for base classes."""
if user.is_superuser:
return True
Expand Down Expand Up @@ -413,7 +413,7 @@ def check_repository_status(user, permission, obj):

@register_perm("meta:team.edit")
def check_team_edit(user, permission, obj):
return check_global_permission(user, "group.edit", obj) or (
return check_global_permission(user, "group.edit") or (
obj.defining_project
and check_permission(user, "project.permissions", obj.defining_project)
)
Expand Down Expand Up @@ -475,7 +475,7 @@ def check_memory_perms(user, permission, memory):
if memory.user_id == user.id:
return True
if memory.project is None:
return check_global_permission(user, "memory.manage", None)
return check_global_permission(user, "memory.manage")
project = memory.project
else:
project = memory
Expand Down

0 comments on commit f7e515d

Please sign in to comment.