2016-03-15 58 views
2

我从迁移的Parse.com应用程序(托管),以自托管*解析服务器实施(https://github.com/ParsePlatform/parse-server)。如何使用Parse Server设置类级权限?

我的应用在很大程度上依赖于类级别的权限,这样,例如,全局设置可以被所有用户使用公共密钥读取而不能编辑或无主键删除。

在Parse.com这些权限在仪表板配置的,但开源的解析服务器没有仪表盘。也许有一些方法可以使用云代码来做到这一点?

*我使用App Engine的管理VM环境虽然我不知道这是相关的。

回答

2

我发现MongoDB的数据存储中的_SCHEMA表,它包含了我一直在寻找的CLP。显然,这是他们存储的地方,他们与Parse.com的其余数据一起被迁移。我已经证实,更新这些值会影响数据的访问权限

1

使用RESTful的API

https://parseplatform.github.io/docs/parse-server/guide/#class-level-permissions

// PUT http://localhost:1337/schemas/:className 
// Set the X-Parse-Application-Id and X-Parse-Master-Key header 
// body: 
{ 
    classLevelPermissions: 
    { 
    "find": { 
     "requiresAuthentication": true, 
     "role:admin": true 
    }, 
    "get": { 
     "requireAuthentication": true, 
     "role:admin": true 
    }, 
    "create": { "role:admin": true }, 
    "update": { "role:admin": true }, 
    "delete": { "role:admin": true }, 
    } 
}