[pricelist][fix] add permission to plugin
This commit is contained in:
parent
3a4e90f50e
commit
b2d8431697
|
@ -16,6 +16,7 @@ from . import pricelist_controller, permissions
|
|||
|
||||
class PriceListPlugin(Plugin):
|
||||
name = "pricelist"
|
||||
permissions = permissions.permissions
|
||||
blueprint = Blueprint(name, __name__, url_prefix="/pricelist")
|
||||
plugin = LocalProxy(lambda: current_app.config["FG_PLUGINS"][PriceListPlugin.name])
|
||||
models = models
|
||||
|
@ -186,7 +187,11 @@ def delete_extra_ingredient(identifier):
|
|||
def pricelist_settings_min_prices():
|
||||
if request.method == "GET":
|
||||
# TODO: Handle if no prices are set!
|
||||
return jsonify(PriceListPlugin.plugin.get_setting("min_prices"))
|
||||
try:
|
||||
min_prices = PriceListPlugin.plugin.get_setting("min_prices")
|
||||
except KeyError:
|
||||
min_prices = []
|
||||
return jsonify(min_prices)
|
||||
else:
|
||||
data = request.get_json()
|
||||
if not isinstance(data, list) or not all(isinstance(n, int) for n in data):
|
||||
|
@ -227,7 +232,7 @@ def get_columns(userid, current_session: Session):
|
|||
userController.persist()
|
||||
return no_content()
|
||||
|
||||
@PriceListPlugin.route("/drinks/<int:identifier>/picture", methods=["POST", "GET", "DELETE"])
|
||||
@PriceListPlugin.blueprint.route("/drinks/<int:identifier>/picture", methods=["POST", "GET", "DELETE"])
|
||||
def set_picture(identifier):
|
||||
|
||||
if request.method == "DELETE":
|
||||
|
@ -243,7 +248,7 @@ def set_picture(identifier):
|
|||
else:
|
||||
raise BadRequest
|
||||
|
||||
@PriceListPlugin.route("/picture/<identifier>", methods=["GET"])
|
||||
@PriceListPlugin.blueprint.route("/picture/<identifier>", methods=["GET"])
|
||||
def _get_picture(identifier):
|
||||
if request.method == "GET":
|
||||
size = request.args.get("size")
|
||||
|
|
Loading…
Reference in New Issue