You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2017/08/21 20:28:52 UTC

allura git commit: [#8162] always flush the user auditlog right away, more logging

Repository: allura
Updated Branches:
  refs/heads/db/8162 [created] 1919a8211


[#8162] always flush the user auditlog right away, more logging


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/1919a821
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1919a821
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1919a821

Branch: refs/heads/db/8162
Commit: 1919a8211d465082f4bde6cc1c16c521cd6fae0c
Parents: 4f31675
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Aug 21 16:27:23 2017 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Aug 21 16:27:23 2017 -0400

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/1919a821/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 6e71dcb..5dc5623 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -1021,6 +1021,7 @@ class ProjectRegistrationProvider(object):
         solr_del_project_artifacts.post(pid)
         if disable_users:
             # Disable users if necessary BEFORE removing all project-related documents
+            log.info("Disabling users because we're purging project %s", project.url())
             self.disable_project_users(project, reason)
         app_config_ids = [ac._id for ac in AppConfig.query.find(dict(project_id=pid))]
         for m in Mapper.all_mappers():
@@ -1040,13 +1041,18 @@ class ProjectRegistrationProvider(object):
         users = project.admins() + project.users_with_role('Developer')
         for user in users:
             if user.disabled:
+                log.info('User %s is already disabled', user.username)
                 continue
             provider.disable_user(user, audit=False)
             msg = u'Account disabled because project {}{} is deleted. Reason: {}'.format(
                 project.neighborhood.url_prefix,
                 project.shortname,
                 reason)
-            h.auditlog_user(msg, user=user)
+            auditlog = h.auditlog_user(msg, user=user)
+            if auditlog:
+                session(auditlog).flush(auditlog)
+            else:
+                log.error('For some reason no auditlog written in disable_project_users for: %s %s', user, msg)
             # `users` can contain duplicates. Make sure changes are visible
             # to next iterations, so that `user.disabled` check works.
             session(user).expunge(user)