Merge pull request #9 in KSC/webapp-tools from ~MALBERTS/webapp-tools-martijn:state_settings to master

* commit '0634ec9ef49d733275a02bebbdda90abe85fadf0':
  Add option to remove state settings
This commit is contained in:
Robin van Genderen 2019-03-18 14:01:39 +01:00
commit 3026d1ce87

View File

@ -80,6 +80,7 @@ def opt_args(print_help=None):
group.add_option("--free-busy", dest="freebusy", action="store", help="Change free/busy time span in months")
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("--remove-state", dest="remove_state", action="store_true", help="Remove all the state settings")
parser.add_option_group(group)
# Advanced option group
@ -534,7 +535,7 @@ def main():
sys.exit(1)
setting = 'settings.zarafa.v1.main.active_iconset = {}'.format(options.icons)
advanced_inject(user, setting)
print('icon set changed to {}'.format(options.icons))
print('Icon set changed to {}'.format(options.icons))
# Editor
if options.htmleditor:
@ -546,6 +547,13 @@ def main():
advanced_inject(user, setting)
print('Editor changed to {}'.format(options.htmleditor))
# State settings
if options.remove_state:
settings = read_settings(user)
settings['settings']['zarafa']['v1']['state'] = {}
write_settings(user, json.dumps(settings))
print('Removed state settings for {}'.format(user.name))
# Always at last!!!
if options.reset:
reset_settings(user)