Skip to content

Conversation

@clewellyn-nava
Copy link
Contributor

@clewellyn-nava clewellyn-nava commented Nov 25, 2025

JIRA Ticket:

What Does This PR Do?

This PR:

  1. Adds views to support /v3/DigitalInsuranceCard
  2. Adds a new permissions class (HasDigitalInsuranceCardScope) and unit tests for covering the scopes required
  3. Adds the digital insurance card to the testclient
  4. Updates many HTTPS calls to BFD from a MIME type of json or application/json to application/fhir+json, which is the correct/appropriate MIME type for those calls.

What Should Reviewers Watch For?

  • Reviewers should try and make calls against the C4DIC endpoint with the wrong scopes. For example, if you call the endpoint via Postman and only have Read or Search (but not both), then a call against this endpoint should fail.
  • We left ViewSet implementations in the codebase for discussion. After discussion, we might either move them into the primary way we handle API calls, or we might remove them. They are not executed in production, and therefore are left for discussion at this time. (If this is deemed to be a bad idea, we can pull them from this PR.)
  • We do not have tests on the testclient view, or on the call to BFD. This is because we do not have a test user we know we can code into the codebase for this purpose. Something to discuss as a team.

Validation

Unit tests pass, integration tests pass, local testclient works as expected. This shouldn't be a functional change of any existing endpoints or tests.

For testing the C4DIC endpoint, you will need to authenticate with BBUser09995 (PW09995!@), as it has the C4DIC data populated. (BBUser09003 also seems to work.)

What Security Implications Does This PR Have?

N/A

Any Migrations?

N/A

@clewellyn-nava clewellyn-nava changed the title C4DIC Endpoint BB2-4266 - C4DIC Endpoint Nov 26, 2025
@clewellyn-nava clewellyn-nava marked this pull request as ready for review November 26, 2025 18:44
@JamesDemeryNava JamesDemeryNava marked this pull request as draft December 2, 2025 14:36
We're discovering what is needed for "integration" or "e2e" tests, and perhaps Selenium should just do the lifting. Cleaning up a bit, and diving into the token permissions.
After much sleuthing and conversation, we decided that trying to make the ProtectedCapabilities model work for C4DIC does not make sense. Further, HasDigitalInsuranceCardScope does *almost* the same checking; the only thing it does not check is the *method*, which is not a showstopper (or even a concern, really, because we already gate that elsewhere).
This does not have tests for `DigitalInsuranceCard`. That would imply that we have a user we can plug in for upstream tests against BFD. It is unclear if we have that user.
@jadudm jadudm marked this pull request as ready for review December 8, 2025 16:07
@jimmyfagan jimmyfagan self-assigned this Dec 8, 2025
@JamesDemeryNava
Copy link
Contributor

JamesDemeryNava commented Dec 9, 2025

Looks great! Testclient looks good (did v2 as well just to be sure), Postman works as expected, and when I only have read scopes for an access token, I get a 403. All the functionality looks good, going through the diff now.

Just left a few questions/comments.

"""
def has_permission(self, request, view):

def has_permission(self, request, view) -> bool: # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the type: ignore here?

class TokenHasProtectedCapability(permissions.BasePermission):

def has_permission(self, request, view):
def has_permission(self, request, view) -> bool: # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment here

Copy link
Contributor

@JamesDemeryNava JamesDemeryNava left a comment

Choose a reason for hiding this comment

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

This looks good to me! All the functionality works from what I tested, and comments have been addressed. I'd say this could use another set of eyes before merging, but there was a ton of collaboration on this already.

@jadudm jadudm merged commit 8cee77f into master Dec 9, 2025
8 checks passed
@jadudm jadudm deleted the clewellyn-nava/BB2-4266/C4DIC-endpoint branch December 9, 2025 21:40
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.

5 participants