用户权限 更改到v0.21版本
This commit is contained in:
parent
ab96b1658d
commit
f7dbf745b3
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue