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

show pdf location restriction banner per file #2748

Merged
merged 3 commits into from
Mar 5, 2025
Merged

show pdf location restriction banner per file #2748

merged 3 commits into from
Mar 5, 2025

Conversation

hudajkhan
Copy link
Contributor

@hudajkhan hudajkhan commented Mar 5, 2025

Closes #2360

What this pull request does:

  • Sets up a location restricted banner that is hidden when the page loads
  • Changes the logic for when the viewer is available. It is now true unless the status for the first file is "not downloadable"
  • Sets up the file auth controller to check the location restriction message from stacks, and then show the location restriction banner and update the message to be the one returned from stacks

Note: This should work in staging, but the stacks changes will need to be pushed to production first for these embed changes to work in production

@@ -9,6 +9,7 @@

<% component.with_authorization_messages do %>
<%= render LoginComponent.new %>
<%= render LocationRestrictionComponent.new %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we combine LoginComponent and LocationRestrictionComponent and call it AuthMessages. Maybe we want to wait until this is in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We just talked and agreed we can wait on that change until later, but that sounds like a good idea for subsequent work.

@hudajkhan hudajkhan marked this pull request as ready for review March 5, 2025 19:04
// If the location restriction target is available, then trigger auth denied message.
// The event will lead to the locked icon being displayed for this item
// This allows the lock window to show
const event = new CustomEvent('auth-denied', { accessService: accessService })
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should stuff the location restricted message in this event. Then we can have a controller devoted to displaying these messages, and this controller would not have to deal with this

Copy link
Contributor

Choose a reason for hiding this comment

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

This can be a follow-on PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that approach makes sense and it would be fine to do in a follow up PR. @dnoneill and I were also discussing the other cases (embargo etc.) so it makes sense to have that logic in its own event/controller framework.

def available?
document_resource_files.first&.downloadable?
!document_resource_files.first&.no_download?
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still not clear on why we need this at all. Can't we just run this all through the IIIF auth?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The PDF Component html will not show the viewer at all if the "viewer.available?" is false. Instead, it will just show a "content not available" section. This change ensures the content not available section is not displayed unless the first file is a "no download" option. If we want to change that logic, I'd suggest tackling that in a different issue because there is probably more to streamline here (or to work out).

@jcoyne jcoyne merged commit 963e7a8 into main Mar 5, 2025
2 checks passed
@jcoyne jcoyne deleted the pdfLocationRedo branch March 5, 2025 19:59
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.

Location-restricted PDFs do not display in the PDF viewer even at an authorized location
3 participants