Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle correctly when losing access to a ticket after changing its actors #762

Open
marien-probesys opened this issue Oct 11, 2024 · 0 comments
Labels
ready ✅ You can work on this! topic: ticketing All the stuff related to the tickets type: bug Something isn't working
Milestone

Comments

@marien-probesys
Copy link
Member

marien-probesys commented Oct 11, 2024

Problem

An agent may have access to a ticket because they are assigned to it.
If after changing the actors the agent no longer has access to the ticket, they got an error.

Solution

If after changing the actors the agent no longer has access to the ticket, redirect to the list of tickets and display a notification explaining that access has been lost.

Specification

In src/Controller/Tickets/ActorsController.php, before redirecting to the ticket, check if the current user still has access to the ticket:

// with $authorizer being a \App\Security\Authorizer
if ($authorizer->isGranted(`orga:see`, $ticket)) {
    // ...
}

If the condition is false, set a "success" notification and redirect to the list of tickets of the organization:

// Translation: "The actors have been updated, but you no longer have access to the ticket."
$this->addFlash('success', $translator->trans('tickets.actors.edit.no_access'));

return $this->redirectToRoute('organization tickets', [
    'uid' => $organization->getUid(),
]);
@marien-probesys marien-probesys added type: bug Something isn't working topic: ticketing All the stuff related to the tickets labels Oct 11, 2024
@marien-probesys marien-probesys added this to the Version 0.12-beta milestone Oct 11, 2024
@marien-probesys marien-probesys added the ready ✅ You can work on this! label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ✅ You can work on this! topic: ticketing All the stuff related to the tickets type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant