This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit dc54969a54085e75505b61e5539feaf5e5ddbef4
Author: Dillon Walls <[email protected]>
AuthorDate: Mon Aug 8 19:37:18 2022 +0000

    [#8451] log blog options in audit log
---
 ForgeBlog/forgeblog/main.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index 40d474fef..59fe8e869 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -535,10 +535,20 @@ class BlogAdminController(DefaultAdminController):
     @expose()
     @require_post()
     def set_options(self, show_discussion=False, allow_email_posting=False):
-        self.app.config.options[
-            'show_discussion'] = show_discussion and True or False
-        self.app.config.options[
-            'AllowEmailPosting'] = allow_email_posting and True or False
+        mount_point = self.app.config.options['mount_point']
+
+        if self.app.config.options.get('show_discussion') != 
bool(show_discussion):
+            M.AuditLog.log('{}: set option "{}" {} => {}'.format(
+                mount_point, "show_discussion", 
self.app.config.options.get('show_discussion'),
+                bool(show_discussion)))
+            self.app.config.options['show_discussion'] = bool(show_discussion)
+
+        if self.app.config.options.get('AllowEmailPosting') != 
bool(allow_email_posting):
+            M.AuditLog.log('{}: set option "{}" {} => {}'.format(
+                mount_point, "AllowEmailPosting", 
self.app.config.options.get('AllowEmailPosting'),
+                bool(allow_email_posting)))
+            self.app.config.options['AllowEmailPosting'] = 
bool(allow_email_posting)
+
         flash('Blog options updated')
         redirect(six.ensure_text(request.referer or '/'))
 

Reply via email to