From 53ce536572baa0920a22246e86e8712972cf42c1 Mon Sep 17 00:00:00 2001 From: Jason Tan Date: Wed, 11 Sep 2024 16:07:15 +0800 Subject: [PATCH] editor can also create api key (#8214) --- api/controllers/console/apikey.py | 2 +- web/app/components/develop/secret-key/secret-key-modal.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/controllers/console/apikey.py b/api/controllers/console/apikey.py index 3f5e1adca2379..35ac42a14cbfe 100644 --- a/api/controllers/console/apikey.py +++ b/api/controllers/console/apikey.py @@ -57,7 +57,7 @@ def get(self, resource_id): def post(self, resource_id): resource_id = str(resource_id) _get_resource(resource_id, current_user.current_tenant_id, self.resource_model) - if not current_user.is_admin_or_owner: + if not current_user.is_editor: raise Forbidden() current_key_count = ( diff --git a/web/app/components/develop/secret-key/secret-key-modal.tsx b/web/app/components/develop/secret-key/secret-key-modal.tsx index fd28a67e7eb42..dbb5cc37c724e 100644 --- a/web/app/components/develop/secret-key/secret-key-modal.tsx +++ b/web/app/components/develop/secret-key/secret-key-modal.tsx @@ -41,7 +41,7 @@ const SecretKeyModal = ({ }: ISecretKeyModalProps) => { const { t } = useTranslation() const { formatTime } = useTimestamp() - const { currentWorkspace, isCurrentWorkspaceManager } = useAppContext() + const { currentWorkspace, isCurrentWorkspaceManager, isCurrentWorkspaceEditor } = useAppContext() const [showConfirmDelete, setShowConfirmDelete] = useState(false) const [isVisible, setVisible] = useState(false) const [newKey, setNewKey] = useState(undefined) @@ -142,7 +142,7 @@ const SecretKeyModal = ({ ) }
-