Skip to content

Authentication does not work inside opds.py #1661

Description

@timholl

Describe the bug/problem
Currently, I am unable to download any books to my mobile reader via OPDS catalog.

I found that via the @download_required annotation on opds.py line 386, a function download_required in web.py is called, which returns a 403 - Forbidden if current_user.role_download() is not true.
As far as I can see, for OPDS current_user is always Guest (because authentication is done via HTTP Basic Authentication, if any).
So even for non-anonymous OPDS I have to give the Guest user the download permission.

Furthermore, as far as I can see, the Guest user is created on demand (create_anonymous_user in ub.py), but without the download permission, so download via OPDS is effectively disabled by default.

  1. Is this intended? If yes, is it documented how to enable it?
  2. The Guest user is hidden in the user list, so the best solution I came up with is guessing the Guest users ID in /admin/user/X. Is there a better way to edit the Guest user or is this the intended one?

To Reproduce
Steps to reproduce the behavior:

  1. Try to download via OPDS from any device.

Logfile
Add content of calibre-web.log file or the relevant error, try to reproduce your problem with "debug" log-level to get more output.

None

Expected behavior
A clear and concise description of what you expected to happen.

Download should be possible or it should be documented that the Guest user requires download permission.

Screenshots
If applicable, add screenshots to help explain your problem.

None

Environment (please complete the following information):

  • OS: Debian 10
  • Python version: Python 3.7.3<
  • Calibre-Web version: currentmaster (e16c0caebb93244d3ad1d2482553cc84d762c089)
  • Docker container: None
  • Special Hardware: LXC
  • Browser: [e.g. Chrome 83.0.4103.97, Safari 13.3.7, Firefox 68.0.1 ESR]

Additional context
Add any other context about the problem here. [e.g. access via reverse proxy, database background sync, special database location]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions