我正在运行一个干净的Heroku& MLab安装了解析服务器(https://github.com/ParsePlatform/parse-server-example),我使用解析服务器控制板(https://github.com/ParsePlatform/parse-dashboard)控制它。
我可以进行Rest API调用&创建新的类。如何防止通过API调用(登录用户或匿名)创建新类?
目前看起来在Parse Server Dashboard中无法控制这一点。
答案 0 :(得分:5)
我在这里找到了我的问题的答案:
http://stansidel.com/2016/03/parse-server-security-considerations-and-server-updates/
设置 allowClientClassCreation ,这是解析服务器设置中的高级选项之一。
我已将 enableAnonymousUsers 设置为false,这会阻止对API的匿名调用。
index.js中相关的代码片段现在看起来如下:
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
enableAnonymousUsers: process.env.ANON_USERS || false,
allowClientClassCreation: process.env.CLIENT_CLASS_CREATION || false,
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
}
});