curl -X POST -H "Content-Type:application/json" -H "Authorization:Basic YWRtaW46aWRlYWw0ODI2" -H "Cache-Control:no-cache" -d '{ "transaction" : true, "operations" : [ { "type" : "script", "language" : "javascript", "script" : "orient.getGraph().createVertex('class:customer')" } ] }' http://localhost:2480/batch/mydb
com.orientechnologies.orient.core.exception.OSecurityException:不允许执行语言'javascript'
版本详细信息(http响应):
服务器→OrientDB服务器v.1.7.8(构建UNKNOWN @ r $ {buildNumber}; 2014-08-13 15:56:07 + 0200)
它出了什么问题!? 谢谢
答案 0 :(得分:2)
这是出于安全原因。允许JS脚本打开config/orientdb-server-config.xml
文件并更改OServerSideScriptInterpreter
组件:
<!-- SERVER SIDE SCRIPT INTERPRETER. WARNING! THIS CAN BE A SECURITY HOLE:
ENABLE IT ONLY IF CLIENTS ARE TRUCT, TO TURN ON SET THE 'ENABLED' PARAMETER
TO 'true' -->
<handler
class="com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter">
<parameters>
<parameter name="enabled" value="true"/>
<parameter name="allowedLanguages" value="SQL,Javascript"/>
</parameters>
</handler>