Esempio n. 1
0
 def global_policies(self):
     """Set Global policies"""
     settings = get_policy_setting()
     if settings:
         c.form = PolicySettingsForm(request.POST, settings,
                                     csrf_context=session)
     else:
         c.form = PolicySettingsForm(request.POST, csrf_context=session)
     set_policy_form_opts(c.form)
     if request.method == 'POST' and c.form.validate():
         save_policy_settings(c.form, settings, c.user, request.host,
                     request.remote_addr)
         flash(_("The Global Policy Settings have been saved"))
     return self.render('/settings/policy_settings.html')
Esempio n. 2
0
 def domain_policies(self, domain_id):
     """Set Domain Content protection policies"""
     domain = get_domain(domain_id, c.user)
     if not domain:
         abort(404)
     settings = get_domain_policy_settings(domain_id)
     c.domain_id = domain.id
     c.domain_name = domain.name
     if settings:
         c.form = PolicySettingsForm(request.POST, settings,
                                     csrf_context=session)
     else:
         c.form = PolicySettingsForm(request.POST, csrf_context=session)
     set_policy_form_opts(c.form)
     if request.method == 'POST' and c.form.validate():
         save_domain_policy_settings(c.form, settings, domain_id, c.user,
                     request.host, request.remote_addr)
         flash(_("The Domain Policy Settings have been saved"))
     return self.render('/settings/policy_domain_settings.html')