mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
More logic permission check in machine
This commit is contained in:
parent
b440519c73
commit
ace47e1bc7
2 changed files with 51 additions and 23 deletions
|
@ -21,7 +21,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 2.5\n"
|
"Project-Id-Version: 2.5\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2020-04-24 18:45+0200\n"
|
"POT-Creation-Date: 2020-04-30 22:19+0200\n"
|
||||||
"PO-Revision-Date: 2018-06-23 16:35+0200\n"
|
"PO-Revision-Date: 2018-06-23 16:35+0200\n"
|
||||||
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
|
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
@ -192,8 +192,7 @@ msgstr ""
|
||||||
"Vous avez atteint le nombre maximal d'interfaces que vous pouvez créer vous-"
|
"Vous avez atteint le nombre maximal d'interfaces que vous pouvez créer vous-"
|
||||||
"même (%s)."
|
"même (%s)."
|
||||||
|
|
||||||
#: machines/models.py:189 machines/models.py:1354 machines/models.py:1373
|
#: machines/models.py:189
|
||||||
#: machines/models.py:1476 machines/models.py:1494
|
|
||||||
msgid "You don't have the right to edit a machine of another user."
|
msgid "You don't have the right to edit a machine of another user."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous n'avez pas le droit de modifier une machine d'un autre utilisateur."
|
"Vous n'avez pas le droit de modifier une machine d'un autre utilisateur."
|
||||||
|
@ -588,9 +587,19 @@ msgstr ""
|
||||||
msgid "You don't have the right to edit the machine."
|
msgid "You don't have the right to edit the machine."
|
||||||
msgstr "Vous n'avez pas le droit d'éditer une machine."
|
msgstr "Vous n'avez pas le droit d'éditer une machine."
|
||||||
|
|
||||||
#: machines/models.py:1391 machines/models.py:1511
|
#: machines/models.py:1354
|
||||||
msgid "You don't have the right to view machines other than yours."
|
msgid "You don't have the right to edit interfaces of another user."
|
||||||
msgstr "Vous n'avez pas le droit de voir d'autres machines que les vôtres."
|
msgstr ""
|
||||||
|
"Vous n'avez pas le droit de modifier une interface d'un autre utilisateur."
|
||||||
|
|
||||||
|
#: machines/models.py:1373
|
||||||
|
msgid "You don't have the right to delete interfaces of another user."
|
||||||
|
msgstr ""
|
||||||
|
"Vous n'avez pas le droit de supprimer une interface d'une autre utilisateur."
|
||||||
|
|
||||||
|
#: machines/models.py:1391
|
||||||
|
msgid "You don't have the right to view interfaces other than yours."
|
||||||
|
msgstr "Vous n'avez pas le droit de voir d'autres interfaces que les vôtres."
|
||||||
|
|
||||||
#: machines/models.py:1419
|
#: machines/models.py:1419
|
||||||
msgid "Can view an IPv6 addresses list object"
|
msgid "Can view an IPv6 addresses list object"
|
||||||
|
@ -612,17 +621,30 @@ msgstr "Listes d'adresses IPv6"
|
||||||
msgid "Nonexistent interface."
|
msgid "Nonexistent interface."
|
||||||
msgstr "Interface inexistante."
|
msgstr "Interface inexistante."
|
||||||
|
|
||||||
#: machines/models.py:1444 machines/models.py:1688
|
#: machines/models.py:1444
|
||||||
msgid "You don't have the right to add an alias to a machine of another user."
|
msgid "You don't have the right to add ipv6 to a machine of another user."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous n'avez pas le droit d'ajouter un alias à une machine d'un autre "
|
"Vous n'avez pas le droit d'ajouter des ipv6 à une machine d'un autre utilisateur."
|
||||||
"utilisateur."
|
|
||||||
|
|
||||||
#: machines/models.py:1457
|
#: machines/models.py:1457
|
||||||
msgid "You don't have the right to change the SLAAC value of an IPv6 address."
|
msgid "You don't have the right to change the SLAAC value of an IPv6 address."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous n'avez pas le droit de changer la valeur SLAAC d'une adresse IPv6."
|
"Vous n'avez pas le droit de changer la valeur SLAAC d'une adresse IPv6."
|
||||||
|
|
||||||
|
#: machines/models.py:1476
|
||||||
|
msgid "You don't have the right to edit ipv6 of a machine of another user."
|
||||||
|
msgstr ""
|
||||||
|
"Vous n'avez pas le droit de modifier les ipv6 d'une machine d'un autre utilisateur."
|
||||||
|
|
||||||
|
#: machines/models.py:1494
|
||||||
|
msgid "You don't have the right to delete ipv6 of a machine of another user."
|
||||||
|
msgstr ""
|
||||||
|
"Vous n'avez pas le droit de supprimer les ipv6 d'une machine d'une autre utilisateur."
|
||||||
|
|
||||||
|
#: machines/models.py:1511
|
||||||
|
msgid "You don't have the right to view ipv6 of machines other than yours."
|
||||||
|
msgstr "Vous n'avez pas le droit de voir les ipv6 d'autres machines que les vôtres."
|
||||||
|
|
||||||
#: machines/models.py:1543
|
#: machines/models.py:1543
|
||||||
msgid "A SLAAC IP address is already registered."
|
msgid "A SLAAC IP address is already registered."
|
||||||
msgstr "Une adresse IP SLAAC est déjà enregistrée."
|
msgstr "Une adresse IP SLAAC est déjà enregistrée."
|
||||||
|
@ -677,6 +699,12 @@ msgstr "Le nom de domaine %s contient des caractères interdits."
|
||||||
msgid "Invalid extension."
|
msgid "Invalid extension."
|
||||||
msgstr "Extension invalide."
|
msgstr "Extension invalide."
|
||||||
|
|
||||||
|
#: machines/models.py:1688
|
||||||
|
msgid "You don't have the right to add an alias to a machine of another user."
|
||||||
|
msgstr ""
|
||||||
|
"Vous n'avez pas le droit d'ajouter un alias à une machine d'un autre "
|
||||||
|
"utilisateur."
|
||||||
|
|
||||||
#: machines/models.py:1704
|
#: machines/models.py:1704
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue