mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-26 01:50:31 +00:00
Fix #1739 (opds download with anonymous browsing enabled) -> download rights of guest user are now respected again
This commit is contained in:
parent
cb8dfdde4c
commit
c3b9888b31
@ -387,8 +387,8 @@ def opds_download_link(book_id, book_format):
|
|||||||
# I gave up with this: With enabled ldap login, the user doesn't get logged in, therefore it's always guest
|
# I gave up with this: With enabled ldap login, the user doesn't get logged in, therefore it's always guest
|
||||||
# workaround, loading the user from the request and checking it's download rights here
|
# workaround, loading the user from the request and checking it's download rights here
|
||||||
# in case of anonymous browsing user is None
|
# in case of anonymous browsing user is None
|
||||||
user = load_user_from_request(request)
|
user = load_user_from_request(request) or current_user
|
||||||
if not user or not user.role_download():
|
if not user.role_download():
|
||||||
return abort(403)
|
return abort(403)
|
||||||
if "Kobo" in request.headers.get('User-Agent'):
|
if "Kobo" in request.headers.get('User-Agent'):
|
||||||
client = "kobo"
|
client = "kobo"
|
||||||
|
Loading…
Reference in New Issue
Block a user