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

Use exception class Forbidden to raise 403 errors. #6038

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

Aadesh-Baral
Copy link
Contributor

@Aadesh-Baral Aadesh-Baral commented Aug 24, 2023

Part of #5911, #5912

@Aadesh-Baral Aadesh-Baral self-assigned this Aug 24, 2023
@Aadesh-Baral Aadesh-Baral marked this pull request as ready for review August 25, 2023 08:50
@Aadesh-Baral Aadesh-Baral marked this pull request as draft August 25, 2023 08:51
-----------------------------------
The current setup for deleting a project involves conflicting permission checks. In the resource class function, users with a Project Manager (PM) role are allowed to delete projects. However, in the service function responsible for project deletion, the check only permits organization managers or system administrators to perform this action.

To address this inconsistency in permission checks, this commit streamlines the process. It eliminates the permission check within the service function, thereby enabling users with PM roles within a project to successfully initiate project deletions.
--------------------------------------------------------------------

Previously, we utilized the same error reason, namely "USER_NOT_ON_ALLOWED_LIST," for two distinct situations:

1. When a user, who is blocked, attempts to map/validate a task.
2. When a user lacks the necessary permissions to map/validate.

To enhance clarity and precision in error reporting, we have introduced a distinct error reason for the scenario where a user is blocked. This modification allows us to deliver more accurate and contextually relevant error messages, ultimately improving the user experience and troubleshooting process.
@Aadesh-Baral Aadesh-Baral force-pushed the enhance/5912-403-error branch 2 times, most recently from 2cf4b32 to 0a8cb8f Compare August 29, 2023 08:17
-----------------------
After the introduction of new exception classes on backend the error response format is changed. As in new error response error subcode should be accessed on error.sub_code this commit handles this case.
Also change in subcode to identify project is private and cannot be accessed by user has been addressed.
@sonarcloud
Copy link

sonarcloud bot commented Aug 30, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.4% 0.4% Duplication

@Aadesh-Baral Aadesh-Baral marked this pull request as ready for review September 1, 2023 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

1 participant