mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] An alias does not have a name, cn, or sn
This commit is contained in:
parent
d1043b261b
commit
2552559464
2 changed files with 6 additions and 21 deletions
|
@ -275,15 +275,6 @@ alias:
|
||||||
extra:
|
extra:
|
||||||
required: True
|
required: True
|
||||||
pattern: *pattern_email
|
pattern: *pattern_email
|
||||||
-n:
|
|
||||||
full: --name
|
|
||||||
extra:
|
|
||||||
ask: ask_alias_name
|
|
||||||
help: A name for the alias
|
|
||||||
required: True
|
|
||||||
pattern: &pattern_name
|
|
||||||
- !!str ^([^\W\d_]{2,30}[ ,.'-]{0,3})+$
|
|
||||||
- "pattern_name"
|
|
||||||
-f:
|
-f:
|
||||||
full: --mailforward
|
full: --mailforward
|
||||||
help: List of email to forward, separated by commas without space
|
help: List of email to forward, separated by commas without space
|
||||||
|
|
|
@ -52,7 +52,6 @@ def alias_list(auth, fields=None, filter=None, limit=None, offset=None):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
alias_attrs = { 'mail': 'alias',
|
alias_attrs = { 'mail': 'alias',
|
||||||
'cn': 'name',
|
|
||||||
'maildrop': 'mail-forward' }
|
'maildrop': 'mail-forward' }
|
||||||
attrs = []
|
attrs = []
|
||||||
result_list = []
|
result_list = []
|
||||||
|
@ -73,7 +72,7 @@ def alias_list(auth, fields=None, filter=None, limit=None, offset=None):
|
||||||
raise MoulinetteError(errno.EINVAL,
|
raise MoulinetteError(errno.EINVAL,
|
||||||
m18n.n('field_invalid', attr))
|
m18n.n('field_invalid', attr))
|
||||||
else:
|
else:
|
||||||
attrs = [ 'mail', 'cn', 'maildrop' ]
|
attrs = [ 'mail', 'maildrop' ]
|
||||||
|
|
||||||
result = auth.search('ou=aliases,dc=yunohost,dc=org', filter, attrs)
|
result = auth.search('ou=aliases,dc=yunohost,dc=org', filter, attrs)
|
||||||
|
|
||||||
|
@ -89,12 +88,11 @@ def alias_list(auth, fields=None, filter=None, limit=None, offset=None):
|
||||||
return { 'alias' : result_list }
|
return { 'alias' : result_list }
|
||||||
|
|
||||||
|
|
||||||
def alias_create(auth, alias, name, mailforward):
|
def alias_create(auth, alias, mailforward):
|
||||||
"""
|
"""
|
||||||
Create alias
|
Create alias
|
||||||
|
|
||||||
Keyword argument:
|
Keyword argument:
|
||||||
name --
|
|
||||||
alias -- Main mail address must be unique
|
alias -- Main mail address must be unique
|
||||||
mailforward -- List of email to forward, separated by commas without space
|
mailforward -- List of email to forward, separated by commas without space
|
||||||
|
|
||||||
|
@ -117,9 +115,6 @@ def alias_create(auth, alias, name, mailforward):
|
||||||
rdn = 'uid=%s,ou=aliases' % alias
|
rdn = 'uid=%s,ou=aliases' % alias
|
||||||
attr_dict = {
|
attr_dict = {
|
||||||
'objectClass' : ['mailAccount', 'inetOrgPerson'],
|
'objectClass' : ['mailAccount', 'inetOrgPerson'],
|
||||||
'sn' : alias,
|
|
||||||
'displayName' : name,
|
|
||||||
'cn' : name,
|
|
||||||
'uid' : alias,
|
'uid' : alias,
|
||||||
'mail' : alias
|
'mail' : alias
|
||||||
}
|
}
|
||||||
|
@ -128,7 +123,7 @@ def alias_create(auth, alias, name, mailforward):
|
||||||
|
|
||||||
if auth.add(rdn, attr_dict):
|
if auth.add(rdn, attr_dict):
|
||||||
msignals.display(m18n.n('alias_created'), 'success')
|
msignals.display(m18n.n('alias_created'), 'success')
|
||||||
return { 'alias' : alias, 'name' : name, 'mailforward' : attr_dict['maildrop'] }
|
return { 'alias' : alias, 'mailforward' : attr_dict['maildrop'] }
|
||||||
|
|
||||||
raise MoulinetteError(169, m18n.n('alias_creation_failed'))
|
raise MoulinetteError(169, m18n.n('alias_creation_failed'))
|
||||||
|
|
||||||
|
@ -159,7 +154,7 @@ def alias_info(auth, alias):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
alias_attrs = [
|
alias_attrs = [
|
||||||
'cn', 'mail', 'uid', 'maildrop', 'givenName', 'sn'
|
'mail', 'uid', 'maildrop'
|
||||||
]
|
]
|
||||||
|
|
||||||
if len(alias.split('@')) is 2:
|
if len(alias.split('@')) is 2:
|
||||||
|
@ -175,8 +170,7 @@ def alias_info(auth, alias):
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n('alias_unknown'))
|
raise MoulinetteError(errno.EINVAL, m18n.n('alias_unknown'))
|
||||||
|
|
||||||
result_dict = {
|
result_dict = {
|
||||||
'alias': alias['mail'][0],
|
'alias': alias['mail'][0]
|
||||||
'name': alias['cn'][0],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(alias['maildrop']) > 1:
|
if len(alias['maildrop']) > 1:
|
||||||
|
|
Loading…
Add table
Reference in a new issue