# HG changeset patch # User Marcin Kuzminski # Date 2017-06-20 14:06:36 # Node ID 4bb2ace4fa3dda022276eed956f4b9602be8025a # Parent a4cc42be56a88af810c48843586c89215a5f9c5d audit-logs: consistent data between my-account and admin user logs. diff --git a/rhodecode/apps/admin/views/users.py b/rhodecode/apps/admin/views/users.py --- a/rhodecode/apps/admin/views/users.py +++ b/rhodecode/apps/admin/views/users.py @@ -208,7 +208,7 @@ class AdminUsersView(BaseAppView, DataGr token_data = token.get_api_data() self.maybe_attach_token_scope(token) - audit_logger.store( + audit_logger.store_web( action='user.edit.token.add', action_data={'data': {'token': token_data, 'user': user_data}}, user=self._rhodecode_user, ) @@ -238,7 +238,7 @@ class AdminUsersView(BaseAppView, DataGr token_data = token.get_api_data() AuthTokenModel().delete(del_auth_token, c.user.user_id) - audit_logger.store( + audit_logger.store_web( action='user.edit.token.delete', action_data={'data': {'token': token_data, 'user': user_data}}, user=self._rhodecode_user,) @@ -247,11 +247,6 @@ class AdminUsersView(BaseAppView, DataGr return HTTPFound(h.route_path('edit_user_auth_tokens', user_id=user_id)) - - - - - @LoginRequired() @HasPermissionAllDecorator('hg.admin') @view_config( diff --git a/rhodecode/apps/my_account/views.py b/rhodecode/apps/my_account/views.py --- a/rhodecode/apps/my_account/views.py +++ b/rhodecode/apps/my_account/views.py @@ -182,9 +182,9 @@ class MyAccountView(BaseAppView): token_data = token.get_api_data() self.maybe_attach_token_scope(token) - audit_logger.store( + audit_logger.store_web( action='user.edit.token.add', - action_data={'data': {'token': token_data}}, + action_data={'data': {'token': token_data, 'user': 'self'}}, user=self._rhodecode_user, ) Session().commit() @@ -207,9 +207,9 @@ class MyAccountView(BaseAppView): token_data = token.get_api_data() AuthTokenModel().delete(del_auth_token, c.user.user_id) - audit_logger.store( + audit_logger.store_web( action='user.edit.token.delete', - action_data={'data': {'token': token_data}}, + action_data={'data': {'token': token_data, 'user': 'self'}}, user=self._rhodecode_user,) Session().commit() h.flash(_("Auth token successfully deleted"), category='success') @@ -244,9 +244,9 @@ class MyAccountView(BaseAppView): try: UserModel().add_extra_email(c.user.user_id, email) - audit_logger.store( + audit_logger.store_web( action='user.edit.email.add', - action_data={'data': {'email': email}}, + action_data={'data': {'email': email, 'user': 'self'}}, user=self._rhodecode_user,) Session().commit() @@ -274,9 +274,9 @@ class MyAccountView(BaseAppView): if del_email_id: email = UserEmailMap.get_or_404(del_email_id, pyramid_exc=True).email UserModel().delete_extra_email(c.user.user_id, del_email_id) - audit_logger.store( + audit_logger.store_web( action='user.edit.email.delete', - action_data={'data': {'email': email}}, + action_data={'data': {'email': email, 'user': 'self'}}, user=self._rhodecode_user,) Session().commit() h.flash(_("Email successfully deleted"),