Commit e041bac
feat(authorization): release RBAC tables from dojo state to managed=False shells
Migration 0268_release_rbac_state.py flips the seven RBAC models in dojo's
app state to ``managed=False`` via AlterModelOptions. Pairs with
``pro.0049_adopt_rbac_tables`` (Pro creates the same models in its state
via SeparateDatabaseAndState with state_operations only). Together the two
migrations transfer schema ownership from dojo to pro without running any
DDL — the underlying tables are bit-for-bit unchanged, every existing row
stays in place, and constraints / indexes are not touched.
The model class definitions remain in dojo/authorization/models.py as
managed=False shells with related_name="+" on every FK to a dojo-owned
model (suppresses reverse-accessor name clashes against Pro's now-managed
copies). Track B step DefectDojo#13 simplifies the OS callers that still
isinstance-check or import these classes; at that point the shells are
deleted entirely and OS-only deployments stop carrying their dead weight.
Verified end-to-end:
- ``migrate`` applies pro.0049 → dojo.0268 in correct cross-app order
(run_before on the pro migration enforces it).
- ``select count(*) from dojo_role/dojo_global_role/dojo_product_member``
unchanged after migration; no rows moved or rebuilt.
- Pro queries ``Role.objects.count()`` returns the same row counts via
the new pro app state.
- Reverse accessor ``product.product_member_set.all()`` resolves to
Pro's Product_Member instances (the canonical owner now).
- 442 tests across pro/authorization, pro/api/authorization, api_helpers,
and dashboard/test_views_extended remain green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 84a68d0 commit e041bac
2 files changed
Lines changed: 121 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
1 | 16 | | |
2 | 17 | | |
3 | 18 | | |
| |||
8 | 23 | | |
9 | 24 | | |
10 | 25 | | |
| 26 | + | |
| 27 | + | |
11 | 28 | | |
12 | 29 | | |
13 | 30 | | |
14 | 31 | | |
15 | 32 | | |
16 | 33 | | |
17 | 34 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
21 | 44 | | |
22 | 45 | | |
23 | 46 | | |
| 47 | + | |
| 48 | + | |
24 | 49 | | |
25 | 50 | | |
26 | 51 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
30 | 63 | | |
31 | 64 | | |
32 | 65 | | |
| 66 | + | |
| 67 | + | |
33 | 68 | | |
34 | 69 | | |
35 | 70 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
39 | 74 | | |
40 | 75 | | |
41 | 76 | | |
| 77 | + | |
| 78 | + | |
42 | 79 | | |
43 | 80 | | |
44 | 81 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
48 | 85 | | |
49 | 86 | | |
50 | 87 | | |
| 88 | + | |
| 89 | + | |
51 | 90 | | |
52 | 91 | | |
53 | 92 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
57 | 96 | | |
58 | 97 | | |
59 | 98 | | |
| 99 | + | |
| 100 | + | |
60 | 101 | | |
61 | 102 | | |
62 | 103 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
66 | 107 | | |
67 | 108 | | |
68 | 109 | | |
| 110 | + | |
| 111 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
0 commit comments