-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
type:featureNew feature or improvement of existing featureNew feature or improvement of existing feature
Description
New Feature / Enhancement Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
Current Limitation
If a new object is created, it doesn't get an object ID until setRequiredFieldsIfNeeded.
This means that any Parse.Cloud.beforeSave(Parse.User triggers won't be able to any ACL work using request.object because it won't have an ID defined.
Feature / Enhancement Description
Either assign the object ID prior to the beforeSave for new objects, or run setRequiredFieldsIfNeeded before the beforeSave.
This would be a breaking change for developers who use if (!req.object.objectId) to work out if an object is new, rather than !req.object.existed().
Example Use Case
Parse.Cloud.beforeSave(Parse.User, ({object}) => {
if (!object.existed) {
const acl = new Parse.ACL();
acl.setReadAccess(object.id,true);
acl.setWriteAccess(object.id,true);
object.setACL(acl);
}
});
Alternatives / Workarounds
Run the code in an afterSave trigger.
Related: #701
Metadata
Metadata
Assignees
Labels
type:featureNew feature or improvement of existing featureNew feature or improvement of existing feature