refactor(api-logging):暂时删除权限校验与日志记录
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
#
|
||||
MYSQL_HOST = '127.0.0.1'
|
||||
MYSQL_PORT = '3306'
|
||||
MYSQL_DATABASE = 'PearAdminFlask'
|
||||
MYSQL_USERNAME = 'root'
|
||||
MYSQL_PASSWORD = 'root'
|
||||
|
||||
MYSQL_DB_URI = "mysql+pymysql://{username}:{password}@{host}:{port}/{db}?charset=utf8".format(username=USERNAME,
|
||||
password=PASSWORD,
|
||||
host=HOST,
|
||||
port=PORT,
|
||||
db=DATABASE)
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = MYSQL_DB_URI
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||
SQLALCHEMY_ECHO = False
|
||||
SQLALCHEMY_POOL_RECYCLE = 8
|
||||
@@ -59,24 +59,3 @@ def permission_required(permission: str) -> t.Callable:
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def authorize(power: str, log: bool = False):
|
||||
def decorator(func):
|
||||
@login_required
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
if power not in session.get('permissions'):
|
||||
if log:
|
||||
record_logging()
|
||||
if request.method == 'GET':
|
||||
abort(403)
|
||||
else:
|
||||
return jsonify(success=False, msg="权限不足!")
|
||||
if log:
|
||||
record_logging()
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
Reference in New Issue
Block a user