Show More
@@ -99,11 +99,30 b' def _store_log(action_name, action_data,' | |||||
99 | return user_log |
|
99 | return user_log | |
100 |
|
100 | |||
101 |
|
101 | |||
|
102 | def store_web(*args, **kwargs): | |||
|
103 | if 'action_data' not in kwargs: | |||
|
104 | kwargs['action_data'] = {} | |||
|
105 | kwargs['action_data'].update({ | |||
|
106 | 'source': SOURCE_WEB | |||
|
107 | }) | |||
|
108 | return store(*args, **kwargs) | |||
|
109 | ||||
|
110 | ||||
|
111 | def store_api(*args, **kwargs): | |||
|
112 | if 'action_data' not in kwargs: | |||
|
113 | kwargs['action_data'] = {} | |||
|
114 | kwargs['action_data'].update({ | |||
|
115 | 'source': SOURCE_API | |||
|
116 | }) | |||
|
117 | return store(*args, **kwargs) | |||
|
118 | ||||
|
119 | ||||
102 | def store( |
|
120 | def store( | |
103 | action, user, action_data=None, user_data=None, ip_addr=None, |
|
121 | action, user, action_data=None, user_data=None, ip_addr=None, | |
104 | repo=None, sa_session=None, commit=False): |
|
122 | repo=None, sa_session=None, commit=False): | |
105 | """ |
|
123 | """ | |
106 |
Audit logger for various actions made by users, typically this |
|
124 | Audit logger for various actions made by users, typically this | |
|
125 | results in a call such:: | |||
107 |
|
126 | |||
108 | from rhodecode.lib import audit_logger |
|
127 | from rhodecode.lib import audit_logger | |
109 |
|
128 | |||
@@ -126,6 +145,13 b' def store(' | |||||
126 | user=self._rhodecode_user, |
|
145 | user=self._rhodecode_user, | |
127 | repo=repo_object) |
|
146 | repo=repo_object) | |
128 |
|
147 | |||
|
148 | # alternative wrapper to the above | |||
|
149 | audit_logger.store_web( | |||
|
150 | action='repo.delete', | |||
|
151 | action_data={}, | |||
|
152 | user=self._rhodecode_user, | |||
|
153 | repo=repo_object) | |||
|
154 | ||||
129 | # without an user ? |
|
155 | # without an user ? | |
130 | audit_logger.store( |
|
156 | audit_logger.store( | |
131 | action='user.login.failure', |
|
157 | action='user.login.failure', |
General Comments 0
You need to be logged in to leave comments.
Login now