mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 17:26:46 +00:00
refactor(services): add default implementation to get_enabled
This commit is contained in:
parent
708c5cbc98
commit
6f035dc0db
|
@ -126,11 +126,12 @@ class Service(ABC):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
@abstractmethod
|
def is_enabled(cls) -> bool:
|
||||||
def is_enabled() -> bool:
|
|
||||||
"""`True` if the service is enabled."""
|
"""`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
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|
Loading…
Reference in a new issue