From 1c27ae55a03973233bcc3ea4335c7223fa79be02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98JoinTyang=E2=80=99?= Date: Sun, 25 Aug 2024 14:28:46 +0800 Subject: [PATCH] pro version can use search --- seahub/api2/endpoints/public_repos_search.py | 3 ++- seahub/api2/views.py | 3 ++- seahub/seadoc/apis.py | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/seahub/api2/endpoints/public_repos_search.py b/seahub/api2/endpoints/public_repos_search.py index f12b5e9f240..97a8c149222 100644 --- a/seahub/api2/endpoints/public_repos_search.py +++ b/seahub/api2/endpoints/public_repos_search.py @@ -10,6 +10,7 @@ from seahub.api2.authentication import TokenAuthentication from seahub.api2.throttling import UserRateThrottle +from seahub.api2.permissions import IsProVersion from seahub.api2.utils import api_error from seahub.utils.repo import is_valid_repo_id_format from seahub.utils import HAS_FILE_SEARCH, HAS_FILE_SEASEARCH @@ -25,7 +26,7 @@ class PublishedRepoSearchView(APIView): """ Search public repos """ authentication_classes = (TokenAuthentication, SessionAuthentication) - permission_classes = (IsAuthenticatedOrReadOnly,) + permission_classes = (IsAuthenticatedOrReadOnly, IsProVersion) throttle_classes = (UserRateThrottle, ) def get(self, request): diff --git a/seahub/api2/views.py b/seahub/api2/views.py index 85cb12d95a7..006341819e3 100644 --- a/seahub/api2/views.py +++ b/seahub/api2/views.py @@ -36,6 +36,7 @@ from .utils import get_diff_details, to_python_boolean, \ api_error, get_file_size, prepare_starred_files, is_web_request, \ get_groups, api_group_check, get_timestamp, json_response +from seahub.api2.permissions import IsProVersion from seahub.wopi.utils import get_wopi_dict from seahub.api2.base import APIView from seahub.api2.models import TokenV2, DESKTOP_PLATFORMS @@ -443,7 +444,7 @@ class Search(APIView): """ Search all the repos """ authentication_classes = (TokenAuthentication, SessionAuthentication) - permission_classes = (IsAuthenticated,) + permission_classes = (IsAuthenticated, IsProVersion) throttle_classes = (UserRateThrottle, ) def get(self, request, format=None): diff --git a/seahub/seadoc/apis.py b/seahub/seadoc/apis.py index 9294ac27f66..563b4d8660b 100644 --- a/seahub/seadoc/apis.py +++ b/seahub/seadoc/apis.py @@ -27,6 +27,7 @@ from seahub.views import check_folder_permission from seahub.api2.authentication import TokenAuthentication, SdocJWTTokenAuthentication +from seahub.api2.permissions import IsProVersion from seahub.api2.utils import api_error, user_to_dict, to_python_boolean, get_user_common_info from seahub.api2.throttling import UserRateThrottle from seahub.seadoc.utils import is_valid_seadoc_access_token, get_seadoc_upload_link, \ @@ -2900,6 +2901,7 @@ def post(self, request, file_uuid): class SeadocSearchFilenameView(APIView): authentication_classes = (SdocJWTTokenAuthentication, TokenAuthentication, SessionAuthentication) + permission_classes = (IsProVersion, ) throttle_classes = (UserRateThrottle,) def get(self, request, file_uuid):