Adds locked down ACL on _User

This commit is contained in:
Florent Vilmart
2016-02-15 19:40:22 -05:00
parent cf7202f80a
commit 20eca71a6f
2 changed files with 23 additions and 1 deletions

View File

@@ -660,6 +660,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(() => {