mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Bugfixes
This commit is contained in:
parent
0665b84259
commit
5ac9d7d3a3
3 changed files with 51 additions and 52 deletions
|
@ -180,10 +180,6 @@ domain:
|
|||
help: Domain name to add
|
||||
nargs: '+'
|
||||
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
|
||||
-r:
|
||||
full: --raw
|
||||
help: Auto-configure Apache and LemonLDAP for the domain
|
||||
action: store_true
|
||||
|
||||
### domain_remove()
|
||||
remove:
|
||||
|
@ -204,6 +200,15 @@ domain:
|
|||
help: ""
|
||||
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
|
||||
|
||||
### domain_ssowatconf()
|
||||
ssowatconf:
|
||||
action_help: Regenerate SSOwat configuration file
|
||||
api: PUT /ssowatconf
|
||||
arguments:
|
||||
-r:
|
||||
full: --returns
|
||||
help: Return boolean
|
||||
action: store_true
|
||||
|
||||
#############################
|
||||
# App #
|
||||
|
@ -638,12 +643,3 @@ tools:
|
|||
help: Subscribe domain to a DynDNS service
|
||||
action: store_true
|
||||
|
||||
### tools_ssowatconf()
|
||||
ssowatconf:
|
||||
action_help: Regenerate SSOwat configuration file
|
||||
api: PUT /ssowatconf
|
||||
arguments:
|
||||
-r:
|
||||
full: --returns
|
||||
help: Return boolean
|
||||
action: store_true
|
||||
|
|
|
@ -28,9 +28,9 @@ import sys
|
|||
import datetime
|
||||
import re
|
||||
import shutil
|
||||
import json
|
||||
from urllib import urlopen
|
||||
from yunohost import YunoHostError, YunoHostLDAP, win_msg, colorize, validate, get_required_args
|
||||
from yunohost_tools import tools_ssowatconf
|
||||
|
||||
|
||||
def domain_list(filter=None, limit=None, offset=None):
|
||||
|
@ -198,7 +198,7 @@ def domain_add(domains, main=False):
|
|||
raise YunoHostError(169, _("An error occured during domain creation"))
|
||||
|
||||
|
||||
tools_ssowatconf()
|
||||
domain_ssowatconf()
|
||||
|
||||
win_msg(_("Domain(s) successfully created"))
|
||||
|
||||
|
@ -245,6 +245,46 @@ def domain_remove(domains):
|
|||
else:
|
||||
raise YunoHostError(169, _("An error occured during domain deletion"))
|
||||
|
||||
domain_ssowatconf()
|
||||
|
||||
win_msg(_("Domain(s) successfully deleted"))
|
||||
|
||||
return { 'Domains' : result }
|
||||
|
||||
|
||||
def domain_ssowatconf(returns=False):
|
||||
"""
|
||||
Regenerate SSOwat conf from YunoHost settings
|
||||
|
||||
Keyword argument:
|
||||
Returns
|
||||
"""
|
||||
|
||||
with open('/etc/yunohost/current_host', 'r') as f:
|
||||
main_domain = f.readline().rstrip()
|
||||
|
||||
domains = domain_list()['Domains']
|
||||
|
||||
conf_dict = {
|
||||
'portal_domain': main_domain,
|
||||
'portal_path': '/sso/',
|
||||
'portal_port': '443',
|
||||
'portal_scheme': 'https',
|
||||
'additional_headers': {
|
||||
'Auth-User': 'uid',
|
||||
'Remote-User': 'uid',
|
||||
'Name': 'cn',
|
||||
'Email': 'mail'
|
||||
},
|
||||
'domains': domains,
|
||||
'skipped_urls': [],
|
||||
'unprotected_urls': []
|
||||
}
|
||||
|
||||
with open('/etc/ssowat/conf.json', 'wb') as f:
|
||||
json.dump(conf_dict, f)
|
||||
|
||||
win_msg(_('SSOwat configuration generated'))
|
||||
|
||||
if returns:
|
||||
return True
|
||||
|
|
|
@ -280,40 +280,3 @@ def tools_postinstall(domain, password, dyndns=False):
|
|||
win_msg(_("YunoHost has been successfully configured"))
|
||||
|
||||
|
||||
|
||||
def tools_ssowatconf(returns=False):
|
||||
"""
|
||||
Regenerate SSOwat conf from YunoHost settings
|
||||
|
||||
Keyword argument:
|
||||
Returns
|
||||
"""
|
||||
|
||||
with open('/etc/yunohost/current_host', 'r') as f:
|
||||
main_domain = f.readline().rstrip()
|
||||
|
||||
domains = domain_list()['Domains']
|
||||
|
||||
conf_dict = {
|
||||
'portal_domain': main_domain,
|
||||
'portal_path': '/sso/',
|
||||
'portal_port': '443',
|
||||
'portal_scheme': 'https',
|
||||
'additional_headers': {
|
||||
'Auth-User': 'uid',
|
||||
'Remote-User': 'uid',
|
||||
'Name': 'cn',
|
||||
'Email': 'mail'
|
||||
},
|
||||
'domains': domains,
|
||||
'skipped_urls': [],
|
||||
'unprotected_urls': []
|
||||
}
|
||||
|
||||
with open('/etc/ssowat/conf.json', 'wb') as f:
|
||||
json.dump(conf_dict, f)
|
||||
|
||||
win_msg(_('SSOwat configuration generated'))
|
||||
|
||||
if returns:
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue