| 13 | {{{#!python |
| 14 | # Log read access (i.e. list and read methods) |
| 15 | settings.security.audit_read = True |
| 16 | # Log write access (i.e. create, update and delete methods) |
| 17 | settings.security.audit_write = True |
| 18 | }}} |
| 19 | |
| 20 | Alternatively, these settings can take a callback function with the signature: |
| 21 | |
| 22 | {{{#!python |
| 23 | def audit_callback(method, tablename, form, record, representation): |
| 24 | |
| 25 | return True |
| 26 | }}} |
| 27 | |
| 28 | It takes the following parameters: |
| 29 | |
| 30 | ||=Parameter=||=Explanation=|| |
| 31 | ||'''method'''||The access method (create, list, read, update, delete)|| |
| 32 | ||'''tablename'''||Name of the table accessed|| |
| 33 | ||'''record'''||The record ID (None for multiple records)|| |
| 34 | ||'''representation'''||The representation format of the request|| |
| 35 | |
| 36 | The return value of the callback function (True/False) determines whether the action will be logged or not, thus allowing granular control about which actions are recorded. |