selfprivacy-rest-api/selfprivacy_api/migrations/add_roundcube_to_userdata.py

25 lines
731 B
Python
Raw Normal View History

2024-06-16 19:48:25 +00:00
from selfprivacy_api.migrations.migration import Migration
from selfprivacy_api.utils import ReadUserData, WriteUserData
2024-06-19 11:20:31 +00:00
class AddRoundcubeToUserdata(Migration):
"""Add Roundcube to userdata.json if it does not exist"""
2024-06-16 19:48:25 +00:00
def get_migration_name(self):
2024-06-19 11:20:31 +00:00
return "add_roundcube_to_userdata"
2024-06-16 19:48:25 +00:00
def get_migration_description(self):
2024-06-19 11:20:31 +00:00
return "Add Roundcube to userdata.json if it does not exist"
2024-06-16 19:48:25 +00:00
def is_migration_needed(self):
with ReadUserData() as data:
if "roundcube" not in data["modules"]:
return True
def migrate(self):
with WriteUserData() as data:
data["modules"]["roundcube"] = {
"subdomain": "roundcube",
}