Skip to content

Commit

Permalink
editor can also create api key (langgenius#8214)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuckootan authored and lau-td committed Oct 23, 2024
1 parent 74ee5e2 commit 9e738cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/controllers/console/apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
4 changes: 2 additions & 2 deletions web/app/components/develop/secret-key/secret-key-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<CreateApiKeyResponse | undefined>(undefined)
Expand Down Expand Up @@ -142,7 +142,7 @@ const SecretKeyModal = ({
)
}
<div className='flex'>
<Button className={`flex flex-shrink-0 mt-4 ${s.autoWidth}`} onClick={onCreate} disabled={ !currentWorkspace || !isCurrentWorkspaceManager}>
<Button className={`flex flex-shrink-0 mt-4 ${s.autoWidth}`} onClick={onCreate} disabled={!currentWorkspace || !isCurrentWorkspaceEditor}>
<PlusIcon className='flex flex-shrink-0 w-4 h-4' />
<div className='text-xs font-medium text-gray-800'>{t('appApi.apiKeyModal.createNewSecretKey')}</div>
</Button>
Expand Down

0 comments on commit 9e738cb

Please sign in to comment.