diff --git a/user/user_auth.py b/user/user_auth.py index 4d61bd4..b10a0a8 100644 --- a/user/user_auth.py +++ b/user/user_auth.py @@ -76,15 +76,21 @@ def authority_scope(scope): @functools.wraps(func) def internal(*args, ** kwargs): - records = FIND_DATA("用户", "用户信息", {"UID": kwargs['uid']}) + db = MongoHelper("tfse_v0.21") + records = db.find_single_data( + "管理端", + "用户", + {"UID": kwargs['uid']}, + ['status', 'role'] + ) if not records: return {"info": "提示: 账户不存在"}, 401 - if records[0]['status'] != "normal": + if records['status'] != "normal": return {"info": "提示: 账户已被禁用"}, 401 - if records[0]['role'] not in scope: + if records['role'] not in scope: return {"info": "提示: 没有此项操作权限"}, 401 return func(*args, ** kwargs)