|
|
|
@ -72,21 +72,26 @@ class Ticket(AclMixin, models.Model): |
|
|
|
""" Check that the user has the right to view the ticket |
|
|
|
or that it is the author""" |
|
|
|
if (not user_request.has_perm('tickets.view_ticket') and self.user != user_request): |
|
|
|
return False, _("You don't have the right to view other tickets than yours.") |
|
|
|
return ( |
|
|
|
False, |
|
|
|
_("You don't have the right to view other tickets than yours."), |
|
|
|
('tickets.view_ticket',) |
|
|
|
) |
|
|
|
else: |
|
|
|
return True, None |
|
|
|
return True, None, None |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def can_view_all(user_request, *_args, **_kwargs): |
|
|
|
""" Check that the user has access to the list of all tickets""" |
|
|
|
return( |
|
|
|
user_request.has_perm('tickets.view_tickets'), |
|
|
|
_("You don't have the right to view the list of tickets.") |
|
|
|
_("You don't have the right to view the list of tickets."), |
|
|
|
('tickets.view_tickets',) |
|
|
|
) |
|
|
|
|
|
|
|
def can_create(user_request,*_args, **_kwargs): |
|
|
|
""" Authorise all users to open tickets """ |
|
|
|
return True,None |
|
|
|
return True, None, None |
|
|
|
|
|
|
|
@receiver(post_save, sender=Ticket) |
|
|
|
def ticket_post_save(**kwargs): |
|
|
|
|