Skip to content

Conversation

@cgokey
Copy link
Collaborator

@cgokey cgokey commented Sep 18, 2025

Overview

What is the feature?

When a user removes all collections from their selected collection list, it should not default to all collections, but [] collections.

What is the Solution?

Fixed a bug where removing collections would inadvertently delete the entire collection_identifier block due to the code calling removeEmpty(). This caused ACLs to interpret the absence of collection_identifier as no filtering, exposing all collections instead of applying intended restrictions of [] no collections. The fix ensures that the collection_identifier block is preserved even when all specific collections are deselected, maintaining proper access controls and preventing unintended exposure of collections.

What areas of the application does this impact?

Collection Permissions

Testing

You can see the bug in UAT, try going to:
https://mmt.uat.earthdata.nasa.gov/permissions/ACL1276516601-CMR/edit
Add a couple collections and click submit,.
Take a look at the raw ACL:
curl -H "Authorization: $TOKEN" "https://cmr.uat.earthdata.nasa.gov:443/access-control/acls/ACL1276516601-CMR?pretty=true"

Now go back to: https://mmt.uat.earthdata.nasa.gov/permissions/ACL1276516601-CMR/edit
Remove those collections
And click submit.
curl -H "Authorization: $TOKEN" "https://cmr.uat.earthdata.nasa.gov:443/access-control/acls/ACL1276516601-CMR?pretty=true"

Notice that the entire collection identifier block was removed. This caused ACLs to interpret the absence of collection_identifier as no filtering, exposing all collections instead of applying intended restrictions of [] no collections.

https://mmt.uat.earthdata.nasa.gov/permissions/ACL1276516601-CMR/edit will show all collections checked.

Now try the same thing with this branch and you should see collection_identifier preserved.

Attachments

Please include relevant screenshots or files that would be helpful in reviewing and verifying this change.

Checklist

  • I have added automated tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

…e, it should not default to all collections.
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 98.36066% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.96%. Comparing base (93d0f1e) to head (e93bcf3).

Files with missing lines Patch % Lines
...rc/js/components/PermissionForm/PermissionForm.jsx 98.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1408      +/-   ##
==========================================
- Coverage   97.99%   97.96%   -0.04%     
==========================================
  Files         421      421              
  Lines        6737     6780      +43     
  Branches     1403     1430      +27     
==========================================
+ Hits         6602     6642      +40     
- Misses        134      137       +3     
  Partials        1        1              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mandyparson
Copy link
Contributor

Putting comments on slack here for posterity:

I do see the error has gone away but the underlying issue seems to still be present (it's defaulting to all collections for me). Few things I was thinking about while testing this though:

  1. Should we make Collection Selection required? Wouldn't creating a permission for no collections be a really weird use case?
  2. In the selecting collections widget, is there a difference between the (-) button and the trash can icon? Can we eliminate the trash can?
  3. I'm getting an error banner at the bottom. Not sure why but I definitely don't think we should have users see it this way. May be another ticket though...

@cgokey cgokey merged commit 7b3351f into main Sep 23, 2025
7 checks passed
@cgokey cgokey deleted the MMT-4080 branch September 23, 2025 17:51
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.

6 participants