We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6aad937 commit bcdc976Copy full SHA for bcdc976
cps/shelf.py
@@ -224,8 +224,13 @@ def remove_from_shelf(shelf_id, book_id):
224
@shelf.route("/shelf/create", methods=["GET", "POST"])
225
@login_required
226
def create_shelf():
227
- shelf = ub.Shelf()
228
- return create_edit_shelf(shelf, page_title=_(u"Create a Shelf"), page="shelfcreate")
+ 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")
229
+ return redirect(url_for('web.index'))
230
+ else:
231
+ shelf = ub.Shelf()
232
+ return create_edit_shelf(shelf, page_title=_(u"Create a Shelf"), page="shelfcreate")
233
+
234
235
236
@shelf.route("/shelf/edit/<int:shelf_id>", methods=["GET", "POST"])
0 commit comments