##// END OF EJS Templates
audit-logs: implement enum sources that should be re-used.
marcink -
r1798:bf108a7c default
parent child Browse files
Show More
@@ -1181,7 +1181,8 b' def delete_repo(request, apiuser, repoid'
1181
1181
1182 audit_logger.store(
1182 audit_logger.store(
1183 action='repo.delete',
1183 action='repo.delete',
1184 action_data={'repo_data': repo_data, 'source': 'api_call'},
1184 action_data={'repo_data': repo_data,
1185 'source': audit_logger.SOURCE_API},
1185 user=apiuser, repo=repo, commit=False)
1186 user=apiuser, repo=repo, commit=False)
1186
1187
1187 ScmModel().mark_for_invalidation(repo_name, delete=True)
1188 ScmModel().mark_for_invalidation(repo_name, delete=True)
@@ -101,7 +101,8 b' class RepoSettingsView(RepoAppView):'
101 repo_name=self.db_repo.repo_name)
101 repo_name=self.db_repo.repo_name)
102 audit_logger.store(
102 audit_logger.store(
103 action='repo.delete',
103 action='repo.delete',
104 action_data={'repo_data': repo_data, 'source': 'web_action'},
104 action_data={'repo_data': repo_data,
105 'source': audit_logger.SOURCE_WEB},
105 user=self._rhodecode_user, repo=repo, commit=False)
106 user=self._rhodecode_user, repo=repo, commit=False)
106
107
107 ScmModel().mark_for_invalidation(self.db_repo_name, delete=True)
108 ScmModel().mark_for_invalidation(self.db_repo_name, delete=True)
@@ -44,6 +44,9 b' ACTIONS = {'
44 'repo.archive.download': {},
44 'repo.archive.download': {},
45 }
45 }
46
46
47 SOURCE_WEB = 'source_web'
48 SOURCE_API = 'source_api'
49
47
50
48 class UserWrap(object):
51 class UserWrap(object):
49 """
52 """
@@ -114,7 +117,8 b' def store('
114 # repo action, when we know and have the repository object already
117 # repo action, when we know and have the repository object already
115 audit_logger.store(
118 audit_logger.store(
116 action='repo.delete',
119 action='repo.delete',
117 user=audit_logger.UserWrap(username='itried-login', ip_addr='8.8.8.8'),
120 action_data={'source': audit_logger.SOURCE_WEB, },
121 user=self._rhodecode_user,
118 repo=repo_object)
122 repo=repo_object)
119
123
120 # without an user ?
124 # without an user ?
General Comments 0
You need to be logged in to leave comments. Login now