mirror of
https://github.com/lucaspalomodevelop/netbox-acls.git
synced 2026-03-12 23:27:23 +00:00
update verbose name to use 'Access List'
This commit is contained in:
parent
069ca92c0c
commit
cd3b728704
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: 📖 Documentation Change
|
||||
description: Suggest an addition or modification to the NetBox access-list plugin documentation
|
||||
description: Suggest an addition or modification to the NetBox Access Lists plugin documentation
|
||||
title: "[Docs]: "
|
||||
labels: ["documentation"]
|
||||
body:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# netbox-access-lists
|
||||
|
||||
A NetBox plugin for Access-List management
|
||||
A NetBox plugin for Access List management
|
||||
|
||||
## Origin
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ from extras.plugins import PluginConfig
|
||||
|
||||
class NetBoxAccessListsConfig(PluginConfig):
|
||||
name = 'netbox_access_lists'
|
||||
verbose_name = 'Access-Lists'
|
||||
verbose_name = 'Access Lists'
|
||||
description = 'Manage simple ACLs in NetBox'
|
||||
version = '0.1'
|
||||
base_url = 'access-lists'
|
||||
|
||||
@ -14,7 +14,7 @@ __all__ = (
|
||||
|
||||
class ACLActionChoices(ChoiceSet):
|
||||
"""
|
||||
Defines the choices availble for the Access-List plugin specific to ACL default_action.
|
||||
Defines the choices availble for the Access Lists plugin specific to ACL default_action.
|
||||
"""
|
||||
ACTION_DENY = 'deny'
|
||||
ACTION_PERMIT = 'permit'
|
||||
@ -29,7 +29,7 @@ class ACLActionChoices(ChoiceSet):
|
||||
|
||||
class ACLRuleActionChoices(ChoiceSet):
|
||||
"""
|
||||
Defines the choices availble for the Access-List plugin specific to ACL rule actions.
|
||||
Defines the choices availble for the Access Lists plugin specific to ACL rule actions.
|
||||
"""
|
||||
ACTION_DENY = 'deny'
|
||||
ACTION_PERMIT = 'permit'
|
||||
@ -44,7 +44,7 @@ class ACLRuleActionChoices(ChoiceSet):
|
||||
|
||||
class ACLTypeChoices(ChoiceSet):
|
||||
"""
|
||||
Defines the choices availble for the Access-List plugin specific to ACL type.
|
||||
Defines the choices availble for the Access Lists plugin specific to ACL type.
|
||||
"""
|
||||
CHOICES = [
|
||||
('extended', 'Extended', 'purple'),
|
||||
@ -54,7 +54,7 @@ class ACLTypeChoices(ChoiceSet):
|
||||
|
||||
class ACLProtocolChoices(ChoiceSet):
|
||||
"""
|
||||
Defines the choices availble for the Access-List plugin specific to ACL Rule protocol.
|
||||
Defines the choices availble for the Access Lists plugin specific to ACL Rule protocol.
|
||||
"""
|
||||
CHOICES = [
|
||||
('icmp', 'ICMP', 'purple'),
|
||||
|
||||
@ -57,7 +57,7 @@ from ..models import AccessList
|
||||
#
|
||||
# fieldsets = [
|
||||
# ('Host Details', ('region', 'site_group', 'site', 'device')),
|
||||
# ('Access-List Details', ('type', 'default_action', 'add_tags', 'remove_tags')),
|
||||
# ('Access List Details', ('type', 'default_action', 'add_tags', 'remove_tags')),
|
||||
# ]
|
||||
#
|
||||
#
|
||||
@ -67,7 +67,7 @@ from ..models import AccessList
|
||||
# help_texts = {
|
||||
# 'default_action': 'The default behavior of the ACL.',
|
||||
# 'name': 'The name uniqueness per device is case insensitive.',
|
||||
# 'type': mark_safe('<b>*Note:</b> CANNOT be changed if ACL Rules are assoicated to this Access-List.'),
|
||||
# 'type': mark_safe('<b>*Note:</b> CANNOT be changed if ACL Rules are assoicated to this Access List.'),
|
||||
# }
|
||||
#
|
||||
# def clean(self): # Not working given you are bulkd editing multiple forms
|
||||
|
||||
@ -57,7 +57,7 @@ class AccessListForm(NetBoxModelForm):
|
||||
|
||||
fieldsets = [
|
||||
('Host Details', ('region', 'site_group', 'site', 'device')),
|
||||
('Access-List Details', ('name', 'type', 'default_action', 'tags')),
|
||||
('Access List Details', ('name', 'type', 'default_action', 'tags')),
|
||||
]
|
||||
|
||||
class Meta:
|
||||
@ -66,7 +66,7 @@ class AccessListForm(NetBoxModelForm):
|
||||
help_texts = {
|
||||
'default_action': 'The default behavior of the ACL.',
|
||||
'name': 'The name uniqueness per device is case insensitive.',
|
||||
'type': mark_safe('<b>*Note:</b> CANNOT be changed if ACL Rules are assoicated to this Access-List.'),
|
||||
'type': mark_safe('<b>*Note:</b> CANNOT be changed if ACL Rules are assoicated to this Access List.'),
|
||||
}
|
||||
|
||||
def clean(self):
|
||||
@ -90,7 +90,7 @@ class AccessListForm(NetBoxModelForm):
|
||||
|
||||
class ACLStandardRuleForm(NetBoxModelForm):
|
||||
"""
|
||||
GUI form to add or edit Standard Access-List.
|
||||
GUI form to add or edit Standard Access List.
|
||||
Requires an access_list, an index, and ACL rule type.
|
||||
See the clean function for logic on other field requirements.
|
||||
"""
|
||||
@ -100,7 +100,7 @@ class ACLStandardRuleForm(NetBoxModelForm):
|
||||
'type': 'standard'
|
||||
},
|
||||
help_text=mark_safe('<b>*Note:</b> This field will only display Standard ACLs.'),
|
||||
label='Access-List',
|
||||
label='Access List',
|
||||
)
|
||||
source_prefix = DynamicModelChoiceField(
|
||||
queryset=Prefix.objects.all(),
|
||||
@ -114,7 +114,7 @@ class ACLStandardRuleForm(NetBoxModelForm):
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
('Access-List Details', ('access_list', 'description', 'tags')),
|
||||
('Access List Details', ('access_list', 'description', 'tags')),
|
||||
('Rule Definition', ('index', 'action', 'remark', 'source_prefix')),
|
||||
)
|
||||
|
||||
@ -152,7 +152,7 @@ class ACLStandardRuleForm(NetBoxModelForm):
|
||||
|
||||
class ACLExtendedRuleForm(NetBoxModelForm):
|
||||
"""
|
||||
GUI form to add or edit Extended Access-List.
|
||||
GUI form to add or edit Extended Access List.
|
||||
Requires an access_list, an index, and ACL rule type.
|
||||
See the clean function for logic on other field requirements.
|
||||
"""
|
||||
@ -162,7 +162,7 @@ class ACLExtendedRuleForm(NetBoxModelForm):
|
||||
'type': 'extended'
|
||||
},
|
||||
help_text=mark_safe('<b>*Note:</b> This field will only display Extended ACLs.'),
|
||||
label='Access-List',
|
||||
label='Access List',
|
||||
)
|
||||
tags = DynamicModelMultipleChoiceField(
|
||||
queryset=Tag.objects.all(),
|
||||
@ -181,7 +181,7 @@ class ACLExtendedRuleForm(NetBoxModelForm):
|
||||
label='Destination Prefix',
|
||||
)
|
||||
fieldsets = (
|
||||
('Access-List Details', ('access_list', 'description', 'tags')),
|
||||
('Access List Details', ('access_list', 'description', 'tags')),
|
||||
('Rule Definition', ('index', 'action', 'remark', 'source_prefix', 'source_ports', 'destination_prefix', 'destination_ports', 'protocol',)),
|
||||
)
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ __all__ = (
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
"""
|
||||
Defines the migrations required for the initial setup of the access-list plugin and its associated django models.
|
||||
Defines the migrations required for the initial setup of the access lists plugin and its associated django models.
|
||||
"""
|
||||
|
||||
initial = True
|
||||
@ -42,6 +42,7 @@ class Migration(migrations.Migration):
|
||||
options={
|
||||
'ordering': ('name', 'device'),
|
||||
'unique_together': {('name', 'device')},
|
||||
'verbose_name': 'Access List',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
@ -62,6 +63,7 @@ class Migration(migrations.Migration):
|
||||
options={
|
||||
'ordering': ('access_list', 'index'),
|
||||
'unique_together': {('access_list', 'index')},
|
||||
'verbose_name': 'ACL Standard Rule',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
@ -86,6 +88,7 @@ class Migration(migrations.Migration):
|
||||
options={
|
||||
'ordering': ('access_list', 'index'),
|
||||
'unique_together': {('access_list', 'index')},
|
||||
'verbose_name': 'ACL Extended Rule',
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
@ -25,7 +25,7 @@ class ACLRule(NetBoxModel):
|
||||
access_list = models.ForeignKey(
|
||||
on_delete=models.CASCADE,
|
||||
to=AccessList,
|
||||
verbose_name='Access-List',
|
||||
verbose_name='Access List',
|
||||
)
|
||||
index = models.PositiveIntegerField()
|
||||
remark = models.CharField(
|
||||
@ -57,8 +57,13 @@ class ACLRule(NetBoxModel):
|
||||
return ACLRuleActionChoices.colors.get(self.action)
|
||||
|
||||
class Meta:
|
||||
"""
|
||||
Define the common model properties:
|
||||
- as an abstract model
|
||||
- ordering
|
||||
- unique together
|
||||
"""
|
||||
abstract = True
|
||||
default_related_name='%(class)ss'
|
||||
ordering = ('access_list', 'index')
|
||||
unique_together = ('access_list', 'index')
|
||||
|
||||
@ -75,6 +80,16 @@ class ACLStandardRule(ACLRule):
|
||||
"""
|
||||
return reverse('plugins:netbox_access_lists:aclstandardrule', args=[self.pk])
|
||||
|
||||
class Meta(ACLRule.Meta):
|
||||
"""
|
||||
Define the model properties adding to or overriding the inherited class:
|
||||
- default_related_name for any FK relationships
|
||||
- verbose name (for displaying in the GUI)
|
||||
- verbose name plural (for displaying in the GUI)
|
||||
"""
|
||||
default_related_name='aclstandardrules'
|
||||
verbose_name='ACL Standard Rule'
|
||||
verbose_name_plural='ACL Standard Rules'
|
||||
|
||||
class ACLExtendedRule(ACLRule):
|
||||
"""
|
||||
@ -116,3 +131,14 @@ class ACLExtendedRule(ACLRule):
|
||||
|
||||
def get_protocol_color(self):
|
||||
return ACLProtocolChoices.colors.get(self.protocol)
|
||||
|
||||
class Meta(ACLRule.Meta):
|
||||
"""
|
||||
Define the model properties adding to or overriding the inherited class:
|
||||
- default_related_name for any FK relationships
|
||||
- verbose name (for displaying in the GUI)
|
||||
- verbose name plural (for displaying in the GUI)
|
||||
"""
|
||||
default_related_name='aclextendedrules'
|
||||
verbose_name='ACL Extended Rule'
|
||||
verbose_name_plural='ACL Extended Rules'
|
||||
|
||||
@ -15,7 +15,7 @@ __all__ = (
|
||||
|
||||
class AccessList(NetBoxModel):
|
||||
"""
|
||||
Model defintion for Access-Lists.
|
||||
Model defintion for Access Lists.
|
||||
"""
|
||||
name = models.CharField(
|
||||
max_length=100
|
||||
@ -42,6 +42,9 @@ class AccessList(NetBoxModel):
|
||||
class Meta:
|
||||
ordering = ('name', 'device')
|
||||
unique_together = ('name', 'device')
|
||||
default_related_name='accesslists'
|
||||
verbose_name='Access List'
|
||||
verbose_name_plural='Access Lists'
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -43,19 +43,19 @@ aclextendedrule_butons = [
|
||||
menu_items = (
|
||||
PluginMenuItem(
|
||||
link='plugins:netbox_access_lists:accesslist_list',
|
||||
link_text='Access-Lists',
|
||||
link_text='Access Lists',
|
||||
buttons=accesslist_buttons
|
||||
),
|
||||
# Comment out Standard Access-List rule to force creation in the ACL view
|
||||
# Comment out Standard Access List rule to force creation in the ACL view
|
||||
PluginMenuItem(
|
||||
link='plugins:netbox_access_lists:aclstandardrule_list',
|
||||
link_text='Standard Access-List Rules',
|
||||
link_text='ACL Standard Rule',
|
||||
buttons=aclstandardrule_butons
|
||||
),
|
||||
# Comment out Extended Access-List rule to force creation in the ACL view
|
||||
# Comment out Extended Access List rule to force creation in the ACL view
|
||||
PluginMenuItem(
|
||||
link='plugins:netbox_access_lists:aclextendedrule_list',
|
||||
link_text='Extended Access-List Rules',
|
||||
link_text='ACL Extended Rules',
|
||||
buttons=aclextendedrule_butons
|
||||
),
|
||||
)
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<div class="card">
|
||||
<h5 class="card-header">
|
||||
Access-Lists
|
||||
Access Lists
|
||||
</h5>
|
||||
<div class="card-body">
|
||||
{% include 'inc/device/assigned_access_lists.html' %}
|
||||
</div>
|
||||
<div class="card-footer text-end noprint">
|
||||
<a href="{% url 'plugins:netbox_access_lists:accesslist_add' %}?{{ type }}={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-sm btn-primary">
|
||||
<i class="mdi mdi-plus-thick"></i> Add Access-List
|
||||
<i class="mdi mdi-plus-thick"></i> Add Access List
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_access_lists:accesslist_list' %}">Access-Lists</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_access_lists:accesslist_list' %}">Access Lists</a></li>
|
||||
{% endblock %}
|
||||
{% block controls %}
|
||||
<div class="pull-right noprint">
|
||||
@ -46,7 +46,7 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-6">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Access-List</h5>
|
||||
<h5 class="card-header">Access List</h5>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover attr-table">
|
||||
<tr>
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-6">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Extended Access-List Rule</h5>
|
||||
<h5 class="card-header">ACL Extended Rule</h5>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover attr-table">
|
||||
<tr>
|
||||
<th scope="row">Access-List</th>
|
||||
<th scope="row">Access List</th>
|
||||
<td>
|
||||
<a href="{{ object.access_list.get_absolute_url }}">{{ object.access_list }}</a>
|
||||
</td>
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-6">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Standard Access-List Rule</h5>
|
||||
<h5 class="card-header">ACL Standard Rule</h5>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover attr-table">
|
||||
<tr>
|
||||
<th scope="row">Access-List</th>
|
||||
<th scope="row">Access List</th>
|
||||
<td>
|
||||
<a href="{{ object.access_list.get_absolute_url }}">{{ object.access_list }}</a>
|
||||
</td>
|
||||
|
||||
@ -9,7 +9,7 @@ from . import models, views
|
||||
|
||||
urlpatterns = (
|
||||
|
||||
# Access-Lists
|
||||
# Access Lists
|
||||
path('access-lists/', views.AccessListListView.as_view(), name='accesslist_list'),
|
||||
path('access-lists/add/', views.AccessListEditView.as_view(), name='accesslist_add'),
|
||||
#path('access-lists/edit/', views.AccessListBulkEditView.as_view(), name='accesslist_bulk_edit'),
|
||||
@ -20,7 +20,7 @@ urlpatterns = (
|
||||
'model': models.AccessList
|
||||
}),
|
||||
|
||||
# Standard Access-List rules
|
||||
# Standard Access List rules
|
||||
path('standard-rules/', views.ACLStandardRuleListView.as_view(), name='aclstandardrule_list'),
|
||||
path('standard-rules/add/', views.ACLStandardRuleEditView.as_view(), name='aclstandardrule_add'),
|
||||
path('standard-rules/<int:pk>/', views.ACLStandardRuleView.as_view(), name='aclstandardrule'),
|
||||
@ -30,7 +30,7 @@ urlpatterns = (
|
||||
'model': models.ACLStandardRule
|
||||
}),
|
||||
|
||||
# Extended Access-List rules
|
||||
# Extended Access List rules
|
||||
path('extended-rules/', views.ACLExtendedRuleListView.as_view(), name='aclextendedrule_list'),
|
||||
path('extended-rules/add/', views.ACLExtendedRuleEditView.as_view(), name='aclextendedrule_add'),
|
||||
path('extended-rules/<int:pk>/', views.ACLExtendedRuleView.as_view(), name='aclextendedrule'),
|
||||
|
||||
@ -35,7 +35,7 @@ class AccessListView(generic.ObjectView):
|
||||
|
||||
def get_extra_context(self, request, instance):
|
||||
"""
|
||||
Depending on the Access-List type, the list view will return the required ACL Rule using the previous defined tables in tables.py.
|
||||
Depending on the Access List type, the list view will return the required ACL Rule using the previous defined tables in tables.py.
|
||||
"""
|
||||
if instance.type == 'extended':
|
||||
table = tables.ACLExtendedRuleTable(instance.aclextendedrules.all())
|
||||
|
||||
2
setup.py
2
setup.py
@ -27,7 +27,7 @@ setup(
|
||||
name='netbox-access-lists',
|
||||
version='0.1.0',
|
||||
#version=get_version('netbox_access_lists/version.py'),
|
||||
description='A NetBox plugin for Access-List management',
|
||||
description='A NetBox plugin for Access List management',
|
||||
#long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url='https://github.com/ryanmerolle/netbox-access-lists',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user