【发布时间】:2015-10-02 17:17:44
【问题描述】:
我正在尝试为通过 Parse REST API 创建的对象设置 ACL 权限。我希望它只有公共读取权限。只有服务器可以创建或修改类中的对象。我阅读了有关如何设置 ACL 权限的解析 REST 文档。
当我运行以下命令时:
$InputData = array('votes' => 1, 'ACL' => array('*' => array('read' => true, 'write' => false)), 'user' => array('__type' => 'Pointer', 'className' => '_User', 'objectId' => $objectId));
$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,$url);
curl_setopt($rest,CURLOPT_PORT,443);
curl_setopt($rest,CURLOPT_POST,1);
curl_setopt($rest,CURLOPT_POSTFIELDS, json_encode($InputData));
curl_setopt($rest,CURLOPT_HTTPHEADER,
array("X-Parse-Application-Id: " . $appId,
"X-Parse-Master-Key: " . $restKey,
"Content-Type: application/json"));
我明白了:
{"code":123,"error":"Invalid acl {\"*\":{\"read\":false,\"write\":false}}"} 1
我的代码有什么问题,特别是 ACL 部分?救命!
【问题讨论】:
标签: rest curl parse-platform