flexmeasures.data.models.audit_log

Classes

class flexmeasures.data.models.audit_log.AuditLog(**kwargs)

Model for storing actions that happen to user and tenant accounts E.g user creation, password reset etc.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

classmethod account_table_acl(account: Account)

Table-level access rules for account-affecting audit logs. Use directly in check_access or in @permission_required_for_context with pass_ctx_to_loader, ctx_loader=AuditLog.user_acl. Permissions:

Account-admin users can see audit logs for their account. Admins / admin-readers can see audit logs for all accounts. Consultant users can see the audit log of all client accounts.

query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

classmethod user_table_acl(user: User)

Table-level access rules for user-affecting audit logs. Use directly in check_access or in @permission_required_for_context with pass_ctx_to_loader, ctx_loader=AuditLog.user_acl. Permissions:

User can see his own audit logs. Account-admin users can see audit logs for all users of their account. Admins / admin-readers can see audit logs for all users. Consultant users can see the audit log of all users in the client accounts.