修复空间权限
This commit is contained in:
parent
57bb539d4d
commit
4bc131a82c
@ -264,7 +264,8 @@ async def read_kanban(
|
||||
'children': [],
|
||||
'_id': item['_id']
|
||||
})
|
||||
res['spaces'][-1]['authority'] = 'rw' if current_user.id in item['members'] else 'r'
|
||||
authority = {item['user_id']: item['authority'] for item in item['members']}
|
||||
res['spaces'][-1]['authority'] = authority.get(current_user.id, 'r')
|
||||
|
||||
for f in await crud.folder.find_many(db, {'pid': item['_id']}):
|
||||
res['spaces'][-1]['children'].append({
|
||||
|
4
main.py
4
main.py
@ -87,12 +87,12 @@ app.add_middleware(
|
||||
|
||||
@app.exception_handler(RequestValidationError)
|
||||
async def validation_exception_handler(request, exc):
|
||||
return Response(schemas.Msg(code='-4', msg='请求错误', data=str(exc)).json(), status_code=400)
|
||||
return Response(schemas.Msg(code=-4, msg='请求错误', data=str(exc)).json(), status_code=400)
|
||||
|
||||
|
||||
@app.exception_handler(Exception)
|
||||
async def http_exception_handler(request, exc):
|
||||
return Response(schemas.Msg(code='-3', msg='服务器错误').json(), status_code=500)
|
||||
return Response(schemas.Msg(code=-3, msg='服务器错误').json(), status_code=500)
|
||||
|
||||
|
||||
@app.middleware("http")
|
||||
|
Loading…
Reference in New Issue
Block a user