
- Added AuditUserMiddleware to track the current user for auditing purposes. - Introduced audit_context for managing the current user in thread-local storage. - Updated Control and Incident models to include created_at and updated_at timestamps. - Refactored Control and Incident serializers to handle related risks and timestamps. - Modified views to set the _changed_by attribute for user actions. - Enhanced incident listing and detail views to display related risks and user actions. - Updated templates for better presentation of risks and incidents. - Added migrations for new fields and relationships in the database. - Improved filtering options in the incident list view.
28 lines
1 KiB
Python
28 lines
1 KiB
Python
from api.views import ping, secure_ping
|
|
from django.conf import settings
|
|
from django.contrib import admin
|
|
from django.urls import path, include
|
|
from django.shortcuts import render, redirect
|
|
from rest_framework import routers
|
|
from risks.views import RiskViewSet, ControlViewSet, ResidualRiskViewSet, UserViewSet, AuditViewSet
|
|
|
|
router = routers.DefaultRouter()
|
|
router.register(r"risks", RiskViewSet)
|
|
router.register(r"controls", ControlViewSet)
|
|
router.register(r"residual-risks", ResidualRiskViewSet)
|
|
router.register(r"users", UserViewSet)
|
|
router.register(r"logs", AuditViewSet)
|
|
|
|
urlpatterns = [
|
|
path("admin/", admin.site.urls),
|
|
path("api/ping/", ping), # Public healthcheck endpoint
|
|
path("api/secure-ping/", secure_ping), # Protected API endpoint
|
|
path("api/", include(router.urls)),
|
|
path("", include("risks.urls", namespace="risks")),
|
|
]
|
|
|
|
# Add OIDC routes only if Single Sign-On is enabled
|
|
if settings.SSO_ENABLED:
|
|
urlpatterns += [
|
|
path("oidc/", include("mozilla_django_oidc.urls")),
|
|
]
|