Initial commit: add compliance_checks table, per-check metadata on assets, and compliance audit trail
This commit is contained in:
30
app/routes/audit.py
Normal file
30
app/routes/audit.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from flask import Blueprint, render_template, request, current_app
|
||||
from flask_login import login_required
|
||||
from app.models.audit_log import AuditLog
|
||||
|
||||
bp = Blueprint('audit', __name__, url_prefix='/audit')
|
||||
|
||||
|
||||
@bp.route('/')
|
||||
@login_required
|
||||
def index():
|
||||
page = request.args.get('page', 1, type=int)
|
||||
table_filter = request.args.get('table', '')
|
||||
action_filter = request.args.get('action', '')
|
||||
|
||||
query = AuditLog.query
|
||||
if table_filter:
|
||||
query = query.filter_by(table_name=table_filter)
|
||||
if action_filter:
|
||||
query = query.filter_by(action=action_filter)
|
||||
|
||||
pagination = query.order_by(AuditLog.performed_at.desc()).paginate(
|
||||
page=page, per_page=current_app.config['ITEMS_PER_PAGE'], error_out=False
|
||||
)
|
||||
tables = ['users', 'assets', 'assignments', 'paperwork']
|
||||
actions = ['create', 'update', 'delete', 'mask', 'assign', 'return', 'import']
|
||||
return render_template('audit/index.html',
|
||||
pagination=pagination,
|
||||
table_filter=table_filter,
|
||||
action_filter=action_filter,
|
||||
tables=tables, actions=actions)
|
||||
Reference in New Issue
Block a user