simple-module-audit-log 0.0.43__tar.gz → 0.0.45__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/PKG-INFO +5 -4
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/README.md +1 -0
- simple_module_audit_log-0.0.45/audit_log/core/__init__.py +4 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/core}/services.py +1 -1
- simple_module_audit_log-0.0.45/audit_log/entries/__init__.py +5 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/entries}/activity.py +2 -2
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/entries}/export.py +3 -3
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/entries}/filters.py +1 -1
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/entries}/service.py +2 -2
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/models.py +1 -1
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/module.py +7 -7
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/pages/Browse.tsx +4 -4
- simple_module_audit_log-0.0.45/audit_log/web/__init__.py +1 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/web}/deps.py +1 -1
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/web}/endpoints/api.py +5 -5
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/web}/endpoints/views.py +4 -4
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/package.json +1 -1
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/pyproject.toml +5 -5
- simple_module_audit_log-0.0.43/tests/_entity_label_support.py → simple_module_audit_log-0.0.45/tests/_audit_log_support.py +1 -1
- simple_module_audit_log-0.0.45/tests/conftest.py +4 -0
- simple_module_audit_log-0.0.43/tests/test_tenancy.py → simple_module_audit_log-0.0.45/tests/core/capture/test_audit_log_tenancy.py +2 -2
- {simple_module_audit_log-0.0.43/tests → simple_module_audit_log-0.0.45/tests/entries/activity}/test_audit_log_activity_feed.py +1 -1
- simple_module_audit_log-0.0.43/tests/test_export_csv.py → simple_module_audit_log-0.0.45/tests/entries/export/test_audit_log_export_csv.py +2 -2
- simple_module_audit_log-0.0.43/tests/test_export_csv_injection.py → simple_module_audit_log-0.0.45/tests/entries/export/test_audit_log_export_csv_injection.py +3 -3
- simple_module_audit_log-0.0.43/tests/test_actor_filter_by_name.py → simple_module_audit_log-0.0.45/tests/entries/filters/test_audit_log_actor_filter_by_name.py +4 -4
- simple_module_audit_log-0.0.43/tests/test_audit_correlation_filter.py → simple_module_audit_log-0.0.45/tests/entries/filters/test_audit_log_correlation_filter.py +2 -2
- simple_module_audit_log-0.0.43/tests/test_date_range_filter.py → simple_module_audit_log-0.0.45/tests/entries/filters/test_audit_log_date_range_filter.py +2 -2
- simple_module_audit_log-0.0.43/tests/test_entity_label_batching.py → simple_module_audit_log-0.0.45/tests/entries/resolve/test_audit_log_entity_label_batching.py +1 -1
- simple_module_audit_log-0.0.43/tests/test_entity_label_permission.py → simple_module_audit_log-0.0.45/tests/entries/resolve/test_audit_log_entity_label_permission.py +6 -6
- simple_module_audit_log-0.0.43/tests/test_entity_labels.py → simple_module_audit_log-0.0.45/tests/entries/resolve/test_audit_log_entity_labels.py +3 -3
- {simple_module_audit_log-0.0.43/tests → simple_module_audit_log-0.0.45/tests/entries/resolve}/test_audit_log_resolve.py +2 -2
- simple_module_audit_log-0.0.43/tests/test_distinct_entity_types.py → simple_module_audit_log-0.0.45/tests/entries/service/test_audit_log_distinct_entity_types.py +5 -5
- simple_module_audit_log-0.0.43/tests/test_entry_batches.py → simple_module_audit_log-0.0.45/tests/entries/service/test_audit_log_entry_batches.py +3 -3
- {simple_module_audit_log-0.0.43/tests → simple_module_audit_log-0.0.45/tests/web/endpoints}/test_audit_log_api_filter_parity.py +1 -1
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/tests-js/BrowseEmpty.test.tsx +1 -1
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/tests-js/ChangesList.test.tsx +1 -1
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/tests-js/format.test.ts +1 -1
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/.gitignore +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/LICENSE +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/__init__.py +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/contracts/__init__.py +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/contracts/schemas.py +0 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/core}/capture.py +0 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/core}/constants.py +0 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/core}/settings.py +0 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/entries}/resolve.py +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/locales/de.json +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/locales/en.json +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/py.typed +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/BrowseEmpty.tsx +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/ChangesList.tsx +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/Correlation.tsx +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/DateRangeField.tsx +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/EntriesTable.tsx +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/EntryCells.tsx +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/FilterBar.tsx +0 -0
- {simple_module_audit_log-0.0.43/audit_log/pages → simple_module_audit_log-0.0.45/audit_log/ui}/components/format.ts +0 -0
- {simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/web}/endpoints/__init__.py +0 -0
- {simple_module_audit_log-0.0.43/tests → simple_module_audit_log-0.0.45/tests/core/capture}/test_audit_log_bulk_capture.py +0 -0
- /simple_module_audit_log-0.0.43/tests/test_audit_api_pagination_bounds.py → /simple_module_audit_log-0.0.45/tests/web/endpoints/test_audit_log_api_pagination_bounds.py +0 -0
- /simple_module_audit_log-0.0.43/tests/test_huge_page.py → /simple_module_audit_log-0.0.45/tests/web/endpoints/test_audit_log_huge_page.py +0 -0
- /simple_module_audit_log-0.0.43/tests/test_audit_link_keys_match_audit_trail.py → /simple_module_audit_log-0.0.45/tests/web/endpoints/test_audit_log_link_keys_match_audit_trail.py +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/tests-js/audit_log_Browse.test.tsx +0 -0
- {simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/tsconfig.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: simple_module_audit_log
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.45
|
|
4
4
|
Summary: Automatic field-level audit trail for all SQLModel entities
|
|
5
5
|
Project-URL: Homepage, https://github.com/antosubash/simple_module_python
|
|
6
6
|
Project-URL: Repository, https://github.com/antosubash/simple_module_python
|
|
@@ -21,9 +21,9 @@ Classifier: Topic :: Internet :: WWW/HTTP
|
|
|
21
21
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
22
22
|
Classifier: Typing :: Typed
|
|
23
23
|
Requires-Python: >=3.12
|
|
24
|
-
Requires-Dist: simple-module-core==0.0.
|
|
25
|
-
Requires-Dist: simple-module-db==0.0.
|
|
26
|
-
Requires-Dist: simple-module-hosting==0.0.
|
|
24
|
+
Requires-Dist: simple-module-core==0.0.45
|
|
25
|
+
Requires-Dist: simple-module-db==0.0.45
|
|
26
|
+
Requires-Dist: simple-module-hosting==0.0.45
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
28
28
|
|
|
29
29
|
# simple_module_audit_log
|
|
@@ -45,6 +45,7 @@ Add `simple_module_audit_log` to your host's dependencies and the entry point wi
|
|
|
45
45
|
- `GET /api/audit_log/` REST endpoint with `entity_type`, `entity_id`, `action`, `user_id`, `from_date`, `to_date`, paging filters.
|
|
46
46
|
- `/audit_log` Inertia browse page with the same filter set rendered as a table, gated by the `audit_log.view` permission.
|
|
47
47
|
- Opt-outs: set `__audit_exclude__ = True` on a model to skip it entirely, or `__audit_exclude_fields__ = {"password_hash"}` to skip specific columns. `AuditMixin` / `SoftDeleteMixin` bookkeeping fields are excluded automatically.
|
|
48
|
+
- Credential redaction: set `__audit_redact_fields__` (or a `__audit_redact_row__` predicate) to keep a field in the diff with its values replaced by `[redacted]`; see the [audit_log docs](https://github.com/antosubash/simple_module_python/blob/main/docs/modules/audit_log.md) for details.
|
|
48
49
|
|
|
49
50
|
## Usage
|
|
50
51
|
|
|
@@ -17,6 +17,7 @@ Add `simple_module_audit_log` to your host's dependencies and the entry point wi
|
|
|
17
17
|
- `GET /api/audit_log/` REST endpoint with `entity_type`, `entity_id`, `action`, `user_id`, `from_date`, `to_date`, paging filters.
|
|
18
18
|
- `/audit_log` Inertia browse page with the same filter set rendered as a table, gated by the `audit_log.view` permission.
|
|
19
19
|
- Opt-outs: set `__audit_exclude__ = True` on a model to skip it entirely, or `__audit_exclude_fields__ = {"password_hash"}` to skip specific columns. `AuditMixin` / `SoftDeleteMixin` bookkeeping fields are excluded automatically.
|
|
20
|
+
- Credential redaction: set `__audit_redact_fields__` (or a `__audit_redact_row__` predicate) to keep a field in the diff with its values replaced by `[redacted]`; see the [audit_log docs](https://github.com/antosubash/simple_module_python/blob/main/docs/modules/audit_log.md) for details.
|
|
20
21
|
|
|
21
22
|
## Usage
|
|
22
23
|
|
|
@@ -13,8 +13,8 @@ from typing import Any
|
|
|
13
13
|
|
|
14
14
|
from simple_module_core.activity_feed import ActivityItem
|
|
15
15
|
|
|
16
|
-
from audit_log.resolve import resolve_entity_labels
|
|
17
|
-
from audit_log.service import AuditLogService
|
|
16
|
+
from audit_log.entries.resolve import resolve_entity_labels
|
|
17
|
+
from audit_log.entries.service import AuditLogService
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class AuditActivityFeed:
|
|
@@ -23,9 +23,9 @@ from simple_module_core.user_directory import UserDirectory
|
|
|
23
23
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
24
24
|
|
|
25
25
|
from audit_log.contracts.schemas import AuditEntryRead
|
|
26
|
-
from audit_log.filters import EntryFilters
|
|
27
|
-
from audit_log.resolve import resolve_actors, resolve_entity_labels
|
|
28
|
-
from audit_log.service import AuditLogService
|
|
26
|
+
from audit_log.entries.filters import EntryFilters
|
|
27
|
+
from audit_log.entries.resolve import resolve_actors, resolve_entity_labels
|
|
28
|
+
from audit_log.entries.service import AuditLogService
|
|
29
29
|
|
|
30
30
|
CSV_COLUMNS = (
|
|
31
31
|
"time",
|
|
@@ -13,7 +13,7 @@ from dataclasses import dataclass
|
|
|
13
13
|
from datetime import datetime, time
|
|
14
14
|
from typing import Any
|
|
15
15
|
|
|
16
|
-
from audit_log.constants import PLATFORM_TENANT_FILTER
|
|
16
|
+
from audit_log.core.constants import PLATFORM_TENANT_FILTER
|
|
17
17
|
from audit_log.models import AuditEntry
|
|
18
18
|
|
|
19
19
|
|
|
@@ -10,9 +10,9 @@ from sqlalchemy import Select, and_, func, literal_column, or_, select
|
|
|
10
10
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
11
11
|
from sqlmodel import col
|
|
12
12
|
|
|
13
|
-
from audit_log.constants import DEFAULT_PAGE_SIZE, MAX_PAGE, MAX_PAGE_SIZE
|
|
14
13
|
from audit_log.contracts.schemas import AuditEntryList, AuditEntryRead
|
|
15
|
-
from audit_log.
|
|
14
|
+
from audit_log.core.constants import DEFAULT_PAGE_SIZE, MAX_PAGE, MAX_PAGE_SIZE
|
|
15
|
+
from audit_log.entries.filters import EntryFilters
|
|
16
16
|
from audit_log.models import AuditEntry
|
|
17
17
|
|
|
18
18
|
_ENTITY_TYPE_CTE = "distinct_entity_type"
|
|
@@ -10,7 +10,7 @@ from simple_module_db.types import AwareDateTime
|
|
|
10
10
|
from sqlalchemy import JSON, Index, func
|
|
11
11
|
from sqlmodel import Column, Field
|
|
12
12
|
|
|
13
|
-
from audit_log.constants import (
|
|
13
|
+
from audit_log.core.constants import (
|
|
14
14
|
ACTION_MAX_LENGTH,
|
|
15
15
|
CORRELATION_ID_MAX_LENGTH,
|
|
16
16
|
ENTITY_ID_MAX_LENGTH,
|
|
@@ -11,7 +11,7 @@ from simple_module_core.module import ModuleBase, ModuleMeta
|
|
|
11
11
|
from simple_module_core.module_settings import register_module_settings
|
|
12
12
|
from simple_module_core.permissions import PermissionRegistry
|
|
13
13
|
|
|
14
|
-
from audit_log.constants import (
|
|
14
|
+
from audit_log.core.constants import (
|
|
15
15
|
ALL_PERMISSIONS,
|
|
16
16
|
API_PREFIX,
|
|
17
17
|
LOCALE_NAMESPACE,
|
|
@@ -36,16 +36,16 @@ class AuditLogModule(ModuleBase):
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
def register_settings(self, app: FastAPI) -> None:
|
|
39
|
-
from audit_log.services import AuditLogServices
|
|
40
|
-
from audit_log.settings import AuditLogSettings
|
|
39
|
+
from audit_log.core.services import AuditLogServices
|
|
40
|
+
from audit_log.core.settings import AuditLogSettings
|
|
41
41
|
|
|
42
42
|
register_module_settings(
|
|
43
43
|
app, MODULE_PACKAGE, AuditLogSettings, lambda s: AuditLogServices(settings=s)
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
def register_routes(self, api_router: APIRouter, view_router: APIRouter) -> None:
|
|
47
|
-
from audit_log.endpoints.api import router as api
|
|
48
|
-
from audit_log.endpoints.views import router as views
|
|
47
|
+
from audit_log.web.endpoints.api import router as api
|
|
48
|
+
from audit_log.web.endpoints.views import router as views
|
|
49
49
|
|
|
50
50
|
api_router.include_router(api)
|
|
51
51
|
view_router.include_router(views)
|
|
@@ -77,8 +77,8 @@ class AuditLogModule(ModuleBase):
|
|
|
77
77
|
async def on_startup(self, app: FastAPI) -> None:
|
|
78
78
|
from simple_module_core.activity_feed import set_activity_feed
|
|
79
79
|
|
|
80
|
-
from audit_log.
|
|
81
|
-
from audit_log.
|
|
80
|
+
from audit_log.core.capture import audit_callback
|
|
81
|
+
from audit_log.entries.activity import AuditActivityFeed
|
|
82
82
|
|
|
83
83
|
db = app.state.sm.db
|
|
84
84
|
db.audit_callback = audit_callback
|
{simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/pages/Browse.tsx
RENAMED
|
@@ -7,16 +7,16 @@ import { Card } from '@simple-module-py/ui/components/ui/card';
|
|
|
7
7
|
import { AdminLayout } from '@simple-module-py/ui/layouts/AdminLayout';
|
|
8
8
|
import { Download } from 'lucide-react';
|
|
9
9
|
import { useState } from 'react';
|
|
10
|
-
import { BrowseEmpty } from '
|
|
11
|
-
import { CorrelationBanner } from '
|
|
12
|
-
import { type AuditEntryRead, EntriesTable } from '
|
|
10
|
+
import { BrowseEmpty } from '../ui/components/BrowseEmpty';
|
|
11
|
+
import { CorrelationBanner } from '../ui/components/Correlation';
|
|
12
|
+
import { type AuditEntryRead, EntriesTable } from '../ui/components/EntriesTable';
|
|
13
13
|
import {
|
|
14
14
|
ALL,
|
|
15
15
|
type AppliedFilters,
|
|
16
16
|
type EntityTypeOption,
|
|
17
17
|
FilterBar,
|
|
18
18
|
type FilterState,
|
|
19
|
-
} from '
|
|
19
|
+
} from '../ui/components/FilterBar';
|
|
20
20
|
|
|
21
21
|
interface Props {
|
|
22
22
|
items: AuditEntryRead[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""The HTTP side: request deps and the REST and Inertia endpoints."""
|
{simple_module_audit_log-0.0.43/audit_log → simple_module_audit_log-0.0.45/audit_log/web}/deps.py
RENAMED
|
@@ -8,7 +8,7 @@ from fastapi import Depends
|
|
|
8
8
|
from simple_module_db.deps import get_db
|
|
9
9
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
10
10
|
|
|
11
|
-
from audit_log.service import AuditLogService
|
|
11
|
+
from audit_log.entries.service import AuditLogService
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
async def get_audit_log_service(
|
|
@@ -12,12 +12,12 @@ from simple_module_db.pagination import MAX_PAGE, MAX_PER_PAGE
|
|
|
12
12
|
from simple_module_hosting.permissions import RequiresPermission, resolved_permissions_for
|
|
13
13
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
14
14
|
|
|
15
|
-
from audit_log.constants import DEFAULT_PAGE_SIZE, PERM_VIEW
|
|
16
15
|
from audit_log.contracts.schemas import AuditEntryList
|
|
17
|
-
from audit_log.
|
|
18
|
-
from audit_log.export import CSV_FILENAME, CSV_MEDIA_TYPE, stream_csv
|
|
19
|
-
from audit_log.filters import EntryFilters
|
|
20
|
-
from audit_log.resolve import actor_filter
|
|
16
|
+
from audit_log.core.constants import DEFAULT_PAGE_SIZE, PERM_VIEW
|
|
17
|
+
from audit_log.entries.export import CSV_FILENAME, CSV_MEDIA_TYPE, stream_csv
|
|
18
|
+
from audit_log.entries.filters import EntryFilters
|
|
19
|
+
from audit_log.entries.resolve import actor_filter
|
|
20
|
+
from audit_log.web.deps import AuditLogServiceDep
|
|
21
21
|
|
|
22
22
|
router = APIRouter()
|
|
23
23
|
|
|
@@ -15,22 +15,22 @@ from simple_module_hosting.permissions import RequiresPermission, resolved_permi
|
|
|
15
15
|
from simple_module_inertia import InertiaResponse
|
|
16
16
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
17
17
|
|
|
18
|
-
from audit_log.constants import (
|
|
18
|
+
from audit_log.core.constants import (
|
|
19
19
|
API_PREFIX,
|
|
20
20
|
DEFAULT_PAGE_SIZE,
|
|
21
21
|
PAGE_BROWSE,
|
|
22
22
|
PERM_VIEW,
|
|
23
23
|
PLATFORM_TENANT_FILTER,
|
|
24
24
|
)
|
|
25
|
-
from audit_log.
|
|
26
|
-
from audit_log.
|
|
27
|
-
from audit_log.resolve import (
|
|
25
|
+
from audit_log.entries.filters import EntryFilters
|
|
26
|
+
from audit_log.entries.resolve import (
|
|
28
27
|
actor_filter,
|
|
29
28
|
actor_link,
|
|
30
29
|
entity_link,
|
|
31
30
|
resolve_actors,
|
|
32
31
|
resolve_entity_labels,
|
|
33
32
|
)
|
|
33
|
+
from audit_log.web.deps import AuditLogServiceDep
|
|
34
34
|
|
|
35
35
|
router = APIRouter()
|
|
36
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "simple_module_audit_log"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.45"
|
|
4
4
|
description = "Automatic field-level audit trail for all SQLModel entities"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -21,9 +21,9 @@ classifiers = [
|
|
|
21
21
|
"Typing :: Typed",
|
|
22
22
|
]
|
|
23
23
|
dependencies = [
|
|
24
|
-
"simple_module_core==0.0.
|
|
25
|
-
"simple_module_db==0.0.
|
|
26
|
-
"simple_module_hosting==0.0.
|
|
24
|
+
"simple_module_core==0.0.45",
|
|
25
|
+
"simple_module_db==0.0.45",
|
|
26
|
+
"simple_module_hosting==0.0.45",
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
[project.entry-points.simple_module]
|
|
@@ -32,7 +32,7 @@ audit_log = "audit_log.module:AuditLogModule"
|
|
|
32
32
|
# Read by processes that never build the app (the Celery worker), so their
|
|
33
33
|
# writes are audited too (#498). See ``simple_module_db.audit_sinks``.
|
|
34
34
|
[project.entry-points."simple_module.audit_sinks"]
|
|
35
|
-
audit_log = "audit_log.capture:audit_callback"
|
|
35
|
+
audit_log = "audit_log.core.capture:audit_callback"
|
|
36
36
|
|
|
37
37
|
[project.urls]
|
|
38
38
|
Homepage = "https://github.com/antosubash/simple_module_python"
|
|
@@ -8,7 +8,7 @@ back, find its entity cell".
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import httpx
|
|
11
|
-
from audit_log.constants import ACTION_UPDATED
|
|
11
|
+
from audit_log.core.constants import ACTION_UPDATED
|
|
12
12
|
from audit_log.models import AuditEntry
|
|
13
13
|
|
|
14
14
|
VIEW_URL = "/admin/audit-log/"
|
|
@@ -10,8 +10,8 @@ import csv
|
|
|
10
10
|
import io
|
|
11
11
|
|
|
12
12
|
import pytest
|
|
13
|
-
from audit_log.capture import audit_callback
|
|
14
|
-
from audit_log.constants import PLATFORM_TENANT_FILTER
|
|
13
|
+
from audit_log.core.capture import audit_callback
|
|
14
|
+
from audit_log.core.constants import PLATFORM_TENANT_FILTER
|
|
15
15
|
from audit_log.models import AuditEntry
|
|
16
16
|
from simple_module_core.tenancy import TenantRole
|
|
17
17
|
from simple_module_db import all_tenants, tenant_context
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import uuid
|
|
6
6
|
from types import SimpleNamespace
|
|
7
7
|
|
|
8
|
-
from audit_log.activity import AuditActivityFeed
|
|
8
|
+
from audit_log.entries.activity import AuditActivityFeed
|
|
9
9
|
from audit_log.models import AuditEntry
|
|
10
10
|
from simple_module_core.activity_feed import get_activity_feed
|
|
11
11
|
from simple_module_core.audit_links import AuditLink, AuditLinkRegistry
|
|
@@ -15,7 +15,7 @@ import uuid
|
|
|
15
15
|
from datetime import UTC, datetime
|
|
16
16
|
|
|
17
17
|
import httpx
|
|
18
|
-
from audit_log.constants import ACTION_CREATED, ACTION_DELETED, ACTION_UPDATED
|
|
18
|
+
from audit_log.core.constants import ACTION_CREATED, ACTION_DELETED, ACTION_UPDATED
|
|
19
19
|
from audit_log.models import AuditEntry
|
|
20
20
|
from simple_module_test import forge_session_cookie
|
|
21
21
|
from users.models import User
|
|
@@ -264,7 +264,7 @@ class TestExportPermission:
|
|
|
264
264
|
"""Signed in is not the same as allowed to read the audit trail. The
|
|
265
265
|
export is a second door onto the same rows as the browse screen, and a
|
|
266
266
|
guard on one of the two doors is not a guard."""
|
|
267
|
-
from users.bootstrap import create_standard_user
|
|
267
|
+
from users.core.bootstrap import create_standard_user
|
|
268
268
|
|
|
269
269
|
async with app.state.sm.db.session_factory() as session:
|
|
270
270
|
result = await create_standard_user(
|
|
@@ -11,7 +11,7 @@ import csv
|
|
|
11
11
|
import io
|
|
12
12
|
|
|
13
13
|
import httpx
|
|
14
|
-
from audit_log.constants import ACTION_UPDATED
|
|
14
|
+
from audit_log.core.constants import ACTION_UPDATED
|
|
15
15
|
from audit_log.models import AuditEntry
|
|
16
16
|
from users.models import User
|
|
17
17
|
|
|
@@ -68,13 +68,13 @@ class TestFormulaInjection:
|
|
|
68
68
|
assert row["actor"] == f"'{payload}"
|
|
69
69
|
|
|
70
70
|
def test_every_dangerous_lead_character_is_prefixed(self) -> None:
|
|
71
|
-
from audit_log.export import escape_formula
|
|
71
|
+
from audit_log.entries.export import escape_formula
|
|
72
72
|
|
|
73
73
|
for lead in ("=", "+", "-", "@", "\t", "\r"):
|
|
74
74
|
assert escape_formula(f"{lead}cmd") == f"'{lead}cmd"
|
|
75
75
|
|
|
76
76
|
def test_ordinary_text_is_untouched(self) -> None:
|
|
77
|
-
from audit_log.export import escape_formula
|
|
77
|
+
from audit_log.entries.export import escape_formula
|
|
78
78
|
|
|
79
79
|
assert escape_formula("Dana Rivera") == "Dana Rivera"
|
|
80
80
|
assert escape_formula("") == ""
|
|
@@ -13,7 +13,7 @@ from __future__ import annotations
|
|
|
13
13
|
import uuid
|
|
14
14
|
|
|
15
15
|
import httpx
|
|
16
|
-
from audit_log.constants import ACTION_UPDATED
|
|
16
|
+
from audit_log.core.constants import ACTION_UPDATED
|
|
17
17
|
from audit_log.models import AuditEntry
|
|
18
18
|
from users.models import User
|
|
19
19
|
|
|
@@ -153,8 +153,8 @@ class TestActorSearchIsNotTruncated:
|
|
|
153
153
|
"""Pins the mechanism, not just today's row count: an implementation
|
|
154
154
|
that materialises ids passes the count test right up until the install
|
|
155
155
|
is big enough to break it."""
|
|
156
|
-
from audit_log.resolve import actor_filter
|
|
157
|
-
from users.directory import UsersDirectory
|
|
156
|
+
from audit_log.entries.resolve import actor_filter
|
|
157
|
+
from users.core.directory import UsersDirectory
|
|
158
158
|
|
|
159
159
|
rendered = str(actor_filter(UsersDirectory(), "okafor"))
|
|
160
160
|
|
|
@@ -164,7 +164,7 @@ class TestActorSearchIsNotTruncated:
|
|
|
164
164
|
async def test_without_a_directory_the_term_is_an_exact_actor_id(self) -> None:
|
|
165
165
|
"""No directory can say who is called that, so the box falls back to
|
|
166
166
|
an id match (a worker name) instead of silently matching nobody."""
|
|
167
|
-
from audit_log.resolve import actor_filter
|
|
167
|
+
from audit_log.entries.resolve import actor_filter
|
|
168
168
|
from simple_module_core.user_directory import NullUserDirectory
|
|
169
169
|
|
|
170
170
|
rendered = str(actor_filter(NullUserDirectory(), "celery-worker-1"))
|
|
@@ -8,9 +8,9 @@ unrelated events. These tests pin the filter that reassembles them.
|
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
|
-
from audit_log.constants import ACTION_CREATED, ACTION_UPDATED
|
|
11
|
+
from audit_log.core.constants import ACTION_CREATED, ACTION_UPDATED
|
|
12
|
+
from audit_log.entries.service import AuditLogService
|
|
12
13
|
from audit_log.models import AuditEntry
|
|
13
|
-
from audit_log.service import AuditLogService
|
|
14
14
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
15
15
|
|
|
16
16
|
_REQUEST = "corr-aaa"
|
|
@@ -12,8 +12,8 @@ from __future__ import annotations
|
|
|
12
12
|
from datetime import UTC, datetime
|
|
13
13
|
|
|
14
14
|
import httpx
|
|
15
|
-
from audit_log.constants import ACTION_UPDATED
|
|
16
|
-
from audit_log.filters import EntryFilters
|
|
15
|
+
from audit_log.core.constants import ACTION_UPDATED
|
|
16
|
+
from audit_log.entries.filters import EntryFilters
|
|
17
17
|
from audit_log.models import AuditEntry
|
|
18
18
|
|
|
19
19
|
VIEW_URL = "/admin/audit-log/"
|
|
@@ -7,8 +7,8 @@ export — down with it.
|
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
|
+
from audit_log.entries.resolve import resolve_entity_labels
|
|
10
11
|
from audit_log.models import AuditEntry
|
|
11
|
-
from audit_log.resolve import resolve_entity_labels
|
|
12
12
|
from simple_module_core.audit_links import AuditLink, AuditLinkRegistry
|
|
13
13
|
from sqlalchemy import select
|
|
14
14
|
from sqlalchemy.exc import DBAPIError
|
|
@@ -23,16 +23,16 @@ from collections.abc import AsyncIterator
|
|
|
23
23
|
|
|
24
24
|
import httpx
|
|
25
25
|
import pytest
|
|
26
|
-
from
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from audit_log.constants import PERM_VIEW
|
|
30
|
-
from audit_log.resolve import resolve_entity_labels
|
|
26
|
+
from _audit_log_support import browse as _browse
|
|
27
|
+
from _audit_log_support import entity_of as _entity
|
|
28
|
+
from _audit_log_support import seed_entry as _seed_entry
|
|
29
|
+
from audit_log.core.constants import PERM_VIEW
|
|
30
|
+
from audit_log.entries.resolve import resolve_entity_labels
|
|
31
31
|
from simple_module_core.audit_links import AuditLink, AuditLinkRegistry
|
|
32
32
|
from simple_module_db.stored_settings import Setting
|
|
33
33
|
from simple_module_test import forge_session_cookie, inertia_headers
|
|
34
34
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
35
|
-
from users.constants import PERM_USERS_MANAGE
|
|
35
|
+
from users.core.constants import PERM_USERS_MANAGE
|
|
36
36
|
from users.models import User
|
|
37
37
|
|
|
38
38
|
EXPORT_URL = "/api/audit_log/export.csv"
|
|
@@ -13,9 +13,9 @@ from __future__ import annotations
|
|
|
13
13
|
import uuid
|
|
14
14
|
|
|
15
15
|
import httpx
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
16
|
+
from _audit_log_support import browse as _browse
|
|
17
|
+
from _audit_log_support import entity_of as _entity
|
|
18
|
+
from _audit_log_support import seed_entry as _seed_entry
|
|
19
19
|
from background_tasks.models import TaskExecution
|
|
20
20
|
from feature_flags.models import FeatureFlagOverride
|
|
21
21
|
from simple_module_db.stored_settings import Setting
|
|
@@ -8,11 +8,11 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
import uuid
|
|
10
10
|
|
|
11
|
-
from audit_log.resolve import actor_link, entity_link, resolve_actors
|
|
11
|
+
from audit_log.entries.resolve import actor_link, entity_link, resolve_actors
|
|
12
12
|
from simple_module_core.audit_links import AuditLink, AuditLinkRegistry
|
|
13
13
|
from simple_module_core.user_directory import NullUserDirectory
|
|
14
14
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
15
|
-
from users.directory import UsersDirectory
|
|
15
|
+
from users.core.directory import UsersDirectory
|
|
16
16
|
from users.models import User
|
|
17
17
|
|
|
18
18
|
_DIRECTORY = UsersDirectory()
|
|
@@ -14,9 +14,9 @@ cover the fallback directly and the Postgres branch through
|
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
16
|
import pytest
|
|
17
|
-
from audit_log.constants import ACTION_CREATED
|
|
17
|
+
from audit_log.core.constants import ACTION_CREATED
|
|
18
|
+
from audit_log.entries.service import AuditLogService
|
|
18
19
|
from audit_log.models import AuditEntry
|
|
19
|
-
from audit_log.service import AuditLogService
|
|
20
20
|
from simple_module_db.provider import DatabaseProvider
|
|
21
21
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
22
22
|
|
|
@@ -60,13 +60,13 @@ class TestDialectSelection:
|
|
|
60
60
|
"""The Postgres branch is chosen by dialect, not by accident."""
|
|
61
61
|
|
|
62
62
|
def test_postgres_uses_the_recursive_skip_scan(self) -> None:
|
|
63
|
-
from audit_log.service import _distinct_stmt_for_dialect
|
|
63
|
+
from audit_log.entries.service import _distinct_stmt_for_dialect
|
|
64
64
|
|
|
65
65
|
sql = str(_distinct_stmt_for_dialect(DatabaseProvider.POSTGRESQL))
|
|
66
66
|
assert "RECURSIVE" in sql.upper()
|
|
67
67
|
|
|
68
68
|
def test_sqlite_uses_plain_distinct(self) -> None:
|
|
69
|
-
from audit_log.service import _distinct_stmt_for_dialect
|
|
69
|
+
from audit_log.entries.service import _distinct_stmt_for_dialect
|
|
70
70
|
|
|
71
71
|
sql = str(_distinct_stmt_for_dialect(DatabaseProvider.SQLITE))
|
|
72
72
|
assert "RECURSIVE" not in sql.upper()
|
|
@@ -74,6 +74,6 @@ class TestDialectSelection:
|
|
|
74
74
|
|
|
75
75
|
@pytest.mark.parametrize("dialect", ["sqlite", "postgresql"])
|
|
76
76
|
def test_both_dialects_produce_usable_sql(self, dialect: str) -> None:
|
|
77
|
-
from audit_log.service import _distinct_stmt_for_dialect
|
|
77
|
+
from audit_log.entries.service import _distinct_stmt_for_dialect
|
|
78
78
|
|
|
79
79
|
assert str(_distinct_stmt_for_dialect(DatabaseProvider(dialect))).strip()
|
|
@@ -11,10 +11,10 @@ from __future__ import annotations
|
|
|
11
11
|
|
|
12
12
|
from datetime import UTC, datetime
|
|
13
13
|
|
|
14
|
-
from audit_log.constants import ACTION_UPDATED
|
|
15
|
-
from audit_log.filters import EntryFilters
|
|
14
|
+
from audit_log.core.constants import ACTION_UPDATED
|
|
15
|
+
from audit_log.entries.filters import EntryFilters
|
|
16
|
+
from audit_log.entries.service import AuditLogService
|
|
16
17
|
from audit_log.models import AuditEntry
|
|
17
|
-
from audit_log.service import AuditLogService
|
|
18
18
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
19
19
|
|
|
20
20
|
_ENTITY_TYPE = "Widget"
|
{simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/tests-js/ChangesList.test.tsx
RENAMED
|
@@ -14,7 +14,7 @@ configureI18n({
|
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
import { type Change, ChangesList } from '../audit_log/
|
|
17
|
+
import { type Change, ChangesList } from '../audit_log/ui/components/ChangesList';
|
|
18
18
|
|
|
19
19
|
const FOUR: Change[] = [
|
|
20
20
|
{ field: 'value', old: '', new: 'mail.example.com' },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/contracts/__init__.py
RENAMED
|
File without changes
|
{simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/audit_log/contracts/schemas.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_audit_log-0.0.43 → simple_module_audit_log-0.0.45}/tests-js/audit_log_Browse.test.tsx
RENAMED
|
File without changes
|
|
File without changes
|