mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-30 08:32:26 +00:00
Format les macs en EUI et corrige une erreur d'acl
This commit is contained in:
parent
7f47f985c9
commit
3eb8cb2730
2 changed files with 5 additions and 1 deletions
|
@ -3,6 +3,7 @@ from django.db.models.signals import post_save, post_delete
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
from macaddress.fields import MACAddressField
|
from macaddress.fields import MACAddressField
|
||||||
|
from netaddr import EUI
|
||||||
|
|
||||||
from re2o.settings import MAIN_EXTENSION
|
from re2o.settings import MAIN_EXTENSION
|
||||||
|
|
||||||
|
@ -61,6 +62,9 @@ class Interface(models.Model):
|
||||||
user = self.machine.user
|
user = self.machine.user
|
||||||
return machine.active and user.has_access()
|
return machine.active and user.has_access()
|
||||||
|
|
||||||
|
def clean(self, *args, **kwargs):
|
||||||
|
self.mac_address = str(EUI(self.mac_address)) or None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.dns
|
return self.dns
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ def edit_interface(request, interfaceid):
|
||||||
messages.error(request, u"Interface inexistante" )
|
messages.error(request, u"Interface inexistante" )
|
||||||
return redirect("/machines")
|
return redirect("/machines")
|
||||||
if not request.user.has_perms(('infra',)):
|
if not request.user.has_perms(('infra',)):
|
||||||
if interface.machine.user != request.user:
|
if not request.user.has_perms(('cableur',)) and interface.machine.user != request.user:
|
||||||
messages.error(request, "Vous ne pouvez pas éditer une machine d'un autre user que vous sans droit")
|
messages.error(request, "Vous ne pouvez pas éditer une machine d'un autre user que vous sans droit")
|
||||||
return redirect("/users/profil/" + str(request.user.id))
|
return redirect("/users/profil/" + str(request.user.id))
|
||||||
machine_form = BaseEditMachineForm(request.POST or None, instance=interface.machine)
|
machine_form = BaseEditMachineForm(request.POST or None, instance=interface.machine)
|
||||||
|
|
Loading…
Reference in a new issue