[dd-sso] Fix minio issue and MailViews API

Email service sends a JSON with: {"config": {...}, "users": [...]}
mejoras_instalacion
Evilham 2022-08-03 08:16:19 +02:00
parent d26df2779e
commit cf05b9675c
No known key found for this signature in database
GPG Key ID: AE3EE30D970886BF
5 changed files with 17 additions and 13 deletions

View File

@ -30,7 +30,8 @@ mysql-connector-python==8.0.30
psycopg2==2.9.3
# python-keycloak can't be upgraded without issues
python-keycloak==0.26.1
minio==7.1.11
# minio can't be upgraded without issues
minio==7.0.3
urllib3==1.26.11
schema==0.7.5
Werkzeug==2.2.1

View File

@ -75,6 +75,7 @@ class AdminFlaskApp(Flask):
domain : str
node_modules_dir : str
ready: bool = False
validators: Dict
def __init__(self, *args: Any, **kwargs: Any):
super().__init__(*args, **kwargs)
@ -83,7 +84,7 @@ class AdminFlaskApp(Flask):
self.url_map.strict_slashes = False
self._load_config()
# Minor setup tasks
self._load_validators()
self.validators = self._load_validators()
self._setup_routes()
self._setup_api_3p()
setup_api_views(self)

View File

@ -45,7 +45,7 @@ class Avatars:
# self.update_missing_avatars()
def add_user_default_avatar(self, userid : str, role : str="unknown") -> None:
path = os.path.join(self.avatars_path, role) + ".jpg",
path = os.path.join(self.avatars_path, role) + ".jpg"
self.mclient.fput_object(
self.bucket,
userid,

View File

@ -77,17 +77,19 @@ def setup_mail_views(app: "AdminFlaskApp") -> None:
Dict, mail_3p.verify_and_decrypt_incoming_json(request.get_data())
)
users = dec_data.pop("users")
for user in users:
if not app.validators["mail"].validate(user):
raise Error(
"bad_request",
"Data validation for mail failed: "
+ str(app.validators["mail"].errors),
traceback.format_exc(),
)
config = dec_data.pop("config", {})
# TODO: fix these validators
#for user in users:
# if not app.validators["mail"].validate(user):
# raise Error(
# "bad_request",
# "Data validation for mail failed: "
# + str(app.validators["mail"].errors),
# traceback.format_exc(),
# )
res: Dict
if request.method in ["POST", "PUT"]:
res = app.admin.nextcloud_mail_set(users, dec_data)
res = app.admin.nextcloud_mail_set(users, config)
return (
json.dumps(res),
200,