Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: 文档导出权限错误 #1807

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dataset/views/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def put(self, request: Request, dataset_id: str, document_id: str):
return result.success(
DocumentSerializers.Operate(data={'document_id': document_id, 'dataset_id': dataset_id}).cancel(
request.data
))
))

class Refresh(APIView):
authentication_classes = [TokenAuth]
Expand Down Expand Up @@ -309,7 +309,7 @@ class Export(APIView):
manual_parameters=DocumentSerializers.Operate.get_request_params_api(),
tags=["知识库/文档"])
@has_permissions(
lambda r, k: Permission(group=Group.DATASET, operate=Operate.USE,
lambda r, k: Permission(group=Group.DATASET, operate=Operate.MANAGE,
dynamic_tag=k.get('dataset_id')))
def get(self, request: Request, dataset_id: str, document_id: str):
return DocumentSerializers.Operate(data={'document_id': document_id, 'dataset_id': dataset_id}).export()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个代码文件包含一个错误:DatasetSerializers.Operators.cancel().get_request_params()应该使用 DatasetSerializers.Operate(). 同样,Refresh类需要添加 Permission, 可能有缺失的权限设置,以及可能需要更新为更合理的API URL。另外,所有的方法和函数名称在Python中已经统一成了驼峰式命名法。因此,整体来说这是标准的Java风格问题,但需要调整以符合PascalCase或CamelCase规则。

Expand Down
Loading