##// END OF EJS Templates
audit-logs: consistent data between my-account and admin user logs.
marcink -
r1822:4bb2ace4 default
parent child Browse files
Show More
@@ -208,7 +208,7 b' class AdminUsersView(BaseAppView, DataGr'
208 token_data = token.get_api_data()
208 token_data = token.get_api_data()
209
209
210 self.maybe_attach_token_scope(token)
210 self.maybe_attach_token_scope(token)
211 audit_logger.store(
211 audit_logger.store_web(
212 action='user.edit.token.add',
212 action='user.edit.token.add',
213 action_data={'data': {'token': token_data, 'user': user_data}},
213 action_data={'data': {'token': token_data, 'user': user_data}},
214 user=self._rhodecode_user, )
214 user=self._rhodecode_user, )
@@ -238,7 +238,7 b' class AdminUsersView(BaseAppView, DataGr'
238 token_data = token.get_api_data()
238 token_data = token.get_api_data()
239
239
240 AuthTokenModel().delete(del_auth_token, c.user.user_id)
240 AuthTokenModel().delete(del_auth_token, c.user.user_id)
241 audit_logger.store(
241 audit_logger.store_web(
242 action='user.edit.token.delete',
242 action='user.edit.token.delete',
243 action_data={'data': {'token': token_data, 'user': user_data}},
243 action_data={'data': {'token': token_data, 'user': user_data}},
244 user=self._rhodecode_user,)
244 user=self._rhodecode_user,)
@@ -247,11 +247,6 b' class AdminUsersView(BaseAppView, DataGr'
247
247
248 return HTTPFound(h.route_path('edit_user_auth_tokens', user_id=user_id))
248 return HTTPFound(h.route_path('edit_user_auth_tokens', user_id=user_id))
249
249
250
251
252
253
254
255 @LoginRequired()
250 @LoginRequired()
256 @HasPermissionAllDecorator('hg.admin')
251 @HasPermissionAllDecorator('hg.admin')
257 @view_config(
252 @view_config(
@@ -182,9 +182,9 b' class MyAccountView(BaseAppView):'
182 token_data = token.get_api_data()
182 token_data = token.get_api_data()
183
183
184 self.maybe_attach_token_scope(token)
184 self.maybe_attach_token_scope(token)
185 audit_logger.store(
185 audit_logger.store_web(
186 action='user.edit.token.add',
186 action='user.edit.token.add',
187 action_data={'data': {'token': token_data}},
187 action_data={'data': {'token': token_data, 'user': 'self'}},
188 user=self._rhodecode_user, )
188 user=self._rhodecode_user, )
189 Session().commit()
189 Session().commit()
190
190
@@ -207,9 +207,9 b' class MyAccountView(BaseAppView):'
207 token_data = token.get_api_data()
207 token_data = token.get_api_data()
208
208
209 AuthTokenModel().delete(del_auth_token, c.user.user_id)
209 AuthTokenModel().delete(del_auth_token, c.user.user_id)
210 audit_logger.store(
210 audit_logger.store_web(
211 action='user.edit.token.delete',
211 action='user.edit.token.delete',
212 action_data={'data': {'token': token_data}},
212 action_data={'data': {'token': token_data, 'user': 'self'}},
213 user=self._rhodecode_user,)
213 user=self._rhodecode_user,)
214 Session().commit()
214 Session().commit()
215 h.flash(_("Auth token successfully deleted"), category='success')
215 h.flash(_("Auth token successfully deleted"), category='success')
@@ -244,9 +244,9 b' class MyAccountView(BaseAppView):'
244
244
245 try:
245 try:
246 UserModel().add_extra_email(c.user.user_id, email)
246 UserModel().add_extra_email(c.user.user_id, email)
247 audit_logger.store(
247 audit_logger.store_web(
248 action='user.edit.email.add',
248 action='user.edit.email.add',
249 action_data={'data': {'email': email}},
249 action_data={'data': {'email': email, 'user': 'self'}},
250 user=self._rhodecode_user,)
250 user=self._rhodecode_user,)
251
251
252 Session().commit()
252 Session().commit()
@@ -274,9 +274,9 b' class MyAccountView(BaseAppView):'
274 if del_email_id:
274 if del_email_id:
275 email = UserEmailMap.get_or_404(del_email_id, pyramid_exc=True).email
275 email = UserEmailMap.get_or_404(del_email_id, pyramid_exc=True).email
276 UserModel().delete_extra_email(c.user.user_id, del_email_id)
276 UserModel().delete_extra_email(c.user.user_id, del_email_id)
277 audit_logger.store(
277 audit_logger.store_web(
278 action='user.edit.email.delete',
278 action='user.edit.email.delete',
279 action_data={'data': {'email': email}},
279 action_data={'data': {'email': email, 'user': 'self'}},
280 user=self._rhodecode_user,)
280 user=self._rhodecode_user,)
281 Session().commit()
281 Session().commit()
282 h.flash(_("Email successfully deleted"),
282 h.flash(_("Email successfully deleted"),
General Comments 0
You need to be logged in to leave comments. Login now