refactor(services): add default implementation to get_enabled

remove-rest
Houkime 2023-10-20 16:14:43 +00:00
parent 708c5cbc98
commit 6f035dc0db
1 changed files with 5 additions and 4 deletions

View File

@ -126,11 +126,12 @@ class Service(ABC):
"""
pass
@staticmethod
@abstractmethod
def is_enabled() -> bool:
@classmethod
def is_enabled(cls) -> bool:
"""`True` if the service is enabled."""
pass
name = cls.get_id()
with ReadUserData() as user_data:
return user_data.get(name, {}).get("enable", False)
@staticmethod
@abstractmethod