8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

Merge branch 'fix_acl_multiple_instance' of https://gitlab.federez.net/re2o/re2o into fix_acl_multiple_instance

This commit is contained in:
Hugo Levy-Falk 2020-04-30 22:36:03 +02:00
commit 74a44b7e92
3 changed files with 54 additions and 25 deletions

View file

@ -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 ""

View file

@ -192,14 +192,14 @@ class Machine(RevMixin, FieldPermissionModelMixin, AclMixin, 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 or ()), ("machines.delete_interface",) + (permissions or ()),
) )
return True, None, None return True, None, None
@ -1343,7 +1343,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" " user."), _("You don't have the right to edit a machine of another user."),
("machines.change_interface",) + (permissions or ()), ("machines.change_interface",) + (permissions or ()),
) )
return True, None, None return True, None, None
@ -1358,11 +1358,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" " user."), _("You don't have the right to delete interfaces of another"
("machines.change_interface",) + (permissions or ()), " user."),
("machines.delete_interface",) + (permissions or ()),
) )
return True, None, None return True, None, None
@ -1378,7 +1379,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
@ -1431,7 +1432,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",),
@ -1463,7 +1464,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
@ -1478,11 +1479,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 or ()), ("machines.delete_ipv6list",) + (permissions or ()),
) )
return True, None, None return True, None, None
@ -1498,7 +1499,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

View file

@ -197,13 +197,13 @@ class CommentTicket(AclMixin, models.Model):
""" Check that the user has the right to edit the ticket comment """ Check that the user has the right to edit the ticket comment
or that it is the author""" or that it is the author"""
if ( if (
not user_request.has_perm("tickets.edit_commentticket") not user_request.has_perm("tickets.change_commentticket")
and (self.parent_ticket.user != user_request or self.parent_ticket.user != self.created_by) and (self.parent_ticket.user != user_request or self.parent_ticket.user != self.created_by)
): ):
return ( return (
False, False,
_("You don't have the right to edit other tickets comments than yours."), _("You don't have the right to edit other tickets comments than yours."),
("tickets.edit_commentticket",), ("tickets.change_commentticket",),
) )
else: else:
return True, None, None return True, None, None