##// END OF EJS Templates
audit-logs: fill in some default values for the expected action data.
marcink -
r1802:eabfaa9c default
parent child Browse files
Show More
@@ -29,15 +29,13 b' log = logging.getLogger(__name__)'
29
29
30 # action as key, and expected action_data as value
30 # action as key, and expected action_data as value
31 ACTIONS = {
31 ACTIONS = {
32 'user.login.success': {},
32 'user.login.success': {'user_agent': ''},
33 'user.login.failure': {},
33 'user.login.failure': {'user_agent': ''},
34 'user.logout': {},
34 'user.logout': {'user_agent': ''},
35 'user.password.reset_request': {},
35 'user.password.reset_request': {},
36 'user.push': {},
36 'user.push': {'user_agent': '', 'commit_ids': []},
37 'user.pull': {},
37 'user.pull': {'user_agent': ''},
38
38
39 'repo.create': {},
40 'repo.edit': {},
41 'user.create': {'data': {}},
39 'user.create': {'data': {}},
42 'user.delete': {'old_data': {}},
40 'user.delete': {'old_data': {}},
43 'user.edit': {'old_data': {}},
41 'user.edit': {'old_data': {}},
@@ -51,15 +49,17 b' ACTIONS = {'
51 'user.edit.password_reset.enabled': {},
49 'user.edit.password_reset.enabled': {},
52 'user.edit.password_reset.disabled': {},
50 'user.edit.password_reset.disabled': {},
53
51
52 'repo.create': {'data': {}},
53 'repo.edit': {'old_data': {}},
54 'repo.edit.permissions': {},
54 'repo.edit.permissions': {},
55 'repo.delete': {},
55 'repo.delete': {'old_data': {}},
56 'repo.commit.strip': {},
56 'repo.commit.strip': {},
57 'repo.archive.download': {},
57 'repo.archive.download': {},
58
58
59 'repo_group.create': {},
59 'repo_group.create': {'data': {}},
60 'repo_group.edit': {},
60 'repo_group.edit': {'old_data': {}},
61 'repo_group.edit.permissions': {},
61 'repo_group.edit.permissions': {},
62 'repo_group.delete': {},
62 'repo_group.delete': {'old_data': {}},
63 }
63 }
64
64
65 SOURCE_WEB = 'source_web'
65 SOURCE_WEB = 'source_web'
@@ -175,8 +175,9 b' def store(action, user, action_data=None'
175 from rhodecode.lib.utils2 import safe_unicode
175 from rhodecode.lib.utils2 import safe_unicode
176 from rhodecode.lib.auth import AuthUser
176 from rhodecode.lib.auth import AuthUser
177
177
178 if action not in ACTIONS:
178 action_spec = ACTIONS.get(action, None)
179 raise ValueError('Action `{}` not in valid actions'.format(action))
179 if action_spec is None:
180 raise ValueError('Action `{}` is not supported'.format(action))
180
181
181 if not sa_session:
182 if not sa_session:
182 sa_session = meta.Session()
183 sa_session = meta.Session()
General Comments 0
You need to be logged in to leave comments. Login now