Commit 3eb8cb27 authored by chirac's avatar chirac

Format les macs en EUI et corrige une erreur d'acl

parent 7f47f985
......@@ -3,6 +3,7 @@ from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.forms import ValidationError
from macaddress.fields import MACAddressField
from netaddr import EUI
from re2o.settings import MAIN_EXTENSION
......@@ -61,6 +62,9 @@ class Interface(models.Model):
user = self.machine.user
return and user.has_access()
def clean(self, *args, **kwargs):
self.mac_address = str(EUI(self.mac_address)) or None
def __str__(self):
return self.dns
......@@ -122,7 +122,7 @@ def edit_interface(request, interfaceid):
messages.error(request, u"Interface inexistante" )
return redirect("/machines")
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")
return redirect("/users/profil/" + str(
machine_form = BaseEditMachineForm(request.POST or None, instance=interface.machine)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment