Skip to content

Commit 5b40a58

Browse files
author
Francis Lessard
committed
Remove public ACL set by default.
1 parent 2c5b77f commit 5b40a58

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/RestWrite.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function RestWrite(config, auth, className, query, data, originalData) {
2828
this.className = className;
2929
this.storage = {};
3030
this.runOptions = {
31-
acl:['*']
31+
acl:[]
3232
};
3333

3434
if (!query && data.objectId) {
@@ -95,14 +95,21 @@ RestWrite.prototype.execute = function() {
9595

9696
// Uses the Auth object to get the list of roles, adds the user id
9797
RestWrite.prototype.getUserAndRoleACL = function() {
98-
if (this.auth.isMaster || !this.auth.user) {
98+
if (this.auth.isMaster) {
9999
return Promise.resolve();
100100
}
101-
return this.auth.getUserRoles().then((roles) => {
102-
roles.push(this.auth.user.id);
103-
this.runOptions.acl = this.runOptions.acl.concat(roles);
101+
102+
this.runOptions.acl.push("*");
103+
104+
if( this.auth.user ){
105+
return this.auth.getUserRoles().then((roles) => {
106+
roles.push(this.auth.user.id);
107+
this.runOptions.acl = this.runOptions.acl.concat(roles);
108+
return Promise.resolve();
109+
});
110+
}else{
104111
return Promise.resolve();
105-
});
112+
}
106113
};
107114

108115
// Validates this operation against the schema.

0 commit comments

Comments
 (0)