Commit eb25c449 authored by wang.wenrong's avatar wang.wenrong

debug_login_auth

parent d3b3699e
Subproject commit 05cfad9387871294a0215dabeccad37adbc487e3
Subproject commit a878a1f82788f11deea04f8e64f668a83ed3a449
......@@ -21,7 +21,7 @@ def authorized():
# run some method that checks the request
# for the client's authorization status
is_authorized = await user_product_auth.check_user_auth(request)
if is_authorized:
# the user is authorized.
# run the handler method and return the response
......@@ -30,9 +30,9 @@ def authorized():
else:
# the user is not authorized.
return json({'status': 'not_authorized'}, 403)
return decorated_function
return decorator
......@@ -42,62 +42,69 @@ async def get_test(request):
def is_need_verify(path):
# return False
if SETTING.debug_mode == 1:
return False
if "swagger" in path:
return False
log.info("is_or_not_need_verify path:%s", path)
if "swagger" in path:
return False
if re.match("^/unify-api/auth/?$", path):
log.info("auth not need verify")
return False
if re.match("^/unify-api/upgrade/?", path):
log.info("upgrade device not need verify")
return False
if re.match("^/unify-api/uassistant/?", path):
log.info("uassistant not need verify")
return False
if re.match("^/unify-api/device-cloud/?", path):
log.info("device_cloud not need verify")
return False
if re.match("^/unify-api/users/current-user-info/send-sms?", path):
log.info("send-sms not need verify")
return False
if re.match("^/unify-api/users/current-user-info/save-userinfo?", path):
log.info("save-userinfo not need verify")
return False
if re.match("^/unify-api/users/current-user-info/auth-phone?", path):
log.info("auth-phone not need verify")
return False
if re.match("^/unify-api/users/current-user-info/back-password?", path):
log.info("back-password not need verify")
return False
if re.match("^/unify-api/users/current-user-info/update-password?", path):
log.info("update-password not need verify")
return False
if re.match("^/api/common/wechat/mp", path):
log.info("/api/common/wechat/mp not need verify")
return False
if re.search("/qk-website", path):
log.info(f"{path} not need verify")
return False
# if re.match("^/unify-api/users/logout/user-logout/?$", path):
# log.info("logout not need verify")
# return False
return True
async def auth_verify(request):
if SETTING.debug_mode == 1:
return False
path = request.path
if is_need_verify(path):
token = request.token
......@@ -136,6 +143,10 @@ async def auth_verify(request):
def is_need_auth_verify_cid(path):
if SETTING.debug_mode == 1:
return False
if "swagger" in path:
return False
if re.match("^/unify-api/auth/", path):
return False
if re.match("^/api/common/wechat/mp", path):
......@@ -148,6 +159,8 @@ def is_need_auth_verify_cid(path):
async def auth_verify_cid(request):
"""增加工厂权限校验"""
if SETTING.debug_mode == 1:
return False
path = request.path
# if not re.match("^/unify-api/auth/?$", path):
if is_need_auth_verify_cid(path):
......@@ -191,7 +204,7 @@ async def auth_verify_cid(request):
# if cid_info:
# cid_res_list = [int(cid) for cid in cid_info.get("product")]
# else:
# cid_res_list = await get_cids(user_id, product)
# 2.3 参数中的cid_args
cid_args = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment