##// END OF EJS Templates
audit-logs: use specific web/api calls....
marcink -
r1806:99a19fa8 default
parent child Browse files
Show More
@@ -1179,11 +1179,10 b' def delete_repo(request, apiuser, repoid'
1179 1179 repo = audit_logger.RepoWrap(repo_id=None,
1180 1180 repo_name=repo.repo_name)
1181 1181
1182 audit_logger.store(
1182 audit_logger.store_api(
1183 1183 action='repo.delete',
1184 action_data={'repo_data': repo_data,
1185 'source': audit_logger.SOURCE_API},
1186 user=apiuser, repo=repo, commit=False)
1184 action_data={'data': repo_data},
1185 user=apiuser, repo=repo)
1187 1186
1188 1187 ScmModel().mark_for_invalidation(repo_name, delete=True)
1189 1188 Session().commit()
@@ -172,7 +172,7 b' class LoginView(BaseAppView):'
172 172 username=self.request.params.get('username'),
173 173 ip_addr=self.request.remote_addr)
174 174 action_data = {'user_agent': self.request.user_agent}
175 audit_logger.store(
175 audit_logger.store_web(
176 176 action='user.login.success', action_data=action_data,
177 177 user=audit_user, commit=True)
178 178
@@ -191,7 +191,7 b' class LoginView(BaseAppView):'
191 191 username=self.request.params.get('username'),
192 192 ip_addr=self.request.remote_addr)
193 193 action_data = {'user_agent': self.request.user_agent}
194 audit_logger.store(
194 audit_logger.store_web(
195 195 action='user.login.failure', action_data=action_data,
196 196 user=audit_user, commit=True)
197 197 return render_ctx
@@ -211,7 +211,7 b' class LoginView(BaseAppView):'
211 211 log.info('Deleting session for user: `%s`', auth_user)
212 212
213 213 action_data = {'user_agent': self.request.user_agent}
214 audit_logger.store(
214 audit_logger.store_web(
215 215 action='user.logout', action_data=action_data,
216 216 user=auth_user, commit=True)
217 217 self.session.delete()
@@ -364,9 +364,10 b' class LoginView(BaseAppView):'
364 364
365 365 action_data = {'email': user_email,
366 366 'user_agent': self.request.user_agent}
367 audit_logger.store(action='user.password.reset_request',
368 action_data=action_data,
369 user=self._rhodecode_user, commit=True)
367 audit_logger.store_web(
368 action='user.password.reset_request',
369 action_data=action_data,
370 user=self._rhodecode_user, commit=True)
370 371 return HTTPFound(self.request.route_path('reset_password'))
371 372
372 373 except formencode.Invalid as errors:
@@ -87,7 +87,7 b' class RepoSettingsPermissionsView(RepoAp'
87 87 'updated': changes['updated'],
88 88 'deleted': changes['deleted'],
89 89 }
90 audit_logger.store(
90 audit_logger.store_web(
91 91 'repo.edit.permissions', action_data=action_data,
92 92 user=self._rhodecode_user, repo=self.db_repo)
93 93
@@ -162,7 +162,7 b' class RepoSettingsView(RepoAppView):'
162 162 RepoModel().update(self.db_repo, **validated_updates)
163 163 ScmModel().mark_for_invalidation(new_repo_name)
164 164
165 audit_logger.store(
165 audit_logger.store_web(
166 166 'repo.edit', action_data={'old_data': old_values},
167 167 user=self._rhodecode_user, repo=self.db_repo)
168 168
@@ -99,11 +99,10 b' class RepoSettingsView(RepoAppView):'
99 99
100 100 repo = audit_logger.RepoWrap(repo_id=None,
101 101 repo_name=self.db_repo.repo_name)
102 audit_logger.store(
102 audit_logger.store_web(
103 103 action='repo.delete',
104 action_data={'repo_data': repo_data,
105 'source': audit_logger.SOURCE_WEB},
106 user=self._rhodecode_user, repo=repo, commit=False)
104 action_data={'data': repo_data},
105 user=self._rhodecode_user, repo=repo)
107 106
108 107 ScmModel().mark_for_invalidation(self.db_repo_name, delete=True)
109 108 h.flash(
@@ -101,7 +101,7 b' class StripView(RepoAppView):'
101 101 commit['rev'], c.repo_info.repo_name, user))
102 102 data[commit['rev']] = True
103 103
104 audit_logger.store(
104 audit_logger.store_web(
105 105 action='repo.commit.strip',
106 106 action_data={'commit_id': commit['rev']},
107 107 repo=self.db_repo,
@@ -189,9 +189,9 b' class RepoGroupsController(BaseControlle'
189 189 repo_group_data = repo_group.get_api_data()
190 190 _new_group_name = form_result['group_name_full']
191 191
192 audit_logger.store(
192 audit_logger.store_web(
193 193 action='repo_group.create',
194 action_data={'repo_group_data': repo_group_data},
194 action_data={'data': repo_group_data},
195 195 user=c.rhodecode_user, commit=True)
196 196
197 197 repo_group_url = h.link_to(
@@ -251,7 +251,7 b' class RepoGroupsController(BaseControlle'
251 251 gr_name = form_result['group_name']
252 252 new_gr = RepoGroupModel().update(group_name, form_result)
253 253
254 audit_logger.store(
254 audit_logger.store_web(
255 255 'repo_group.edit', action_data={'old_data': old_values},
256 256 user=c.rhodecode_user)
257 257
@@ -303,10 +303,9 b' class RepoGroupsController(BaseControlle'
303 303 old_values = gr.get_api_data()
304 304 RepoGroupModel().delete(group_name)
305 305
306 audit_logger.store(
306 audit_logger.store_web(
307 307 'repo_group.delete',
308 action_data={'old_data': old_values,
309 'source': audit_logger.SOURCE_WEB},
308 action_data={'old_data': old_values},
310 309 user=c.rhodecode_user)
311 310
312 311 Session().commit()
@@ -395,9 +394,8 b' class RepoGroupsController(BaseControlle'
395 394 'added': changes['added'],
396 395 'updated': changes['updated'],
397 396 'deleted': changes['deleted'],
398 'source': audit_logger.SOURCE_WEB
399 397 }
400 audit_logger.store(
398 audit_logger.store_web(
401 399 'repo_group.edit.permissions', action_data=action_data,
402 400 user=c.rhodecode_user)
403 401
@@ -814,7 +814,7 b' class FilesController(BaseRepoController'
814 814 archive = cached_archive_path
815 815
816 816 # store download action
817 audit_logger.store(
817 audit_logger.store_web(
818 818 action='repo.archive.download',
819 819 action_data={'user_agent': request.user_agent,
820 820 'archive_name': archive_name,
@@ -149,7 +149,7 b' def store(action, user, action_data=None'
149 149 audit_logger.store(
150 150 action='repo.edit', user=self._rhodecode_user)
151 151 audit_logger.store(
152 action='repo.delete', action_data={'repo_data': repo_data},
152 action='repo.delete', action_data={'data': repo_data},
153 153 user=audit_logger.UserWrap(username='itried-login', ip_addr='8.8.8.8'))
154 154
155 155 # repo action
@@ -179,7 +179,7 b' def create_repo(form_data, cur_user):'
179 179 repo_id = repo.repo_id
180 180 repo_data = repo.get_api_data()
181 181
182 audit_logger.store(
182 audit_logger.store_web(
183 183 action='repo.create',
184 184 action_data={'data': repo_data},
185 185 user=cur_user,
@@ -274,7 +274,7 b' def create_repo_fork(form_data, cur_user'
274 274
275 275 repo_id = repo.repo_id
276 276 repo_data = repo.get_api_data()
277 audit_logger.store(
277 audit_logger.store_web(
278 278 action='repo.fork',
279 279 action_data={'data': repo_data},
280 280 user=cur_user,
General Comments 0
You need to be logged in to leave comments. Login now