diff --git a/rhodecode/api/views/repo_api.py b/rhodecode/api/views/repo_api.py --- a/rhodecode/api/views/repo_api.py +++ b/rhodecode/api/views/repo_api.py @@ -1179,11 +1179,10 @@ def delete_repo(request, apiuser, repoid repo = audit_logger.RepoWrap(repo_id=None, repo_name=repo.repo_name) - audit_logger.store( + audit_logger.store_api( action='repo.delete', - action_data={'repo_data': repo_data, - 'source': audit_logger.SOURCE_API}, - user=apiuser, repo=repo, commit=False) + action_data={'data': repo_data}, + user=apiuser, repo=repo) ScmModel().mark_for_invalidation(repo_name, delete=True) Session().commit() diff --git a/rhodecode/apps/login/views.py b/rhodecode/apps/login/views.py --- a/rhodecode/apps/login/views.py +++ b/rhodecode/apps/login/views.py @@ -172,7 +172,7 @@ class LoginView(BaseAppView): username=self.request.params.get('username'), ip_addr=self.request.remote_addr) action_data = {'user_agent': self.request.user_agent} - audit_logger.store( + audit_logger.store_web( action='user.login.success', action_data=action_data, user=audit_user, commit=True) @@ -191,7 +191,7 @@ class LoginView(BaseAppView): username=self.request.params.get('username'), ip_addr=self.request.remote_addr) action_data = {'user_agent': self.request.user_agent} - audit_logger.store( + audit_logger.store_web( action='user.login.failure', action_data=action_data, user=audit_user, commit=True) return render_ctx @@ -211,7 +211,7 @@ class LoginView(BaseAppView): log.info('Deleting session for user: `%s`', auth_user) action_data = {'user_agent': self.request.user_agent} - audit_logger.store( + audit_logger.store_web( action='user.logout', action_data=action_data, user=auth_user, commit=True) self.session.delete() @@ -364,9 +364,10 @@ class LoginView(BaseAppView): action_data = {'email': user_email, 'user_agent': self.request.user_agent} - audit_logger.store(action='user.password.reset_request', - action_data=action_data, - user=self._rhodecode_user, commit=True) + audit_logger.store_web( + action='user.password.reset_request', + action_data=action_data, + user=self._rhodecode_user, commit=True) return HTTPFound(self.request.route_path('reset_password')) except formencode.Invalid as errors: diff --git a/rhodecode/apps/repository/views/repo_permissions.py b/rhodecode/apps/repository/views/repo_permissions.py --- a/rhodecode/apps/repository/views/repo_permissions.py +++ b/rhodecode/apps/repository/views/repo_permissions.py @@ -87,7 +87,7 @@ class RepoSettingsPermissionsView(RepoAp 'updated': changes['updated'], 'deleted': changes['deleted'], } - audit_logger.store( + audit_logger.store_web( 'repo.edit.permissions', action_data=action_data, user=self._rhodecode_user, repo=self.db_repo) diff --git a/rhodecode/apps/repository/views/repo_settings.py b/rhodecode/apps/repository/views/repo_settings.py --- a/rhodecode/apps/repository/views/repo_settings.py +++ b/rhodecode/apps/repository/views/repo_settings.py @@ -162,7 +162,7 @@ class RepoSettingsView(RepoAppView): RepoModel().update(self.db_repo, **validated_updates) ScmModel().mark_for_invalidation(new_repo_name) - audit_logger.store( + audit_logger.store_web( 'repo.edit', action_data={'old_data': old_values}, user=self._rhodecode_user, repo=self.db_repo) diff --git a/rhodecode/apps/repository/views/repo_settings_advanced.py b/rhodecode/apps/repository/views/repo_settings_advanced.py --- a/rhodecode/apps/repository/views/repo_settings_advanced.py +++ b/rhodecode/apps/repository/views/repo_settings_advanced.py @@ -99,11 +99,10 @@ class RepoSettingsView(RepoAppView): repo = audit_logger.RepoWrap(repo_id=None, repo_name=self.db_repo.repo_name) - audit_logger.store( + audit_logger.store_web( action='repo.delete', - action_data={'repo_data': repo_data, - 'source': audit_logger.SOURCE_WEB}, - user=self._rhodecode_user, repo=repo, commit=False) + action_data={'data': repo_data}, + user=self._rhodecode_user, repo=repo) ScmModel().mark_for_invalidation(self.db_repo_name, delete=True) h.flash( diff --git a/rhodecode/apps/repository/views/repo_strip.py b/rhodecode/apps/repository/views/repo_strip.py --- a/rhodecode/apps/repository/views/repo_strip.py +++ b/rhodecode/apps/repository/views/repo_strip.py @@ -101,7 +101,7 @@ class StripView(RepoAppView): commit['rev'], c.repo_info.repo_name, user)) data[commit['rev']] = True - audit_logger.store( + audit_logger.store_web( action='repo.commit.strip', action_data={'commit_id': commit['rev']}, repo=self.db_repo, diff --git a/rhodecode/controllers/admin/repo_groups.py b/rhodecode/controllers/admin/repo_groups.py --- a/rhodecode/controllers/admin/repo_groups.py +++ b/rhodecode/controllers/admin/repo_groups.py @@ -189,9 +189,9 @@ class RepoGroupsController(BaseControlle repo_group_data = repo_group.get_api_data() _new_group_name = form_result['group_name_full'] - audit_logger.store( + audit_logger.store_web( action='repo_group.create', - action_data={'repo_group_data': repo_group_data}, + action_data={'data': repo_group_data}, user=c.rhodecode_user, commit=True) repo_group_url = h.link_to( @@ -251,7 +251,7 @@ class RepoGroupsController(BaseControlle gr_name = form_result['group_name'] new_gr = RepoGroupModel().update(group_name, form_result) - audit_logger.store( + audit_logger.store_web( 'repo_group.edit', action_data={'old_data': old_values}, user=c.rhodecode_user) @@ -303,10 +303,9 @@ class RepoGroupsController(BaseControlle old_values = gr.get_api_data() RepoGroupModel().delete(group_name) - audit_logger.store( + audit_logger.store_web( 'repo_group.delete', - action_data={'old_data': old_values, - 'source': audit_logger.SOURCE_WEB}, + action_data={'old_data': old_values}, user=c.rhodecode_user) Session().commit() @@ -395,9 +394,8 @@ class RepoGroupsController(BaseControlle 'added': changes['added'], 'updated': changes['updated'], 'deleted': changes['deleted'], - 'source': audit_logger.SOURCE_WEB } - audit_logger.store( + audit_logger.store_web( 'repo_group.edit.permissions', action_data=action_data, user=c.rhodecode_user) diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -814,7 +814,7 @@ class FilesController(BaseRepoController archive = cached_archive_path # store download action - audit_logger.store( + audit_logger.store_web( action='repo.archive.download', action_data={'user_agent': request.user_agent, 'archive_name': archive_name, diff --git a/rhodecode/lib/audit_logger.py b/rhodecode/lib/audit_logger.py --- a/rhodecode/lib/audit_logger.py +++ b/rhodecode/lib/audit_logger.py @@ -149,7 +149,7 @@ def store(action, user, action_data=None audit_logger.store( action='repo.edit', user=self._rhodecode_user) audit_logger.store( - action='repo.delete', action_data={'repo_data': repo_data}, + action='repo.delete', action_data={'data': repo_data}, user=audit_logger.UserWrap(username='itried-login', ip_addr='8.8.8.8')) # repo action diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py +++ b/rhodecode/lib/celerylib/tasks.py @@ -179,7 +179,7 @@ def create_repo(form_data, cur_user): repo_id = repo.repo_id repo_data = repo.get_api_data() - audit_logger.store( + audit_logger.store_web( action='repo.create', action_data={'data': repo_data}, user=cur_user, @@ -274,7 +274,7 @@ def create_repo_fork(form_data, cur_user repo_id = repo.repo_id repo_data = repo.get_api_data() - audit_logger.store( + audit_logger.store_web( action='repo.fork', action_data={'data': repo_data}, user=cur_user,