Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
80ac47b4
Commit
80ac47b4
authored
Sep 29, 2017
by
LEVY-FALK Hugo
Committed by
root
Sep 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Affichage basique des configurations de ports disponibles.
parent
5d553027
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
4 deletions
+59
-4
machines/models.py
machines/models.py
+8
-3
machines/templates/machines/index_portlist.html
machines/templates/machines/index_portlist.html
+37
-0
machines/templates/machines/sidebar.html
machines/templates/machines/sidebar.html
+6
-0
machines/urls.py
machines/urls.py
+1
-0
machines/views.py
machines/views.py
+7
-1
No files found.
machines/models.py
View file @
80ac47b4
...
...
@@ -415,6 +415,12 @@ class PortList(models.Model):
def
__str__
(
self
):
return
', '
.
join
(
map
(
str
,
self
.
port_set
.
all
()))
def
tcp_ports
(
self
):
return
self
.
port_set
.
filter
(
protocole
=
Port
.
TCP
)
def
udp_ports
(
self
):
return
self
.
port_set
.
filter
(
protocole
=
Port
.
UDP
)
class
Port
(
models
.
Model
):
"""
Représente un simple port ou une plage de ports.
...
...
@@ -437,10 +443,9 @@ class Port(models.Model):
)
def
__str__
(
self
):
beg
=
self
.
protocole
+
' : '
if
self
.
begin
==
self
.
end
:
return
beg
+
str
(
self
.
begin
)
return
beg
+
'-'
.
join
([
str
(
self
.
begin
),
str
(
self
.
end
)])
return
str
(
self
.
begin
)
return
'-'
.
join
([
str
(
self
.
begin
),
str
(
self
.
end
)])
@
receiver
(
post_save
,
sender
=
Machine
)
...
...
machines/templates/machines/index_portlist.html
0 → 100644
View file @
80ac47b4
{% extends "machines/sidebar.html" %}
{% load bootstrap3 %}
{% block title %}Configuration de ports{% endblock %}
{% block content %}
<h2>
Liste des configurations de ports
</h2>
<a
class=
"btn btn-primary btn-sm"
role=
"button"
href=
"#"
><i
class=
"glyphicon glyphicon-plus"
></i>
Ajouter une configuration
</a>
<table
class=
"table table-striped"
>
<thead>
<tr>
<th>
Nom
</th>
<th>
TCP
</th>
<th>
UDP
</th>
<th></th>
</tr>
</thead>
{% for pl in port_list %}
<tr>
<td>
{{pl.name}}
</td>
<td>
{{pl.tcp_ports}}
</td>
<td>
{{pl.udp_ports}}
</td>
<td
class=
"text-right"
>
{%comment%}
{% include 'buttons/suppr.html' href='machines:del-portlist' id=pl.id %}
{% include 'buttons/edit.html' href='machines:edit-portlist' id=pl.id %}
{%endcomment%}
</td>
</tr>
{%endfor%}
</table>
<br
/>
<br
/>
<br
/>
{% endblock %}
machines/templates/machines/sidebar.html
View file @
80ac47b4
...
...
@@ -55,4 +55,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Services (dhcp, dns...)
</a>
{% endif %}
{% if is_bureau %}
<a
class=
"list-group-item list-group-item-info"
href=
"{% url "
machines:index-portlist
"
%}"
>
<i
class=
"glyphicon glyphicon-list"
></i>
Configuration de ports
</a>
{%endif%}
{% endblock %}
machines/urls.py
View file @
80ac47b4
...
...
@@ -92,4 +92,5 @@ urlpatterns = [
url
(
r
'^rest/text/$'
,
views
.
text
,
name
=
'text'
),
url
(
r
'^rest/zones/$'
,
views
.
zones
,
name
=
'zones'
),
url
(
r
'^rest/service_servers/$'
,
views
.
service_servers
,
name
=
'service-servers'
),
url
(
r
'index_portlist/$'
,
views
.
index_portlist
,
name
=
'index-portlist'
),
]
machines/views.py
View file @
80ac47b4
...
...
@@ -48,7 +48,7 @@ from reversion.models import Version
import
re
from
.forms
import
NewMachineForm
,
EditMachineForm
,
EditInterfaceForm
,
AddInterfaceForm
,
MachineTypeForm
,
DelMachineTypeForm
,
ExtensionForm
,
DelExtensionForm
,
BaseEditInterfaceForm
,
BaseEditMachineForm
from
.forms
import
EditIpTypeForm
,
IpTypeForm
,
DelIpTypeForm
,
DomainForm
,
AliasForm
,
DelAliasForm
,
NsForm
,
DelNsForm
,
TextForm
,
DelTextForm
,
MxForm
,
DelMxForm
,
VlanForm
,
DelVlanForm
,
ServiceForm
,
DelServiceForm
,
NasForm
,
DelNasForm
from
.models
import
IpType
,
Machine
,
Interface
,
IpList
,
MachineType
,
Extension
,
Mx
,
Ns
,
Domain
,
Service
,
Service_link
,
Vlan
,
Nas
,
Text
from
.models
import
IpType
,
Machine
,
Interface
,
IpList
,
MachineType
,
Extension
,
Mx
,
Ns
,
Domain
,
Service
,
Service_link
,
Vlan
,
Nas
,
Text
,
PortList
from
users.models
import
User
from
users.models
import
all_has_access
from
preferences.models
import
GeneralOption
,
OptionalMachine
...
...
@@ -912,6 +912,12 @@ def history(request, object, id):
return
render
(
request
,
're2o/history.html'
,
{
'reversions'
:
reversions
,
'object'
:
object_instance
})
@
login_required
@
permission_required
(
'bureau'
)
def
index_portlist
(
request
):
port_list
=
PortList
.
objects
.
all
().
order_by
(
'name'
)
return
render
(
request
,
"machines/index_portlist.html"
,
{
'port_list'
:
port_list
})
""" Framework Rest """
class
JSONResponse
(
HttpResponse
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment