Merge pull request #438 from flovilmart/flovilmart.fix-default_User.metadata

Adds locked down ACL on _User
This commit is contained in:
Fosco Marotto
2016-02-16 08:11:21 -08:00
2 changed files with 23 additions and 1 deletions

View File

@@ -655,6 +655,13 @@ RestWrite.prototype.runDatabaseOperation = function() {
this.response.updatedAt = this.updatedAt;
});
} else {
// Set the default ACL for the new _User
if (!this.data.ACL && this.className === '_User') {
var ACL = {};
ACL[this.data.objectId] = { read: true, write: true };
ACL['*'] = { read: true, write: false };
this.data.ACL = ACL;
}
// Run a create
return this.config.database.create(this.className, this.data, options)
.then(() => {