invenio-app-ils
invenio-app-ils copied to clipboard
Relations with restricted documents visible
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.
- Change
relations_metadata
to add therestricted
field along with the doctitle
, etc..., at least whenTrue
- Change the document serializer to remove the on-the-fly the relation to the restricted document if the user is not authorized
- Change the search filter in the backend to exclude the search in
relations_metadata.document
whenrelations_metadata.document.restricted: True
and the user is not authorized