adhocracy_core.auditing package

Log which user modifies resources in additional ‘audit’ database.

class AuditLog[source]

Bases: BTrees.OOBTree.OOBTree

An Auditlog composed of audit entries.

This is a dictionary (collections.abc.Mapping) with key datetime.datetime and value adhocracy_core.interfaces.SerializedActivity.

The methods items, keys, and values have the additional kwargs max_key and min_key to allow range queries:

january = datetime(2015, 1, 1)
february = datetime(2015, 2, 1)
audit = get_auditlog(context)
audit.items(min=january, max=february)
...
add(activity: adhocracy_core.interfaces.Activity) → None[source]

Serialize activity and store in audit log.

get_auditlog(context: <InterfaceClass adhocracy_core.interfaces.IResource>) → adhocracy_core.auditing.AuditLog[source]

Return the auditlog.

set_auditlog(context: <InterfaceClass adhocracy_core.interfaces.IResource>) → None[source]

Set an auditlog for the context.

add_to_auditlog(activities: [<class 'adhocracy_core.interfaces.Activity'>], request: pyramid.request.Request) → None[source]

Add activities to the audit database.

The audit database is created if missing. If the zodbconn.uri.audit value is not specified in the config, auditing does not happen.