问题
I want to allow users to remove an object from a parse-server database that they created (at some later, desired time).
The object is created in the DB fine, and the .deleteInBackground()
command works fine to delete object if I, manually, first set the ACL for that object to allow public writing.
As a default, the user that created the object is allowed to read AND write to it,
yet (despite being logged on) the below function returns an error to the logs in xcode because the user doesn't have permission (the specific error is that the object is not found... but I have deduced this is due to the ACL and manually setting the ACL to allow public writing gets rid of this issue) to remove it.
let removingObjectQuery = PFQuery(className: "GoingTo")
removingObjectQuery.whereKey("objectId", equalTo: goingToSelectionID)
removingObjectQuery.findObjectsInBackground(block: { (object, error) in
if let objects = object{
print("Object found")
for object in objects{
object.deleteInBackground()
}
}
})
Why can the object only be deleted if public writing is enabled, despite the user that is logged on having writing privilege on the ACL for that specific object?
来源:https://stackoverflow.com/questions/39844324/pfuser-that-created-object-cannot-delete-object-despite-acl-writing-access