mirror of https://gitlab.federez.net/re2o/re2o
committed by
root
14 changed files with 520 additions and 8 deletions
@ -0,0 +1,41 @@ |
|||||
|
# ⁻*- mode: python; coding: utf-8 -*- |
||||
|
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
||||
|
# se veut agnostique au réseau considéré, de manière à être installable en |
||||
|
# quelques clics. |
||||
|
# |
||||
|
# Copyright © 2018 Gabriel Detraz |
||||
|
# |
||||
|
# This program is free software; you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU General Public License as published by |
||||
|
# the Free Software Foundation; either version 2 of the License, or |
||||
|
# (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU General Public License along |
||||
|
# with this program; if not, write to the Free Software Foundation, Inc., |
||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
|
|
||||
|
from django.core.management.base import BaseCommand, CommandError |
||||
|
from pymongo import MongoClient |
||||
|
|
||||
|
class Command(BaseCommand): |
||||
|
help = 'Ce script donne un nom aux bornes dans le controleur unifi. |
||||
|
A lancer sur le serveur en local où se trouve le controleur' |
||||
|
|
||||
|
def handle(self, *args, **options): |
||||
|
# Connexion mongodb |
||||
|
client = MongoClient("mongodb://localhost:27117") |
||||
|
db = client.ace |
||||
|
device = db['device'] |
||||
|
|
||||
|
def set_bornes_names(liste_bornes): |
||||
|
"""Met à jour les noms des bornes dans la bdd du controleur""" |
||||
|
for borne in liste_bornes: |
||||
|
device.find_one_and_update({'ip': str(borne['ipHostNumber'][0])}, {'$set': {'name': borne['host'][0].split('.')[0]}}) |
||||
|
return |
||||
|
|
||||
|
self.stdout.write(self.style.SUCCESS('Mise à jour de la base de donnée unifi avec succès')) |
||||
@ -0,0 +1,28 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.10.7 on 2018-03-23 01:18 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('machines', '0076_auto_20180130_1623'), |
||||
|
('topologie', '0033_auto_20171231_1743'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.CreateModel( |
||||
|
name='Borne', |
||||
|
fields=[ |
||||
|
('interface_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='machines.Interface')), |
||||
|
('location', models.CharField(help_text="Détails sur la localisation de l'AP", max_length=255)), |
||||
|
], |
||||
|
options={ |
||||
|
'permissions': (('view_borne', 'Peut voir une borne'),), |
||||
|
}, |
||||
|
bases=('machines.interface',), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,20 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.10.7 on 2018-03-23 23:23 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('topologie', '0034_borne'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='borne', |
||||
|
name='location', |
||||
|
field=models.CharField(blank=True, help_text="Détails sur la localisation de l'AP", max_length=255, null=True), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,74 @@ |
|||||
|
{% comment %} |
||||
|
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
||||
|
se veut agnostique au réseau considéré, de manière à être installable en |
||||
|
quelques clics. |
||||
|
|
||||
|
Copyright © 2017 Gabriel Détraz |
||||
|
Copyright © 2017 Goulven Kermarec |
||||
|
Copyright © 2017 Augustin Lemesle |
||||
|
|
||||
|
This program is free software; you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation; either version 2 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
This program is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License along |
||||
|
with this program; if not, write to the Free Software Foundation, Inc., |
||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
|
{% endcomment %} |
||||
|
|
||||
|
{% load acl %} |
||||
|
|
||||
|
<div class="table-responsive"> |
||||
|
{% if borne_list.paginator %} |
||||
|
{% include "pagination.html" with list=borne_list %} |
||||
|
{% endif %} |
||||
|
|
||||
|
|
||||
|
<table class="table table-striped"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>{% include "buttons/sort.html" with prefix='borne' col='name' text='Borne' %}</th> |
||||
|
<th>{% include "buttons/sort.html" with prefix='borne' col='mac' text='Addresse mac' %}</th> |
||||
|
<th>{% include "buttons/sort.html" with prefix='borne' col='ip' text='Ipv4' %}</th> |
||||
|
<th>Commentaire</th> |
||||
|
<th>Localisation</th> |
||||
|
<th></th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
{% for borne in borne_list %} |
||||
|
<tr> |
||||
|
<td>{{borne}}</td> |
||||
|
<td>{{borne.mac_address}}</td> |
||||
|
<td>{{borne.ipv4}}</td> |
||||
|
<td>{{borne.details}}</td> |
||||
|
<td>{{borne.location}}</td> |
||||
|
<td class="text-right"> |
||||
|
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'borne' borne.pk %}"> |
||||
|
<i class="fa fa-history"></i> |
||||
|
</a> |
||||
|
{% can_edit borne %} |
||||
|
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-borne' borne.id %}"> |
||||
|
<i class="fa fa-edit"></i> |
||||
|
</a> |
||||
|
{% acl_end %} |
||||
|
{% can_delete borne %} |
||||
|
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'machines:del-interface' borne.id %}"> |
||||
|
<i class="fa fa-trash"></i> |
||||
|
</a> |
||||
|
{% acl_end %} |
||||
|
</td> |
||||
|
</tr> |
||||
|
{% endfor %} |
||||
|
</table> |
||||
|
|
||||
|
|
||||
|
{% if borne_list.paginator %} |
||||
|
{% include "pagination.html" with list=borne_list %} |
||||
|
{% endif %} |
||||
|
</div> |
||||
@ -0,0 +1,63 @@ |
|||||
|
{% extends "topologie/sidebar.html" %} |
||||
|
{% comment %} |
||||
|
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
||||
|
se veut agnostique au réseau considéré, de manière à être installable en |
||||
|
quelques clics. |
||||
|
|
||||
|
Copyright © 2017 Gabriel Détraz |
||||
|
Copyright © 2017 Goulven Kermarec |
||||
|
Copyright © 2017 Augustin Lemesle |
||||
|
|
||||
|
This program is free software; you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation; either version 2 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
This program is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License along |
||||
|
with this program; if not, write to the Free Software Foundation, Inc., |
||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
|
{% endcomment %} |
||||
|
|
||||
|
{% load bootstrap3 %} |
||||
|
{% load massive_bootstrap_form %} |
||||
|
|
||||
|
{% block title %}Création et modification d'une borne{% endblock %} |
||||
|
|
||||
|
{% block content %} |
||||
|
{% if topoform %} |
||||
|
{% bootstrap_form_errors topoform %} |
||||
|
{% endif %} |
||||
|
{% if machineform %} |
||||
|
{% bootstrap_form_errors machineform %} |
||||
|
{% endif %} |
||||
|
{% if domainform %} |
||||
|
{% bootstrap_form_errors domainform %} |
||||
|
{% endif %} |
||||
|
|
||||
|
|
||||
|
|
||||
|
<form class="form" method="post"> |
||||
|
{% csrf_token %} |
||||
|
{% if topoform %} |
||||
|
<h3>Réglage spécifiques de la borne</h3> |
||||
|
{% massive_bootstrap_form topoform 'ipv4,machine' mbf_param=i_mbf_param%} |
||||
|
{% endif %} |
||||
|
{% if machineform %} |
||||
|
<h3>Réglages généraux de la machine associée à la borne</h3> |
||||
|
{% massive_bootstrap_form machineform 'user' %} |
||||
|
{% endif %} |
||||
|
{% if domainform %} |
||||
|
<h3>Nom de la machine</h3> |
||||
|
{% bootstrap_form domainform %} |
||||
|
{% endif %} |
||||
|
{% bootstrap_button "Créer ou modifier" button_type="submit" icon="ok" %} |
||||
|
</form> |
||||
|
<br /> |
||||
|
<br /> |
||||
|
<br /> |
||||
|
{% endblock %} |
||||
@ -0,0 +1,41 @@ |
|||||
|
{% extends "topologie/sidebar.html" %} |
||||
|
{% comment %} |
||||
|
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
||||
|
se veut agnostique au réseau considéré, de manière à être installable en |
||||
|
quelques clics. |
||||
|
|
||||
|
Copyright © 2017 Gabriel Détraz |
||||
|
Copyright © 2017 Goulven Kermarec |
||||
|
Copyright © 2017 Augustin Lemesle |
||||
|
|
||||
|
This program is free software; you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation; either version 2 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
This program is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License along |
||||
|
with this program; if not, write to the Free Software Foundation, Inc., |
||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
|
{% endcomment %} |
||||
|
|
||||
|
{% load bootstrap3 %} |
||||
|
{% load acl %} |
||||
|
|
||||
|
{% block title %}Bornes WiFi{% endblock %} |
||||
|
|
||||
|
{% block content %} |
||||
|
<h2>Points d'accès WiFi</h2> |
||||
|
{% can_create Room %} |
||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-borne' %}"><i class="fa fa-plus"></i> Ajouter une borne</a> |
||||
|
<hr> |
||||
|
{% acl_end %} |
||||
|
{% include "topologie/aff_borne.html" with borne_list=borne_list %} |
||||
|
<br /> |
||||
|
<br /> |
||||
|
<br /> |
||||
|
{% endblock %} |
||||
Loading…
Reference in new issue