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

[TTAHUB-3095] Don't remove expired grants from the recipients dropdown when an AR is unlocked #2265

Merged
merged 11 commits into from
Jul 15, 2024

Conversation

nvms
Copy link
Collaborator

@nvms nvms commented Jul 11, 2024

Description of change

Modifies possibleRecipients to accept an optional report id. If the report id is provided, it returns recipients that may be expired, but have been used on this report previously.

It also adds a new endpoint

/api/activity-report/activity-recipients/:reportId

How to test

Use the seeded data. Be Hermione. Give yourself unlock permissions. The report with id 9999 already has a recipient that is Inactive. Unlock report 9999. Edit it, go to the account summary, remove the recipient from the dropdown, expand the dropdown and you should still have the old recipient in the list even though they are expired. Save the report. Be sure the save takes effect.

Issue(s)

Checklists

Every PR

  • Meets issue criteria
  • JIRA ticket status updated
  • Code is meaningfully tested
  • Meets accessibility standards (WCAG 2.1 Levels A, AA)
  • API Documentation updated
  • Boundary diagram updated
  • Logical Data Model updated
  • Architectural Decision Records written for major infrastructure decisions
  • UI review complete

Before merge to main

  • OHS demo complete
  • Ready to create production PR

Production Deploy

  • Staging smoke test completed

After merge/deploy

  • Update JIRA ticket status

@nvms nvms marked this pull request as ready for review July 11, 2024 23:18
Copy link
Collaborator

@GarrettEHill GarrettEHill left a comment

Choose a reason for hiding this comment

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

Looks fine, being we worked on it together

@@ -40,6 +41,7 @@ router.post('/', transactionWrapper(createReport));
router.get('/approvers', transactionWrapper(getApprovers));
router.get('/groups', transactionWrapper(getGroups));
router.get('/activity-recipients', transactionWrapper(getActivityRecipients));
router.get('/activity-recipients/:reportId', transactionWrapper(getActivityRecipientsForExistingReport));
Copy link
Collaborator

Choose a reason for hiding this comment

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

might be a useless change, but how do we feel about flipping this to be /:reportId/activity-recipients (i.e /api/activity-reports/1/activity-recipients)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah.. I had this same thought. I'll make this change 👍

@@ -722,6 +722,14 @@ export async function getActivityRecipients(req, res) {
res.json(activityRecipients);
}

export async function getActivityRecipientsForExistingReport(req, res) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to check permissions here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not actually sure. What do you think? What we're potentially exposing (to already-authenticated users) is which grant recipients were previously associated with a given AR. My initial thought is that this isn't sensitive - but maybe I"m wrong

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose without context that info doesn't feel particularly sensitive. The only counterargument is that all the other report-related data is confined to a region. I'm ok with site-access level permissions here, personally. Although, I am not the decider.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I ended up adding AR read permissions to this handler: 440a55a

Copy link
Collaborator

Choose a reason for hiding this comment

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

looks good. One thing to consider is that if you are fetching the report, you no longer need to rely on the region ID being passed as a query parameter, since the report has a regionID.

@thewatermethod
Copy link
Collaborator

Everything looks great, just a question and a suggestion

@nvms nvms merged commit 98ac36a into main Jul 15, 2024
10 checks passed
@nvms nvms deleted the jp/3095/dont-remove-expired-grants-on-ar branch July 15, 2024 13:42
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.

3 participants