Hello here is my cloud code
Parse.Cloud.beforeSave(Parse.User,async (request)=>{
const user = request.object;
const t = user.get('tProfile');
const s = user.get('sProfile');
if (!t && !s) {
user.setACL(new Parse.ACL(user));
}else{
console.log('Old user detected');
}
});
As you can see I am trying to set Acl for a new user signing up with a before save handler, but the error that I get is UserID must be a string. So my question is how can I set an acl for a new user who is just signing up ? Thankyou
So i finally found a way to do so. In the Before save handler just use this code :)
Parse.Cloud.beforeSave(Parse.User, async (request) => {
var newOjb = request.object;
if (!request.original) {
newOjb.setACL(new Parse.ACL(Parse.User.current()));
}
});