Incorrect error code and message when opening a project without access
Describe the bug When attempting to open a Testomat project that my account does not have access to but I'm a member of the Company, the system returns HTTP 404 – "Project Not Found :disappointed_relieved:". This is misleading, as the project does exist, but I simply lack permissions to view it.
Expected behavior is to return HTTP 401 (Unauthorized) or HTTP 403 (Forbidden), along with a clear message indicating that the user needs to request access from an administrator. This will help users quickly understand the reason for the error and take the correct action, instead of assuming the project does not exist.
Steps to Reproduce:
- Log in to Testomat with an account that does not have access to a given project
- Attempt to open the project URL directly
- Observe the error code and message returned
Expected Result: Receive 401 Unauthorized or 403 Forbidden with a message such as:
"You don’t have access to this project. Please contact the manager to request access."
Actual Result:
Received 404 Not Found – "Project Not Found"
Issue is still present
- [x] User has access to Company but not to the project = 403 forbidden should be
- [x] User doesn't have access to Company + Project = 404 error Not found should be
https://github.com/user-attachments/assets/92fe2aaf-7e44-4c45-affa-be6714cfd076
Please unify: User doesn't have access to Company + Project = 404 error Page Not found should be
- [x] If user is redirected to the project page: has the old error
- [x] If user is redirected to the company page: 404 error Not found appears (as expected)
- [x] User doesn't have access to Company + Project = 404 error Not found should be
https://github.com/user-attachments/assets/af485e0c-49a0-42fd-b585-b3376c2110b5
- [x] User has access to Company but not to the project = 403 forbidden should be
https://github.com/user-attachments/assets/a2377474-e965-4c07-ab14-7ff199464eb3
https://github.com/testomatio/testomatio/pull/7217#pullrequestreview-3456211219
No need to return 403 @Fro0z1k when user doesn't have access to Company + Project
Only should be unified, old design for error 404 should not be existed ⬇️
Change it to ⬇️
- [x] No Access to Project + Company (404)
- [x] No Access to Company (404)
- [x] No access Project (but has access to Company) (403)
- [x] Removed user (404)