仓库模块完了
This commit is contained in:
@@ -243,22 +243,3 @@ async def get_user_role_based_permissions(
|
||||
}
|
||||
|
||||
|
||||
@router.get("/check-api-key-access")
|
||||
async def check_api_key_access(
|
||||
api_key_value: str,
|
||||
algorithm_id: str,
|
||||
current_user: dict = Depends(get_current_active_user),
|
||||
db = Depends(get_db)
|
||||
):
|
||||
"""检查API密钥对算法的访问权限"""
|
||||
# 只有管理员可以检查任意API密钥的权限
|
||||
if current_user.get("role") != "admin":
|
||||
raise HTTPException(status_code=403, detail="Only admins can check API key access")
|
||||
|
||||
has_access = permission_manager.check_api_key_access(db, api_key_value, algorithm_id)
|
||||
|
||||
return {
|
||||
"api_key_valid": True, # 如果到达这里,说明API密钥存在且活跃
|
||||
"has_algorithm_access": has_access,
|
||||
"algorithm_id": algorithm_id
|
||||
}
|
||||
Reference in New Issue
Block a user