diff --git a/filer/cache.py b/filer/cache.py index 8736449f7..44418388b 100644 --- a/filer/cache.py +++ b/filer/cache.py @@ -1,13 +1,10 @@ import typing -from django.contrib.auth import get_user_model +from django.contrib.auth.models import AbstractBaseUser from django.core.cache import cache -User = get_user_model() - - -def get_folder_perm_cache_key(user: User, permission: str) -> str: +def get_folder_perm_cache_key(user: AbstractBaseUser, permission: str) -> str: """ Generates a unique cache key for a given user and permission. @@ -27,7 +24,7 @@ def get_folder_perm_cache_key(user: User, permission: str) -> str: return f"filer:perm:{permission}" -def get_folder_permission_cache(user: User, permission: str) -> typing.Optional[dict]: +def get_folder_permission_cache(user: AbstractBaseUser, permission: str) -> typing.Optional[dict]: """ Retrieves the cached folder permissions for a given user and permission. @@ -47,7 +44,7 @@ def get_folder_permission_cache(user: User, permission: str) -> typing.Optional[ return None -def clear_folder_permission_cache(user: User, permission: typing.Optional[str] = None) -> None: +def clear_folder_permission_cache(user: AbstractBaseUser, permission: typing.Optional[str] = None) -> None: """ Clears the cached folder permissions for a given user. @@ -65,7 +62,7 @@ def clear_folder_permission_cache(user: User, permission: typing.Optional[str] = cache.delete(get_folder_perm_cache_key(user, permission)) -def update_folder_permission_cache(user: User, permission: str, id_list: typing.List[int]) -> None: +def update_folder_permission_cache(user: AbstractBaseUser, permission: str, id_list: typing.List[int]) -> None: """ Updates the cached folder permissions for a given user and permission.