Parse.com在云功能上设置ACL

时间:2015-04-08 20:53:04

标签: javascript parse-platform acl

我可以使用下面的代码设置setPublicReadAccess但是我只想将ACL锁定给用户。

Parse.Cloud.beforeSave("Programme", function(request, response) {
  Parse.Cloud.useMasterKey();

  var publicReadACL = new Parse.ACL();
  publicReadACL.setPublicReadAccess(true);

  request.object.setACL(publicReadACL);
  response.success();
});

我也试过

Parse.Cloud.afterSave("Programme", function(request) {
  var user = Parse.User.current();
  if(typeof request.object.getACL() === "undefined") {
    var newACL = new Parse.ACL();
    newACL.setReadAccess(user.id,true);
    newACL.setWriteAccess(user.id,true);

    request.object.setACL(newACL);
    request.object.save();
  }
}); 

哪个也不起作用。

1 个答案:

答案 0 :(得分:3)

ParseObject的ACL可能已经初始化,因此您应该使用Option Base 1 Public Function FunctionValues(rng As Range) As Variant Dim i As Integer Dim j As Integer Dim NumCols As Integer Dim NumRws As Integer NumCols = rng.Columns.Count NumRws = rng.Rows.Count Dim FX() As Double ReDim FX(NumCols, NumRws) For i = 1 To NumCols For j = 1 To NumRws x = rng.Columns(i).Rows(j) FX(i, j) = x ^ 2 + 1 / 3 * x + 5 Next j Next i FunctionValues = FX() End Function 而不是request.object.existed() == false

此外,如果您不希望自己的对象公开,则必须typeof request.object.getACL() === "undefined"newACL.setPublicReadAccess(false);

它对我有用

newACL.setPublicWriteAccess(false);