-
Notifications
You must be signed in to change notification settings - Fork 33
Closes #129 - Add Source and Destination Assigned Object Support #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pheus
wants to merge
18
commits into
netbox-community:dev
Choose a base branch
from
pheus:129-add-source-and-destination-assigned-object-support
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Closes #129 - Add Source and Destination Assigned Object Support #275
pheus
wants to merge
18
commits into
netbox-community:dev
from
pheus:129-add-source-and-destination-assigned-object-support
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Renames and updates fields in ACLStandardRule and ACLExtendedRule to support generic source and destination objects. Introduces new fields, indices, and foreign key relationships for improved flexibility and query performance. BREAKING CHANGE: Requires migration of existing ACL data to the new field structure.
Introduces a data migration to copy source and destination prefix IDs to the newly added GenericForeignKey fields in ACLStandardRule and ACLExtendedRule. Ensures existing prefix assignments are preserved during schema updates.
Extend test coverage for ACLStandardRule and ACLExtendedRule to include validation of generic source and destination objects. Add scenarios for aggregates, IP addresses, IP ranges, and validation of invalid objects. Test updates ensure the robustness and accuracy of the new field structure.
Introduces new columns for source and destination with support for generic objects in ACLStandardRule and ACLExtendedRule tables. Updates field and default column configurations for improved flexibility and alignment with the new data model.
Adds support for filtering by aggregates, IP addresses, and IP ranges in both source and destination fields. Updates filter fields for better alignment with the extended ACL rules model.
Integrates generic object handling for source and destination fields in ACLStandardRuleForm and ACLExtendedRuleForm. Introduces support for content types, dynamic queries, and enhanced validation. Improves alignment with the generic source/destination model update.
Rename labels for source and destination fields in ACL templates to reflect the updated generic model structure. Improves clarity and consistency with recent data model changes.
Replaces source_prefix and destination_prefix with generic source and destination prefetches in views for ACLStandardRule and ACLExtendedRule. Aligns view logic with the updated generic source/destination model for better flexibility and consistency.
Replaces source_prefix and destination_prefix with generic source and destination fields in ACL serializers. Introduces support for content types, dynamic querying, and enhanced validation in ACLStandardRule and ACLExtendedRule. Aligns serializers with the generic source/destination model for improved flexibility and consistency.
Updated docstrings for clarity by replacing "&" with "and" in multiple view classes. Revised prefetch fields in ACLStandardRule and ACLExtendedRule to align with the new generic source/destination model changes for better consistency.
Introduces generic source and destination fields in GraphQL types for ACLStandardRule and ACLExtendedRule. Adds support for ContentType relationships, caching related objects, and enhanced flexibility in object handling. Aligns GraphQL implementation with the updated generic model structure for consistency.
Introduces ContentType filtering for generic source and destination fields in ACLStandardRule and ACLExtendedRule GraphQL filters. Adds source_type, source_id, destination_type, and destination_id fields to enhance filtering flexibility and alignment with generic models.
Replaces `source_prefix` and `destination_prefix` with generic `source` and `destination` fields in ACL rule tests. Updates test cases to include `source_type`, `source_id`, `destination_type`, and `destination_id` for better alignment with the updated generic model.
Fixes multiple instances of "availble" to "available" in docstrings for ACL action, rule action, type, and protocol choices. Ensures documentation accuracy and readability.
alehaa
suggested changes
Aug 18, 2025
alehaa
reviewed
Aug 18, 2025
7bc0266
to
c403313
Compare
alehaa
suggested changes
Aug 20, 2025
netbox_acls/migrations/0005_acl_rule_source_and_destination_objects.py
Outdated
Show resolved
Hide resolved
netbox_acls/migrations/0005_acl_rule_source_and_destination_objects.py
Outdated
Show resolved
Hide resolved
7bdf349
to
3732819
Compare
alehaa
approved these changes
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears to be working as intended. I’ve tested creating ACL rules for aggregates, prefixes, IP ranges, and individual IP addresses.
Thanks so much for the review and for testing, @alehaa. |
Refines field names and query attributes for source and destination filters. Ensures consistency with related models and improves filtering accuracy for aggregates, IP ranges, and IP addresses.
Introduces `remark`, `source_port`, and `destination_port` fields to ACL filtersets for enhanced filtering capabilities. Aligns with the generic source/destination model updates and improves flexibility in rule definition.
Adds `using(db_alias)` to queries for ACLStandardRule and ACLExtendedRule to ensure the correct database alias is used during migration. Also adjusts formatting for dependency tuples to enhance consistency.
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Related Issue
Closes #129
New Behavior
ACL rules can now reference any of the following as source and/or destination:
ipam.Prefix
)ipam.IPRange
)ipam.IPAddress
)ipam.Aggregate
)Implementation highlights
source
anddestination
as GenericForeignKey fields backed by:source_type
/source_id
destination_type
/destination_id
(source_type, source_id)
and(destination_type, destination_id)
for efficient querying.Result: You can define ACL rules directly against a single host, an arbitrary range (CIDR or IPRange object), or aggregates - without needing to create a dummy Prefix first.
Contrast to Current Behavior
Prefix
objects could be selected (source_prefix
,destination_prefix
).source
anddestination
accept generic objects (Prefix, IPAddress, IPRange, Aggregate) across the UI, REST API, and GraphQL.Discussion: Benefits and Drawbacks
Benefits
Drawbacks / Risks
*_prefix
fields are removed in favor of generic fields.Compatibility
source_prefix
/destination_prefix
values to preserve behavior.Changes to the Documentation
source_type
/source_id
anddestination_type
/destination_id
.Proposed Release Note Entry
source_prefix
/destination_prefix
replaced by genericsource
/destination
fields (*_type
/*_id
). Existing data is migrated automatically; API/GraphQL clients must update.Migration & Upgrade Notes
source_type
/source_id
anddestination_type
/destination_id
; removessource_prefix
/destination_prefix
.Double Check
or in a linked issue.
dev
branch.