Explorar el Código

editor can also create api key (#8214)

tags/0.8.1
Jason Tan hace 1 año
padre
commit
c5b3777d93
No account linked to committer's email address

+ 1
- 1
api/controllers/console/apikey.py Ver fichero

def post(self, resource_id): def post(self, resource_id):
resource_id = str(resource_id) resource_id = str(resource_id)
_get_resource(resource_id, current_user.current_tenant_id, self.resource_model) _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() raise Forbidden()


current_key_count = ( current_key_count = (

+ 2
- 2
web/app/components/develop/secret-key/secret-key-modal.tsx Ver fichero

}: ISecretKeyModalProps) => { }: ISecretKeyModalProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const { formatTime } = useTimestamp() const { formatTime } = useTimestamp()
const { currentWorkspace, isCurrentWorkspaceManager } = useAppContext()
const { currentWorkspace, isCurrentWorkspaceManager, isCurrentWorkspaceEditor } = useAppContext()
const [showConfirmDelete, setShowConfirmDelete] = useState(false) const [showConfirmDelete, setShowConfirmDelete] = useState(false)
const [isVisible, setVisible] = useState(false) const [isVisible, setVisible] = useState(false)
const [newKey, setNewKey] = useState<CreateApiKeyResponse | undefined>(undefined) const [newKey, setNewKey] = useState<CreateApiKeyResponse | undefined>(undefined)
) )
} }
<div className='flex'> <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' /> <PlusIcon className='flex flex-shrink-0 w-4 h-4' />
<div className='text-xs font-medium text-gray-800'>{t('appApi.apiKeyModal.createNewSecretKey')}</div> <div className='text-xs font-medium text-gray-800'>{t('appApi.apiKeyModal.createNewSecretKey')}</div>
</Button> </Button>

Cargando…
Cancelar
Guardar