[DSpace-CRIS] Download button & Allow authors to download restricted files#5132
[DSpace-CRIS] Download button & Allow authors to download restricted files#5132tdonohue merged 13 commits intoDSpace:mainfrom
Conversation
|
@FrancescoMolinaro : Same here, please specify in the PR description which DSpace-CRIS differences this PR implements/relates to. |
|
Hi @FrancescoMolinaro, |
|
@FrancescoMolinaro : Just to verify, does this PR require any backend PR? Or is it standalone? It's unclear to me whether this requires specific backend changes to work. |
|
Hi @tdonohue , sorry for missing to specify it, this PR is mainly a UI variant of the normal link and it is indeed standalone. |
|
@aprilherron General reminder for all new feature PRs currently under review: there is still a possibility of getting this into 10.0, in case you have the capacity to complete the review at the moment. Feature merge deadline will be Friday 3/27. Thank you! |
|
Review notes: Config syntaxFeature is enabled by default. Tests
|
|
Hi @aprilherron , thanks for the feedback, I have set the property as false by default so that the new layout will be optional. In addition I have also fixed the issue with the missing default download link and implemented some test to enforce the behavior, now it should work as expected, thanks again for the review. |
|
@aprilherron : If you can find time to rereview this (based on the updates), I'd appreciate it. Please also remember to explicitly give the PR a "+1" if you feel it's working well and ready to be merged. @FrancescoMolinaro : I've yet to review/test this, but we may want to consider enabling this by default if it accurately fixes #3384 (as that's a long standing accessibility/usability issue). That said, I'll try to give this a test tomorrow to see if this should be enabled by default. |
aprilherron
left a comment
There was a problem hiding this comment.
Bug in untyped-item view has been addressed. This PR looks good to be merged 👍
src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html
Outdated
Show resolved
Hide resolved
|
@FrancescoMolinaro I ran some response time performance tests on your branch, because I recently worked on a similar area of the code (#5028). I found out that your new code runs much faster on larger page sizes with Could you maybe explain a bit what you are doing with this bitstream route guard, and if we could also use it for the 'normal' bitstream download links? Here is a diagram from my performance tests, so that you can see how much better the new feature performs: |
|
Hi @FrancescoMolinaro, |
|
@FrancescoMolinaro : Could you quickly rebase this PR? It appears to have gained merge conflicts after the merger of #5112 |
|
Hi @tinsch , thanks for the feedback much appreciated, the bitstream route guard is currently already active for all the downloads as it runs on the download page indipendently from the property showDownloadLinkAsAttachment. I believe that what makes the file-download-link.component.html slow to render on pages, is the template of the component itself, which creates many unnecessary subscriptions, creating the risk of memory leaks. I have made a commit to change this as I think is a good improvment in any case, you can check the last commit of this PR for confirmation on your tests, hopefully performaces will be better also with the property set to false. |
|
Thanks a lot! I will look into it and retest it 👍 |
tdonohue
left a comment
There was a problem hiding this comment.
@FrancescoMolinaro : I gave this a review and test today. Overall, it works, but I've found some issues in the code which I think need cleanup/correction (see inline below).
I also have a few basic questions here:
- I don't understand how to configure
advancedAttachmentRendering > metadatafields, as the examples provided inconfig.example.ymlseem to be invalid. - I also don't see how this PR is providing authors with the ability to download restricted files. Is that provided via a backend PR? If so, which backend PR does this feature require?
I have been able to verify that the basics of rendering bitstreams in a list with a download button works properly.
I ran the performance tests again, and the results are nearly the same now with and without the new |
|
Hi @tdonohue , regarding the functionality that makes possible for authors to download restricted files the logic can be found on DSpace/DSpace#11964, it has been included in the same PR of the edit in submission style. I will update the description adding this information. |
tdonohue
left a comment
There was a problem hiding this comment.
@FrancescoMolinaro : Thanks for all the updates! I'm nearly a +1 to this PR. Almost everything works well. However, I'm not able to get the metadata settings to work properly. See inline comment below.
| - name: dc.title | ||
| type: metadata | ||
| truncatable: false | ||
| - name: dc.type |
There was a problem hiding this comment.
These metadata settings don't appear to work for me? For example, if I remove some of the fields like this:
layout:
showDownloadLinkAsAttachment: true
metadata:
- name: dc.title
type: metadata
truncatable: false
- name: format
type: attribute
I'd expect to then no longer see the checksum and size in the display. However, I still see the same display as before.
Am I misunderstanding how these settings should work?
There was a problem hiding this comment.
Hi @tdonohue , I think you are missing a level of the configuration, the metadata config are inside the advancedAttachmentRendering property, I have tested with the following config and seems working as expected:
layout:
showDownloadLinkAsAttachment: true
advancedAttachmentRendering:
metadata:
- name: dc.title
type: metadata
truncatable: false
- name: format
type: attribute
There was a problem hiding this comment.
Ah, my mistake! I'll retest today then and get this PR merged
There was a problem hiding this comment.
Thanks @FrancescoMolinaro ! I retested today and verified it works well (now that I'm using the correct configuration)! Thanks again for correcting my mistake :)
tdonohue
left a comment
There was a problem hiding this comment.
👍 Thanks @FrancescoMolinaro ! This all looks great to me now. Retested today and it's all working well.
As with all other DSpace-CRIS merger PRs, I'm flagging this with "needs documentation" until documentation can be added to https://wiki.lyrasis.org/display/DSDOC10x

References
Description
Add new way of rendering download link in item page, the new UI component can be activated via the config:
showDownloadLinkAsAttachment
inside the layout config in default.app.config.ts.
This PR adds a route guard that allows to run the required authorization checks also on direct download links, supporting in this way the Feature differences #13, which has been implemented on DSpace/DSpace#11964 , even though is not strictly depending on that rest PR.
The metadata to be visualized in the attachment box are handled with a separated config param:
advancedAttachmentRendering
Which allows granural control on which information to show in the template.
In addition a new route guard has been added for the bitstream download path, so that we can check the authorization before loading the page and handle in advance eventual authorizations needed.
On the rest side the canDownload authorization feature will be enhanced to allow authors the download of restricted items.
Instructions for Reviewers
The new config has been set as true for the time being so that every link in item page will be displayed with the new component.
The positioning was also adapted from the left side of the page to the right one, so to use the wider space for the additional informations.
List of changes in this PR:
Add new UI component and related configs
Add new guard for bitsream download path
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.