|
|
@ -202,14 +202,14 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model): |
|
|
can_user, _message, permissions = self.user.can_edit( |
|
|
can_user, _message, permissions = self.user.can_edit( |
|
|
self.user, user_request, *args, **kwargs |
|
|
self.user, user_request, *args, **kwargs |
|
|
) |
|
|
) |
|
|
if not (user_request.has_perm("machines.change_interface") and can_user): |
|
|
if not (user_request.has_perm("machines.delete_interface") and can_user): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_( |
|
|
_( |
|
|
"You don't have the right to delete a machine" |
|
|
"You don't have the right to delete a machine" |
|
|
" of another user." |
|
|
" of another user." |
|
|
), |
|
|
), |
|
|
("machines.change_interface",) + permissions, |
|
|
("machines.delete_interface",) + permissions, |
|
|
) |
|
|
) |
|
|
return True, None, None |
|
|
return True, None, None |
|
|
|
|
|
|
|
|
@ -1351,7 +1351,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): |
|
|
if not (user_request.has_perm("machines.change_interface") and can_user): |
|
|
if not (user_request.has_perm("machines.change_interface") and can_user): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_("You don't have the right to edit a machine of another" |
|
|
_("You don't have the right to edit interfaces of another" |
|
|
" user."), |
|
|
" user."), |
|
|
("machines.change_interface",) + permissions, |
|
|
("machines.change_interface",) + permissions, |
|
|
) |
|
|
) |
|
|
@ -1367,12 +1367,12 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): |
|
|
can_user, _message, permissions = self.machine.user.can_edit( |
|
|
can_user, _message, permissions = self.machine.user.can_edit( |
|
|
user_request, *args, **kwargs |
|
|
user_request, *args, **kwargs |
|
|
) |
|
|
) |
|
|
if not (user_request.has_perm("machines.change_interface") and can_user): |
|
|
if not (user_request.has_perm("machines.delete_interface") and can_user): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_("You don't have the right to edit a machine of another" |
|
|
_("You don't have the right to delete interfaces of another" |
|
|
" user."), |
|
|
" user."), |
|
|
("machines.change_interface",) + permissions, |
|
|
("machines.delete_interface",) + permissions, |
|
|
) |
|
|
) |
|
|
return True, None, None |
|
|
return True, None, None |
|
|
|
|
|
|
|
|
@ -1388,7 +1388,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): |
|
|
): |
|
|
): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_("You don't have the right to view machines other than yours."), |
|
|
_("You don't have the right to view interfaces other than yours."), |
|
|
("machines.view_interface",), |
|
|
("machines.view_interface",), |
|
|
) |
|
|
) |
|
|
return True, None, None |
|
|
return True, None, None |
|
|
@ -1441,7 +1441,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_( |
|
|
_( |
|
|
"You don't have the right to add an alias to a" |
|
|
"You don't have the right to add ipv6 to a" |
|
|
" machine of another user." |
|
|
" machine of another user." |
|
|
), |
|
|
), |
|
|
("machines.add_ipv6list",), |
|
|
("machines.add_ipv6list",), |
|
|
@ -1473,7 +1473,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): |
|
|
if not (user_request.has_perm("machines.change_ipv6list") and can_user): |
|
|
if not (user_request.has_perm("machines.change_ipv6list") and can_user): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_("You don't have the right to edit a machine of another user."), |
|
|
_("You don't have the right to edit ipv6 of a machine of another user."), |
|
|
("machines.change_ipv6list",), |
|
|
("machines.change_ipv6list",), |
|
|
) |
|
|
) |
|
|
return True, None, None |
|
|
return True, None, None |
|
|
@ -1488,11 +1488,11 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): |
|
|
can_user, _message, permissions = self.interface.machine.user.can_edit( |
|
|
can_user, _message, permissions = self.interface.machine.user.can_edit( |
|
|
user_request, *args, **kwargs |
|
|
user_request, *args, **kwargs |
|
|
) |
|
|
) |
|
|
if not (user_request.has_perm("machines.change_ipv6list") and can_user): |
|
|
if not (user_request.has_perm("machines.delete_ipv6list") and can_user): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_("You don't have the right to edit a machine of another user."), |
|
|
_("You don't have the right to delete ipv6 of a machine of another user."), |
|
|
("machines.change_ipv6list",) + permissions, |
|
|
("machines.delete_ipv6list",) + permissions, |
|
|
) |
|
|
) |
|
|
return True, None, None |
|
|
return True, None, None |
|
|
|
|
|
|
|
|
@ -1508,7 +1508,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): |
|
|
): |
|
|
): |
|
|
return ( |
|
|
return ( |
|
|
False, |
|
|
False, |
|
|
_("You don't have the right to view machines other than yours."), |
|
|
_("You don't have the right to view ipv6 of machines other than yours."), |
|
|
("machines.view_ipv6list",), |
|
|
("machines.view_ipv6list",), |
|
|
) |
|
|
) |
|
|
return True, None, None |
|
|
return True, None, None |
|
|
|