Skip to content

Commit 50ad58f

Browse files
committed
feat(models): Add generic source/destination fields for ACL rules
Refactors ACLStandardRule and ACLExtendedRule to support generic source and destination fields. Introduces GenericForeignKey and related caching for improved flexibility and performance. BREAKING CHANGE: Updates source/destination field structures; existing ACL data require migration.
1 parent 1729f95 commit 50ad58f

File tree

2 files changed

+361
-34
lines changed

2 files changed

+361
-34
lines changed

netbox_acls/constants.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,39 @@
11
"""
22
Constants for filters
33
"""
4+
45
from django.db.models import Q
56

7+
#
8+
# AccessList
9+
#
10+
611
ACL_HOST_ASSIGNMENT_MODELS = Q(
712
Q(app_label="dcim", model="device")
813
| Q(app_label="dcim", model="virtualchassis")
914
| Q(app_label="virtualization", model="virtualmachine"),
1015
)
1116

17+
#
18+
# ACLInterfaceAssignment
19+
#
20+
1221
ACL_INTERFACE_ASSIGNMENT_MODELS = Q(
1322
Q(app_label="dcim", model="interface") | Q(app_label="virtualization", model="vminterface"),
1423
)
24+
25+
#
26+
# AccessList Rule
27+
#
28+
29+
ACL_RULE_SOURCE_DESTINATION_MODELS = Q(
30+
Q(
31+
app_label="ipam",
32+
model__in=(
33+
"aggregate",
34+
"ipaddress",
35+
"iprange",
36+
"prefix",
37+
),
38+
)
39+
)

0 commit comments

Comments
 (0)