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
bbc00fdb
Commit
bbc00fdb
authored
Sep 11, 2017
by
Gabriel Detraz
Committed by
root
Sep 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajoute unicode literals + attribue les ip à l'enregistrement auto en fonction du nas
parent
3a1b4c3b
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
94 additions
and
7 deletions
+94
-7
cotisations/admin.py
cotisations/admin.py
+2
-0
cotisations/forms.py
cotisations/forms.py
+2
-0
cotisations/models.py
cotisations/models.py
+2
-0
cotisations/urls.py
cotisations/urls.py
+2
-0
cotisations/views.py
cotisations/views.py
+2
-0
freeradius_utils/auth.py
freeradius_utils/auth.py
+5
-2
logs/admin.py
logs/admin.py
+2
-0
logs/models.py
logs/models.py
+2
-0
logs/urls.py
logs/urls.py
+2
-0
logs/views.py
logs/views.py
+3
-0
machines/admin.py
machines/admin.py
+2
-0
machines/forms.py
machines/forms.py
+2
-0
machines/models.py
machines/models.py
+2
-0
machines/urls.py
machines/urls.py
+2
-0
machines/views.py
machines/views.py
+3
-0
preferences/admin.py
preferences/admin.py
+2
-0
preferences/forms.py
preferences/forms.py
+2
-0
preferences/models.py
preferences/models.py
+1
-0
preferences/urls.py
preferences/urls.py
+2
-0
preferences/views.py
preferences/views.py
+1
-0
re2o/context_processors.py
re2o/context_processors.py
+2
-0
re2o/settings.py
re2o/settings.py
+2
-0
re2o/settings_local.example.py
re2o/settings_local.example.py
+2
-0
re2o/urls.py
re2o/urls.py
+2
-0
re2o/views.py
re2o/views.py
+2
-0
re2o/wsgi.py
re2o/wsgi.py
+2
-0
search/admin.py
search/admin.py
+2
-0
search/forms.py
search/forms.py
+2
-0
search/models.py
search/models.py
+2
-0
search/urls.py
search/urls.py
+2
-0
search/views.py
search/views.py
+3
-0
topologie/admin.py
topologie/admin.py
+1
-0
topologie/forms.py
topologie/forms.py
+2
-0
topologie/models.py
topologie/models.py
+2
-0
topologie/urls.py
topologie/urls.py
+2
-0
topologie/views.py
topologie/views.py
+2
-0
users/admin.py
users/admin.py
+2
-0
users/forms.py
users/forms.py
+1
-0
users/models.py
users/models.py
+11
-5
users/urls.py
users/urls.py
+2
-0
users/views.py
users/views.py
+3
-0
No files found.
cotisations/admin.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.contrib
import
admin
from
reversion.admin
import
VersionAdmin
...
...
cotisations/forms.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django
import
forms
from
django.forms
import
ModelForm
,
Form
from
django
import
forms
...
...
cotisations/models.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db
import
models
from
django.db.models.signals
import
post_save
,
post_delete
...
...
cotisations/urls.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
.
import
views
...
...
cotisations/views.py
View file @
bbc00fdb
...
...
@@ -23,6 +23,8 @@
# App de gestion des users pour re2o
# Goulven Kermarec, Gabriel Détraz
# Gplv2
from
__future__
import
unicode_literals
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
get_object_or_404
from
django.template.context_processors
import
csrf
...
...
freeradius_utils/auth.py
View file @
bbc00fdb
...
...
@@ -32,6 +32,8 @@ Inspirés d'autres exemples trouvés ici :
https://github.com/FreeRADIUS/freeradius-server/blob/master/src/modules/rlm_python/
"""
from
__future__
import
unicode_literals
import
logging
import
netaddr
import
radiusd
# Module magique freeradius (radiusd.py is dummy)
...
...
@@ -238,8 +240,9 @@ def detach(_=None):
def
decide_vlan_and_register_macauth
(
switch_id
,
port_number
,
mac_address
):
# Get port from switch and port number
switch
=
Switch
.
objects
.
filter
(
switch_interface
=
Interface
.
objects
.
filter
(
Q
(
ipv4
=
IpList
.
objects
.
filter
(
ipv4
=
switch_id
))
|
Q
(
domain
=
Domain
.
objects
.
filter
(
name
=
switch_id
))))
if
not
switch
:
ipv4
=
IpList
.
objects
.
filter
(
ipv4
=
switch_id
)
switch
=
Switch
.
objects
.
filter
(
switch_interface
=
Interface
.
objects
.
filter
(
Q
(
ipv4
=
ipv4
)
|
Q
(
domain
=
Domain
.
objects
.
filter
(
name
=
switch_id
))))
if
not
switch
or
not
ipv4
:
return
(
'?'
,
'Switch inconnu'
,
VLAN_OK
)
sw_name
=
str
(
switch
.
first
().
switch_interface
)
...
...
logs/admin.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.contrib
import
admin
# Register your models here.
logs/models.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db
import
models
# Create your models here.
logs/urls.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
.
import
views
...
...
logs/views.py
View file @
bbc00fdb
...
...
@@ -23,6 +23,9 @@
# App de gestion des statistiques pour re2o
# Gabriel Détraz
# Gplv2
from
__future__
import
unicode_literals
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
get_object_or_404
...
...
machines/admin.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.contrib
import
admin
from
reversion.admin
import
VersionAdmin
...
...
machines/forms.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.forms
import
ModelForm
,
Form
,
ValidationError
from
django
import
forms
from
.models
import
Domain
,
Machine
,
Interface
,
IpList
,
MachineType
,
Extension
,
Mx
,
Text
,
Ns
,
Service
,
Vlan
,
Nas
,
IpType
...
...
machines/models.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db
import
models
from
django.db.models.signals
import
post_save
,
pre_delete
,
post_delete
from
django.dispatch
import
receiver
...
...
machines/urls.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
.
import
views
...
...
machines/views.py
View file @
bbc00fdb
...
...
@@ -23,6 +23,9 @@
# App de gestion des machines pour re2o
# Gabriel Détraz, Augustin Lemesle
# Gplv2
from
__future__
import
unicode_literals
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
get_object_or_404
...
...
preferences/admin.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.contrib
import
admin
from
reversion.admin
import
VersionAdmin
...
...
preferences/forms.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.forms
import
ModelForm
,
Form
,
ValidationError
from
django
import
forms
from
.models
import
OptionalUser
,
OptionalMachine
,
OptionalTopologie
,
GeneralOption
,
AssoOption
,
MailMessageOption
,
Service
...
...
preferences/models.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db
import
models
from
cotisations.models
import
Paiement
...
...
preferences/urls.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
.
import
views
...
...
preferences/views.py
View file @
bbc00fdb
...
...
@@ -24,6 +24,7 @@
# Gabriel Détraz, Augustin Lemesle
# Gplv2
from
__future__
import
unicode_literals
from
django.shortcuts
import
render
from
django.shortcuts
import
get_object_or_404
,
render
,
redirect
...
...
re2o/context_processors.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
machines.models
import
Interface
,
Machine
from
preferences.models
import
GeneralOption
...
...
re2o/settings.py
View file @
bbc00fdb
...
...
@@ -33,6 +33,8 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from
__future__
import
unicode_literals
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import
os
from
.settings_local
import
*
...
...
re2o/settings_local.example.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
SECRET_KEY
=
'SUPER_SECRET_KEY'
DB_PASSWORD
=
'SUPER_SECRET_DB'
...
...
re2o/urls.py
View file @
bbc00fdb
...
...
@@ -34,6 +34,8 @@ Class-based views
Including another URLconf
1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from
__future__
import
unicode_literals
from
django.conf.urls
import
include
,
url
from
django.contrib
import
admin
from
django.contrib.auth
import
views
as
auth_views
...
...
re2o/views.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.shortcuts
import
render
from
django.shortcuts
import
get_object_or_404
from
django.template.context_processors
import
csrf
...
...
re2o/wsgi.py
View file @
bbc00fdb
...
...
@@ -29,6 +29,8 @@ For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
from
__future__
import
unicode_literals
import
os
from
django.core.wsgi
import
get_wsgi_application
from
os.path
import
dirname
...
...
search/admin.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.contrib
import
admin
# Register your models here.
search/forms.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db.models
import
Q
from
simple_search
import
BaseSearchForm
...
...
search/models.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db
import
models
from
django
import
forms
from
django.forms
import
Form
...
...
search/urls.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
.
import
views
...
...
search/views.py
View file @
bbc00fdb
...
...
@@ -23,6 +23,9 @@
# App de recherche pour re2o
# Augustin lemesle, Gabriel Détraz, Goulven Kermarec
# Gplv2
from
__future__
import
unicode_literals
from
django.shortcuts
import
render
from
django.shortcuts
import
get_object_or_404
from
django.template.context_processors
import
csrf
...
...
topologie/admin.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.contrib
import
admin
from
reversion.admin
import
VersionAdmin
...
...
topologie/forms.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
.models
import
Port
,
Switch
,
Room
,
Stack
from
django.forms
import
ModelForm
,
Form
from
machines.models
import
Interface
...
...
topologie/models.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db
import
models
from
django.db.models.signals
import
post_delete
from
django.dispatch
import
receiver
...
...
topologie/urls.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
.
import
views
...
...
topologie/views.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.shortcuts
import
render
,
redirect
from
django.contrib
import
messages
from
django.contrib.auth.decorators
import
login_required
,
permission_required
...
...
users/admin.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.contrib
import
admin
from
django.contrib.auth.models
import
Group
from
django.contrib.auth.admin
import
UserAdmin
as
BaseUserAdmin
...
...
users/forms.py
View file @
bbc00fdb
...
...
@@ -23,6 +23,7 @@
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django
import
forms
from
django.forms
import
ModelForm
,
Form
...
...
users/models.py
View file @
bbc00fdb
...
...
@@ -21,6 +21,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.db
import
models
from
django.db.models
import
Q
from
django
import
forms
...
...
@@ -47,7 +49,7 @@ from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from
django.core.validators
import
MinLengthValidator
from
topologie.models
import
Room
from
cotisations.models
import
Cotisation
,
Facture
,
Paiement
,
Vente
from
machines.models
import
Domain
,
Interface
,
MachineType
,
Machine
,
regen
from
machines.models
import
Domain
,
Interface
,
MachineType
,
Machine
,
Nas
,
MachineType
,
regen
from
preferences.models
import
GeneralOption
,
AssoOption
,
OptionalUser
,
OptionalMachine
,
MailMessageOption
now
=
timezone
.
now
()
...
...
@@ -453,17 +455,21 @@ class User(AbstractBaseUser):
general_options
.
email_from
,
[
req
.
user
.
email
],
fail_silently
=
False
)
return
def
autoregister_machine
(
self
,
mac_address
):
def
autoregister_machine
(
self
,
mac_address
,
nas_ip
):
all_machines
=
self
.
all_machines
()
options
,
created
=
OptionalMachine
.
objects
.
get_or_create
()
if
all_macines
.
count
()
>
options
.
max_lambdauser_interfaces
:
if
all_mac
h
ines
.
count
()
>
options
.
max_lambdauser_interfaces
:
return
False
,
"Maximum de machines enregistrees atteinte"
nas_object
=
Nas
.
objects
.
filter
(
nas_type__in
=
MachineType
.
objects
.
filter
(
ip_type
=
nas_ip
.
ip_type
))
if
not
nas_object
:
return
False
,
"Re2o ne sait pas à quel machinetype affecter cette machine"
machine_type_cible
=
nas_object
.
first
().
machine_type
try
:
machine_parent
=
Machine
()
machine_parent
.
user
=
self
interface_cible
=
Interface
()
interface_cible
.
mac_address
=
mac_address
interface_cible
.
type
=
MachineType
.
objects
.
all
().
first
()
interface_cible
.
type
=
machine_type_cible
interface_cible
.
clean
()
machine_parent
.
clean
()
domain
=
Domain
()
...
...
@@ -481,7 +487,7 @@ class User(AbstractBaseUser):
return
True
,
"Ok"
def
all_machines
(
self
):
return
Interface
s
.
objects
.
filter
(
machine__in
=
Machine
.
objects
.
filter
(
user
=
self
))
return
Interface
.
objects
.
filter
(
machine__in
=
Machine
.
objects
.
filter
(
user
=
self
))
def
__str__
(
self
):
return
self
.
pseudo
...
...
users/urls.py
View file @
bbc00fdb
...
...
@@ -20,6 +20,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
.
import
views
...
...
users/views.py
View file @
bbc00fdb
...
...
@@ -23,6 +23,9 @@
# App de gestion des users pour re2o
# Goulven Kermarec, Gabriel Détraz, Lemesle Augustin
# Gplv2
from
__future__
import
unicode_literals
from
django.shortcuts
import
get_object_or_404
,
render
,
redirect
from
django.template.context_processors
import
csrf
from
django.core.paginator
import
Paginator
,
EmptyPage
,
PageNotAnInteger
...
...
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