wellcomecollection.org icon indicating copy to clipboard operation
wellcomecollection.org copied to clipboard

User role

Open gestchild opened this issue 5 months ago • 1 comments

What does this change?

For #5762

  • adds the users role to UserInfo
  • passes the users role to the showItemLink function, which determines whether we should display a link to the item page
  • if the user has a role of 'StaffWithRestricted' the link will show, if not, or the user is logged out, then the link will not show

Also for #11014

  • adds another conditional around the Available Online section, so it won't show if the item is restricted and the user doesn't have the 'StaffWithRestricted' role.

How to test

  • run the site with yarn run-concurrently
  • Visit a works page which has a restricted item while logged out and see that no link to the item page is displayed
  • Visit a works page which has a restricted item while logged in with a user that doesn't have a role of 'StaffWithRestricted' and see that no link to the item page is displayed
  • Visit a works page which has a restricted item while logged in with a user that does have a role of 'StaffWithRestricted' and see that a link to the item page is displayed (you will have to watch me do this)

How can we measure success?

Staff with a role of 'StaffWithRestricted' are presented with a link to the item page for restricted items, everyone else is not.

Have we considered potential risks?

What will happen if the user follows the link to the item page (before we've done the rest of the auth work)?

  • If the item page would have displayed the viewer, then it will display a modal telling the user that the item is restricted
  • If the item page would have displayed an audio/video player, it still will but pressing play won't work as the audio/video file won't load.
  • Ashley said that all PDFs are open, so nothing will change for these.
  • For Born digital things that contain audio or video (http://localhost:3000/works/h3qjfr87) the link still won't show because of the presence of those files types. (One of the reasons why displaying everything in the viewer will make life easier).
  • For Born digital items that don't contain audio and video, the link will show but the item page will be blank.

These behaviours might be annoying, but as this will be temporary and since hardly anyone has the correct role, I don't think this is a problem.

gestchild avatar Oct 02 '24 13:10 gestchild