Option to add user to safesenders
This commit is contained in:
parent
b835ddde91
commit
e49df89f29
@ -81,6 +81,7 @@ def opt_args(print_help=None):
|
|||||||
group.add_option("--icons", dest="icons", action="store", help="Change icons (e.g. breeze)")
|
group.add_option("--icons", dest="icons", action="store", help="Change icons (e.g. breeze)")
|
||||||
group.add_option("--htmleditor", dest="htmleditor", action="store", help="Change the HTML editor (e.g. full_tinymce)")
|
group.add_option("--htmleditor", dest="htmleditor", action="store", help="Change the HTML editor (e.g. full_tinymce)")
|
||||||
group.add_option("--remove-state", dest="remove_state", action="store_true", help="Remove all the state settings")
|
group.add_option("--remove-state", dest="remove_state", action="store_true", help="Remove all the state settings")
|
||||||
|
group.add_option("--add-safesender", dest="addsender", action="store", help="Add domain to safe sender list")
|
||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
|
|
||||||
# Advanced option group
|
# Advanced option group
|
||||||
@ -448,11 +449,14 @@ Inject webapp settings into the users store
|
|||||||
:param user: The user
|
:param user: The user
|
||||||
:param data: The webapp setting
|
:param data: The webapp setting
|
||||||
"""
|
"""
|
||||||
def advanced_inject(user, data):
|
def advanced_inject(user, data, value_type='string'):
|
||||||
settings = read_settings(user)
|
settings = read_settings(user)
|
||||||
split_data = data.split('=')
|
split_data = data.split('=')
|
||||||
|
|
||||||
value = split_data[1].lstrip().rstrip()
|
value = split_data[1].lstrip().rstrip()
|
||||||
|
if value_type == 'list':
|
||||||
|
value = value.split(',')
|
||||||
|
|
||||||
dot = dotty()
|
dot = dotty()
|
||||||
dot[split_data[0].rstrip()] = value
|
dot[split_data[0].rstrip()] = value
|
||||||
|
|
||||||
@ -554,6 +558,13 @@ def main():
|
|||||||
write_settings(user, json.dumps(settings))
|
write_settings(user, json.dumps(settings))
|
||||||
print('Removed state settings for {}'.format(user.name))
|
print('Removed state settings for {}'.format(user.name))
|
||||||
|
|
||||||
|
# Add sender to safe sender list
|
||||||
|
if options.addsender:
|
||||||
|
settings = read_settings(user)
|
||||||
|
setting = 'settings.zarafa.v1.contexts.mail.safe_senders_list = {}'.format(options.addsender)
|
||||||
|
advanced_inject(user, setting, 'list')
|
||||||
|
print('{}'.format(options.addsender), 'Added to safe sender list')
|
||||||
|
|
||||||
# Always at last!!!
|
# Always at last!!!
|
||||||
if options.reset:
|
if options.reset:
|
||||||
reset_settings(user)
|
reset_settings(user)
|
||||||
|
Loading…
Reference in New Issue
Block a user