fix: Fix user cannot export public function lib#2394
Conversation
--bug=1052408 --user=刘瑞斌 【函数库】导出非当前用户创建的函数,报错 https://www.tapd.cn/57709429/s/1658696
| if not QuerySet(FunctionLib).filter(id=self.data.get('id')).exists(): | ||
| raise AppApiException(500, _('Function does not exist')) | ||
|
|
||
| def delete(self, with_valid=True): |
There was a problem hiding this comment.
There is an issue in the provided code. The filter method uses incorrect arguments in the second line of the function. It should be compared to all users' IDs (user_id__in=self.data.get('user_id', [])) instead of directly comparing the entire user object.
Here's the corrected version:
def delete(self, with_valid=True):This change will fix the comparison logic so that it only deletes records where the ID matches exactly. Without knowing more about your application's database schema and how data types can vary, this adjustment assumes you want exact match checks which might not always be desirable depending on specific use cases or requirements.
If you need additional error handling or validation based on complex queries and relationships within FunctionLib, further refinement would be needed in these contexts.
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
fix: Fix user cannot export public function lib --bug=1052408 --user=刘瑞斌 【函数库】导出非当前用户创建的函数,报错 https://www.tapd.cn/57709429/s/1658696