Reputation: 14070
As I understand it, I can auto-populate the ACL
column in any newly-added records in Parse by setting this:
PFACL.setDefaultACL(PFACL(), withAccessForCurrentUser: true)
Is there a way to always perform queries using PFUser.currentUser()
as a filter by default? Or do I have to specify the user with every query?
query.whereKey("user", equalTo: PFUser.currentUser()!)
Thanks in advance.
Upvotes: 1
Views: 558
Reputation: 14070
It turns out that I don't need to specify the currentUser()
or the ACL
at all. It happens automatically as long as a PFUser
is logged in.
See here for reference: https://parse.com/questions/query-for-tableview-specifying-an-acl
Upvotes: 1
Reputation: 6114
I think there is no such features in Parse
SDK. But you can always use swift features like extensions to add required functional:
extension PFQuery {
class func userQueryForClassName(className: String) -> PFQuery {
let query = PFQuery(className: className)
query.whereKey("user", equalTo: PFUser.currentUser()!)
return query;
}
}
let query = PFQuery.userQueryForClassName("test")
Upvotes: 1