Add Authorization checks (#2218)

### What problem does this PR solve?

Add Authorization checks
#2203

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

Co-authored-by: Feiue <10215101452@stu.ecun.edu.cn>
This commit is contained in:
LiuHua 2024-09-03 16:28:46 +08:00 committed by GitHub
parent 2871455e4e
commit 0aafa281a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,10 +100,10 @@ def update():
def detail(): def detail():
kb_id = request.args["kb_id"] kb_id = request.args["kb_id"]
try: try:
tenants = TenantService.get_joined_tenants_by_user_id(current_user.id) tenants = UserTenantService.query(user_id=current_user.id)
for m in tenants: for tenant in tenants:
if KnowledgebaseService.query( if KnowledgebaseService.query(
tenant_id=m["tenant_id"], id=kb_id): tenant_id=tenant.tenant_id, id=kb_id):
break break
else: else:
return get_json_result( return get_json_result(