Im currently running into a problem with users having access to objects of another user in my app.
I know how to set the ACL when a user creates an object when they are already logged into the app, but I don't know how to set the ACL for someone signing up. When i set a navigation title to display the ["BusinessName"] column of a user, I receive business names from another created users column....thanks for your help!! greatly appreciated!
@IBAction func signupFinalButton(sender: AnyObject) {
var newUser = PFUser()
newUser.username = username
newUser.password = password
newUser.email = email
newUser["FirstName"] = firstName
newUser["LastName"] = lastName
newUser["BusinessName"] = businessName
newUser["City"] = city
newUser["State"] = state
// This isn't seeming to work...
newUser.ACL = PFACL(user: PFUser.currentUser()!)
or this
newUser.ACL = PFACL(user: PFUser())
newUser.signUpInBackgroundWithBlock({ (succeed, error) -> Void in
or maybe I am querying parse wrong? Im new to it.
func navTitle () {
var user = PFUser.currentUser()
var query = PFQuery(className:"_User")
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
if let objects = objects as? [PFObject] {
for object in objects {
self.homeScreen.title = object["BusinessName"] as! String?
}
}else {
self.homeScreen.title = "Home"
}
You need to set the ACL after the signUp has completed.
So in the delegate method,
If you are not using the PFSignUpViewController - just set the ACL in the code block of signUpInBackgroundWithBlock, then call the save once its been set.
This is the same when you want to create a role, the user needs to already exisit.
This is how to create a role within the same method body
When first learning parse, i suggest creating new users via this method.