Skip to content

Commit

Permalink
Merge pull request #24 from stephdl/mailadm
Browse files Browse the repository at this point in the history
choose a mail_domain for roundcubemail
  • Loading branch information
stephdl authored Jun 19, 2023
2 parents 1d45def + 73f6232 commit ff40e91
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ buildah add "${container}" imageroot /imageroot
buildah add "${container}" ui/dist /ui
# Setup the entrypoint, ask to reserve one TCP port with the label and set a rootless container
buildah config --entrypoint=/ \
--label="org.nethserver.authorizations=traefik@node:routeadm" \
--label="org.nethserver.authorizations=traefik@node:routeadm mail@any:mailadm" \
--label="org.nethserver.tcp-ports-demand=1" \
--label="org.nethserver.rootfull=0" \
--label="org.nethserver.images=docker.io/mariadb:10.7.4 docker.io/roundcube/roundcubemail:1.6.0-apache" \
Expand Down
18 changes: 12 additions & 6 deletions imageroot/actions/get-configuration/20read
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,24 @@ config["lets_encrypt"] = os.getenv("TRAEFIK_LETS_ENCRYPT") == "True"
rdb = agent.redis_connect() # full read-only access on every key

config["mail_server"] = os.getenv("MAIL_SERVER", "") # the value is the Mail module UUID!
config["mail_domain"] = os.getenv("MAIL_DOMAIN", "") # the value is the mail domain of user to force domain identity : user@domain.com !
config["plugins"] = os.getenv("ROUNDCUBEMAIL_PLUGINS","").replace('archive,zipdownload,managesieve,markasjunk,','')
config["upload_max_filesize"] = os.getenv("ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE","10").replace('M','')

modules=[]

tmp = []
# we query about all mail server to use it inside the user interface
for key in agent.list_service_providers(rdb,'imap','tcp'):
modules.append({
"name": key['module_id'],
"label": key['mail_hostname'],
"value": key['module_uuid'],
})
mail = key['module_id']
get_retval = agent.tasks.run(f"module/{mail}",'list-domains')
for kd in get_retval['output']:
if kd['addusers']:
obj = {
"name": key['module_id'],
"label": f"{kd['domain']} ({key['mail_hostname']})",
"value": key['module_uuid']+','+kd['domain'],
}
modules.append(obj)

# use it inside a dropdown
config['mail_server_URL'] = modules
Expand Down
4 changes: 2 additions & 2 deletions ui/public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"configuring": "Configuring",
"instance_configuration": "Configure Roundcube",
"placeholder_plugins": "Plugins list (comma separated: plugin1,plugin2,plugin3)",
"choose_mail_server": "Select a mail server as endpoint",
"choose_the_mail_server_to_use": "Roundcube needs to connect to a mail server, select one in the list",
"choose_mail_server": "Select a domain",
"choose_the_mail_server_to_use": "Choose the domain suffix used for both identifying and initializing the user account and their mail address preferences",
"mail_server_is_not_valid": "This mail server cannot be used by Roundcube webmail"
},
"about": {
Expand Down
16 changes: 13 additions & 3 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export default {
isLetsEncryptEnabled: false,
isHttpToHttpsEnabled: true,
mail_server: "",
mail_domain: "",
mail_server_URL: [],
plugins: "",
upload_max_filesize: "5",
Expand Down Expand Up @@ -278,7 +279,13 @@ export default {
this.upload_max_filesize = config.upload_max_filesize;
// force to reload mail_server value after dom update
this.$nextTick(() => {
this.mail_server = config.mail_server;
const mail_server_tmp = config.mail_server;
const mail_domain_tmp = config.mail_domain;
if (mail_server_tmp && mail_domain_tmp) {
this.mail_server = mail_server_tmp + ',' + mail_domain_tmp;
} else {
this.mail_server = "";
}
});

this.mail_server_URL = config.mail_server_URL;
Expand Down Expand Up @@ -352,15 +359,18 @@ export default {
`${taskAction}-completed-${eventId}`,
this.configureModuleCompleted
);

const tmparray = this.mail_server.split(',');
const mail_server_tmp = tmparray[0];
const mail_domain_tmp = tmparray[1];
const res = await to(
this.createModuleTaskForApp(this.instanceName, {
action: taskAction,
data: {
host: this.host,
lets_encrypt: this.isLetsEncryptEnabled,
http2https: this.isHttpToHttpsEnabled,
mail_server: this.mail_server,
mail_server: mail_server_tmp,
mail_domain: mail_domain_tmp,
plugins: this.plugins,
upload_max_filesize: parseInt(this.upload_max_filesize),
},
Expand Down

0 comments on commit ff40e91

Please sign in to comment.