department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
98 stars 68 forks source link

Sections field on media doesn't respect workbench access limitations in the media widget version of form #5436

Open kevwalsh opened 3 years ago

kevwalsh commented 3 years ago

Describe the defect

As Austin.wilmarth@va.gov, sections field on media allows me to add media to any section at VA. I should only see Colorado Springs

To Reproduce Steps to reproduce the behavior:

  1. Log in as Austin.wilmarth@va.gov
  2. Go to /media/add/image
  3. See that you only have access to one section (which should be pre-populated, but is not)
  4. Go to https://staging.cms.va.gov/node/3792/edit and add a photo (upload from your computer)
  5. Note the Sections field shows _all_sections.

Expected behavior

I should only see the section i have access to (Colorado Springs Vet Center), like i do on the /media/add/image form. Ideally, if i only have access to one section, it should be prepopulated

Screenshots

Current behavior on media widget version of image form

Edit_Vet_Center_Colorado_Springs_Vet_Center___VA_gov_CMS

Comparison of two widgets, between the media widget (top) and /media/add/image (below)

media-section-choice

Vet Center Service form

image

ACs

CMS Team

Please leave only the team that will do this work selected. If you're not sure, it's fine to leave both selected.

ethanteague commented 3 years ago

Per our scrum convo on 6/3, approach should be to resolve workbench bug that is preventing modal from being aware of current context. E.g.: don't extend the js approach used to winnow health service dropdowns.

ethanteague commented 3 years ago

Gonna have to abandon the non-js approach for this one for now - stepping through it in the debugger is yielding no clues. I can't figure out where the magic is that is limiting results when the "default" entity reference method is selected, here: /admin/structure/media/manage/image/fields/media.image.field_owner - I tried creating a new entity reference view, but this requires a new term view, with a reference to be made to the node lock user, and this relationship doesn't connect to the user section list. @kevwalsh

EWashb commented 1 year ago

I found this without the team label on it. Adding to our backlog @productmike @BerniXiongA6