invenio-app-ils icon indicating copy to clipboard operation
invenio-app-ils copied to clipboard

Relations with restricted documents visible

Open kpsherva opened this issue 4 years ago • 0 comments

Package version (if known): v1.0.0a27

Describe the bug

The relation between documents, one restricted, one not restricted is still visible on the frontsite, while the point of having the restricted document was to hide it from the patrons.

Expected behavior

We should filter out the restricted documents to be visible in the relation fields

Possible implementation

Currently, the restricted field is only taken into account when searching for documents, and not in relations.

  1. Change relations_metadata to add the restricted field along with the doc title, etc..., at least when True
  2. Change the document serializer to remove the on-the-fly the relation to the restricted document if the user is not authorized
  3. Change the search filter in the backend to exclude the search in relations_metadata.document when relations_metadata.document.restricted: True and the user is not authorized

kpsherva avatar Feb 12 '21 15:02 kpsherva