mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-06 21:50:55 +00:00
refactor: remove blank lines after docstring (#5736)
There shouldn't be any blank lines after the function docstring. Remove the blank lines to fix this issue. Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
@ -18,7 +18,6 @@ class UsersConfig(AppConfig):
|
||||
|
||||
def ready(self):
|
||||
"""Called when the 'users' app is loaded at runtime"""
|
||||
|
||||
# skip loading if plugin registry is not loaded or we run in a background thread
|
||||
if not isPluginRegistryLoaded() or not isInMainThread():
|
||||
return
|
||||
|
@ -259,7 +259,6 @@ class RuleSet(models.Model):
|
||||
@classmethod
|
||||
def check_table_permission(cls, user, table, permission):
|
||||
"""Check if the provided user has the specified permission against the table."""
|
||||
|
||||
# Superuser knows no bounds
|
||||
if user.is_superuser:
|
||||
return True
|
||||
@ -531,7 +530,6 @@ def clear_user_role_cache(user):
|
||||
Args:
|
||||
user: The User object to be expunged from the cache
|
||||
"""
|
||||
|
||||
for role in RuleSet.RULESET_MODELS.keys():
|
||||
for perm in ['add', 'change', 'view', 'delete']:
|
||||
key = f"role_{user}_{role}_{perm}"
|
||||
@ -540,7 +538,6 @@ def clear_user_role_cache(user):
|
||||
|
||||
def get_user_roles(user):
|
||||
"""Return all roles available to a given user"""
|
||||
|
||||
roles = set()
|
||||
|
||||
for group in user.groups.all():
|
||||
@ -738,7 +735,6 @@ class Owner(models.Model):
|
||||
|
||||
def is_user_allowed(self, user, include_group: bool = False):
|
||||
"""Check if user is allowed to access something owned by this owner."""
|
||||
|
||||
user_owner = Owner.get_owner(user)
|
||||
return user_owner in self.get_related_owners(include_group=include_group)
|
||||
|
||||
@ -761,7 +757,6 @@ def delete_owner(sender, instance, **kwargs):
|
||||
@receiver(post_save, sender=get_user_model(), dispatch_uid='clear_user_cache')
|
||||
def clear_user_cache(sender, instance, **kwargs):
|
||||
"""Callback function when a user object is saved"""
|
||||
|
||||
clear_user_role_cache(instance)
|
||||
|
||||
|
||||
|
@ -11,7 +11,6 @@ class UserAPITests(InvenTreeAPITestCase):
|
||||
|
||||
def test_user_api(self):
|
||||
"""Tests for User API endpoints"""
|
||||
|
||||
response = self.get(
|
||||
reverse('api-user-list'),
|
||||
expected_code=200
|
||||
@ -36,7 +35,6 @@ class UserAPITests(InvenTreeAPITestCase):
|
||||
|
||||
def test_group_api(self):
|
||||
"""Tests for the Group API endpoints"""
|
||||
|
||||
response = self.get(
|
||||
reverse('api-group-list'),
|
||||
expected_code=200,
|
||||
|
Reference in New Issue
Block a user