##// END OF EJS Templates
users: fetch user data for user removal hook, *before* actually marking object for deletion.
marcink -
r3979:a1866b8a default
parent child Browse files
Show More
@@ -507,6 +507,8 b' class UserModel(BaseModel):'
507 507
508 508 def delete(self, user, cur_user=None, handle_repos=None,
509 509 handle_repo_groups=None, handle_user_groups=None):
510 from rhodecode.lib.hooks_base import log_delete_user
511
510 512 if not cur_user:
511 513 cur_user = getattr(
512 514 get_current_rhodecode_user(), 'username', None)
@@ -547,12 +549,14 b' class UserModel(BaseModel):'
547 549 u'removed. Switch owners or remove those user groups:%s'
548 550 % (user.username, len(user_groups), ', '.join(user_groups)))
549 551
552 user_data = user.get_dict() # fetch user data before expire
553
550 554 # we might change the user data with detach/delete, make sure
551 555 # the object is marked as expired before actually deleting !
552 556 self.sa.expire(user)
553 557 self.sa.delete(user)
554 from rhodecode.lib.hooks_base import log_delete_user
555 log_delete_user(deleted_by=cur_user, **user.get_dict())
558
559 log_delete_user(deleted_by=cur_user, **user_data)
556 560 except Exception:
557 561 log.error(traceback.format_exc())
558 562 raise
General Comments 0
You need to be logged in to leave comments. Login now