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

Disallow read only users from performing writes to asset #2252

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

Conversation

rithviknishad
Copy link
Member

Proposed Changes

  • Add DRY Permissions for Asset model to prevent writes by read-only users

Associated Issue

Merge Checklist

  • Tests added/fixed
  • Linting Complete

@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins

@rithviknishad rithviknishad requested a review from a team as a code owner June 6, 2024 16:09
@rithviknishad rithviknishad requested a review from sainak June 6, 2024 16:09
@@ -38,6 +44,16 @@ def test_create_asset(self):
response = self.client.post("/api/v1/asset/", sample_data)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)

def test_create_asset_read_only(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rithviknishad Shouldn't we have tests for all ReadOnly Users?

Copy link
Member Author

@rithviknishad rithviknishad Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gigincg this would require creating user objects for each of the user type in the test's setup.

Checking with one of the read-only user type seems to be fine right?

cc: @sainak

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.52%. Comparing base (cda75bb) to head (77110e2).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2252      +/-   ##
===========================================
+ Coverage    63.48%   63.52%   +0.03%     
===========================================
  Files          238      238              
  Lines        13264    13276      +12     
  Branches      1886     1889       +3     
===========================================
+ Hits          8421     8433      +12     
  Misses        4490     4490              
  Partials       353      353              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Registering assets with state admin read-only account
3 participants