mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-18 14:10:30 +00:00
Bugfix create shelf for users not allowed to create public shelfs
This commit is contained in:
parent
e880238cb9
commit
d084a06e63
@ -224,10 +224,6 @@ def remove_from_shelf(shelf_id, book_id):
|
|||||||
@shelf.route("/shelf/create", methods=["GET", "POST"])
|
@shelf.route("/shelf/create", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def create_shelf():
|
def create_shelf():
|
||||||
if not current_user.role_edit_shelfs() and request.method == 'POST':
|
|
||||||
flash(_(u"Sorry you are not allowed to create a public shelf"), category="error")
|
|
||||||
return redirect(url_for('web.index'))
|
|
||||||
else:
|
|
||||||
shelf = ub.Shelf()
|
shelf = ub.Shelf()
|
||||||
return create_edit_shelf(shelf, page_title=_(u"Create a Shelf"), page="shelfcreate")
|
return create_edit_shelf(shelf, page_title=_(u"Create a Shelf"), page="shelfcreate")
|
||||||
|
|
||||||
@ -249,6 +245,9 @@ def create_edit_shelf(shelf, page_title, page, shelf_id=False):
|
|||||||
# calibre_db.session.query(ub.Shelf).filter(ub.Shelf.user_id == current_user.id).filter(ub.Shelf.kobo_sync).count()
|
# calibre_db.session.query(ub.Shelf).filter(ub.Shelf.user_id == current_user.id).filter(ub.Shelf.kobo_sync).count()
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
to_save = request.form.to_dict()
|
to_save = request.form.to_dict()
|
||||||
|
if not current_user.role_edit_shelfs() and to_save.get("is_public") == "on":
|
||||||
|
flash(_(u"Sorry you are not allowed to create a public shelf"), category="error")
|
||||||
|
return redirect(url_for('web.index'))
|
||||||
shelf.is_public = 1 if to_save.get("is_public") else 0
|
shelf.is_public = 1 if to_save.get("is_public") else 0
|
||||||
if config.config_kobo_sync:
|
if config.config_kobo_sync:
|
||||||
shelf.kobo_sync = True if to_save.get("kobo_sync") else False
|
shelf.kobo_sync = True if to_save.get("kobo_sync") else False
|
||||||
|
Loading…
Reference in New Issue
Block a user