mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Enable XMPP features only on "parent domains".
This commit is contained in:
parent
cf3b98b523
commit
22c88dc47e
3 changed files with 13 additions and 4 deletions
|
@ -399,6 +399,10 @@ domain:
|
|||
list:
|
||||
action_help: List domains
|
||||
api: GET /domains
|
||||
arguments:
|
||||
--exclude-subdomains:
|
||||
help: Filter out domains that are obviously subdomains of other declared domains
|
||||
action: store_true
|
||||
|
||||
### domain_add()
|
||||
add:
|
||||
|
|
|
@ -43,7 +43,7 @@ do_post_regen() {
|
|||
|
||||
# retrieve variables
|
||||
main_domain=$(cat /etc/yunohost/current_host)
|
||||
domain_list=$(yunohost domain list --output-as plain --quiet)
|
||||
domain_list=$(yunohost domain list --exclude-subdomains --output-as plain --quiet)
|
||||
|
||||
# create metronome directories for domains
|
||||
for domain in $domain_list; do
|
||||
|
|
|
@ -41,7 +41,7 @@ from yunohost.hook import hook_callback
|
|||
logger = getActionLogger('yunohost.domain')
|
||||
|
||||
|
||||
def domain_list():
|
||||
def domain_list(exclude_subdomains=False):
|
||||
"""
|
||||
List domains
|
||||
|
||||
|
@ -49,16 +49,21 @@ def domain_list():
|
|||
filter -- LDAP filter used to search
|
||||
offset -- Starting number for domain fetching
|
||||
limit -- Maximum number of domain fetched
|
||||
exclude_subdomains -- Filter out domains that are subdomains of other declared domains
|
||||
|
||||
"""
|
||||
from yunohost.utils.ldap import _get_ldap_interface
|
||||
|
||||
ldap = _get_ldap_interface()
|
||||
result = ldap.search('ou=domains,dc=yunohost,dc=org', 'virtualdomain=*', ['virtualdomain'])
|
||||
result = [entry['virtualdomain'][0] for entry in ldap.search('ou=domains,dc=yunohost,dc=org', 'virtualdomain=*', ['virtualdomain'])]
|
||||
|
||||
result_list = []
|
||||
for domain in result:
|
||||
result_list.append(domain['virtualdomain'][0])
|
||||
if exclude_subdomains:
|
||||
parent_domain = domain.split(".", 1)[1]
|
||||
if parent_domain in result:
|
||||
continue
|
||||
result_list.append(domain)
|
||||
|
||||
return {'domains': result_list}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue