scientist-softserv / hykuup_knapsack

container project for the Hyku Up deploy of Hyku
Apache License 2.0
1 stars 0 forks source link

🐛 Works and Collections ingest as private regardless of Visibility seleciton #182

Closed ShanaLMoore closed 6 months ago

ShanaLMoore commented 6 months ago

UPDATE:

This issue is observed regardless if the work is imported or not. Repeating the following steps results in a failed update to the visibility property. And it seems as though it reverts back to whatever the original setting was. This needs to be addressed before Bulkrax.

STEPS TO REPRODUCE FROM RAILS CONSOLE

First, in the UI - login as an admin and create a work. Set the visibility to open.

# find the work you just created
work = Hyrax.query_service.find_by(id: 'id123')

# check the visibility property then update it
work.visibility => 'open'
work.visibility = 'restricted'
Hyrax.persister.save(resource: work)

# check the UI. Did the property update? => no

# ask for visibility in rails console again to confirm that it updated
work.visibility => 'restricted' # this is mislead. Find the work again and ask for visibility

saved_work = Hyrax.query_service.find_by(id: 'id123')
saved_work.visibility => 'open' # it did not update as expected

Image

Updating the visibility through the UI works though.

Original Issue: If you import a CSV on an importer and select the visibility to be open, it appears to ignore the selection.

All imported works and collections get set to private.

Image

Image

Acceptance Criteria

ShanaLMoore commented 6 months ago

https://assaydepot.slack.com/archives/C0313NKG2DA/p1710958225801659?thread_ts=1710957035.698659&cid=C0313NKG2DA

laritakr commented 6 months ago

The visibility attribute is not part of collection, so calling save on collection doesn’t save it. It feels disingenuous to have a visibility= method on the collection because that doesn’t do what is needed, but that's a bit beside the point.

The FORM has the visibility tied in, and saves the Hyrax::AccessControl through the transaction, which is where it gets updated.

ShanaLMoore commented 6 months ago

problem - we need to change the form and not just the object. per LaRita

laritakr commented 6 months ago

Confirmed that it is now working for works after a bulkrax update.

laritakr commented 6 months ago

Verified that Bulkrax update fixed issue for collections.

Tested via CSV visibility.csv

Importer specified "Public" as default

Results: Screenshot 2024-03-28 at 2 55 43 PM