added access control to energycategory

pull/81/head
tianlinzhong 2021-11-23 11:29:36 +08:00
parent a8fec3a7dd
commit d7cad1d6e0
1 changed files with 2 additions and 0 deletions

View File

@ -150,6 +150,7 @@ class EnergyCategoryItem:
@staticmethod
@user_logger
def on_delete(req, resp, id_):
access_control(req)
if not id_.isdigit() or int(id_) <= 0:
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_ENERGY_CATEGORY_ID')
@ -232,6 +233,7 @@ class EnergyCategoryItem:
@user_logger
def on_put(req, resp, id_):
"""Handles PUT requests"""
access_control(req)
try:
raw_json = req.stream.read().decode('utf-8')
except Exception as ex: