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

A user cannot answer to a ticket by email if he has no default organization with the permission to create tickets #954

Open
marien-probesys opened this issue Feb 14, 2025 · 0 comments
Labels
easy task Good for first time contributors ready ✅ You can work on this! topic: emails All the stuff related to the emails system topic: ticketing All the stuff related to the tickets
Milestone

Comments

@marien-probesys
Copy link
Member

marien-probesys commented Feb 14, 2025

Problem

We have a case where a user is only "invited" in an organization. This user cannot create tickets as he's not a customer. But he can answer to the tickets in which he's observer. When the user answers to a ticket by email, Bileto complains because "sender has not permission to create tickets".

How to reproduce

  1. Create a role "invited user" with only the permission to answer to tickets
  2. Create a user and grant him this role
  3. Create a ticket and add this user as an observer
  4. Verify that an email is sent to this user and answer to it with the address of the user
  5. The email is rejected with the error "sender has not permission to create tickets"

What was expected?

The email should be accepted and the answer added to the ticket.

Solution

This is because of these lines: https://github.com/Probesys/bileto/blob/main/src/MessageHandler/CreateTicketsFromMailboxEmailsHandler.php#L125-L131

We shouldn't check if the user has an organization if he's answering to an existing ticket.

We must move the condition below:

if ($ticket) {
    // check if the user can answer to the ticket
} elseif ($requesterOrganization) {
    // create the ticket
} else {
    // mark the email in error and stop there
}
@marien-probesys marien-probesys added easy task Good for first time contributors topic: emails All the stuff related to the emails system topic: ticketing All the stuff related to the tickets labels Feb 14, 2025
@marien-probesys marien-probesys added this to the Version 0.15 milestone Feb 14, 2025
@marien-probesys marien-probesys added the ready ✅ You can work on this! label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy task Good for first time contributors ready ✅ You can work on this! topic: emails All the stuff related to the emails system topic: ticketing All the stuff related to the tickets
Projects
None yet
Development

No branches or pull requests

1 participant