FastAPI - Authentication and Security
Examine this FastAPI role check dependency and identify the mistake:
async def check_admin(user: User = Depends(get_current_user)):
if user.role != 'admin':
return HTTPException(status_code=403)
@app.get('/admin')
async def admin_panel(dep=Depends(check_admin)):
return {'msg': 'Welcome admin'}