-
-
Notifications
You must be signed in to change notification settings - Fork 299
Add possibility to allow/disallow main email, email alias and email forward form portal #1997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
fb3cc9e
33e8780
6eaa7ed
0f1df76
d56a63f
eafff0a
f9d5077
10d7272
d2407dd
abd4f8f
7c05246
cd0df8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,12 +21,14 @@ | |
import os | ||
import subprocess | ||
from logging import getLogger | ||
from pathlib import Path | ||
from typing import TYPE_CHECKING, Any, Union, Callable | ||
|
||
from moulinette import m18n | ||
|
||
from moulinette.utils.filesystem import write_to_json | ||
from yunohost.firewall import firewall_reload | ||
from yunohost.log import is_unit_operation | ||
from yunohost.portal import PORTAL_SETTINGS_DIR | ||
from yunohost.regenconf import regen_conf | ||
from yunohost.utils.configpanel import ConfigPanel, parse_filter_key | ||
from yunohost.utils.error import YunohostError, YunohostValidationError | ||
|
@@ -249,6 +251,17 @@ def _apply( | |
{"sudoOption": "!authenticate" if passwordless_sudo else set()}, | ||
) | ||
|
||
global_portal_settings_path = Path(f"{PORTAL_SETTINGS_DIR}/global_settings.json") | ||
portal_allow_edit_email = form.get("portal_allow_edit_email", self.get("security.portal.portal_allow_edit_email")) | ||
portal_allow_edit_email_alias = form.get("portal_allow_edit_email_alias", self.get("security.portal.portal_allow_edit_email_alias")) | ||
portal_allow_edit_email_forward = form.get("portal_allow_edit_email_forward", self.get("security.portal.portal_allow_edit_email_forward")) | ||
write_to_json( | ||
str(global_portal_settings_path), {"allow_edit_email": portal_allow_edit_email, | ||
"allow_edit_email_alias": portal_allow_edit_email_alias, | ||
"allow_edit_email_forward":portal_allow_edit_email_forward | ||
}, sort_keys=True, indent=4 | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should already managed by ConfigPanel. It doesn't work without ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue currently is that we store 2 config at different places. One global setting which is not accessible by the portal API and an other one more specific to the portal api which is accessible by the portal api (and which is specific to the domain). The issue currently is that to me this setting is expected to be global it don't really make sens to be different between 2 domain as it's also a security thing. So I added this parameters in the global setting. But this can't be read by the config panel. So it's why I added one global config for the portal API (sychromized from the global setting) so the portal api can read the config. |
||
|
||
# First save settings except virtual + default ones | ||
super()._apply(form, config, previous_settings, exclude=self.virtual_settings) | ||
next_settings = { | ||
|
Uh oh!
There was an error while loading. Please reload this page.