Skip to content

Commit a6b0dc1

Browse files
committed
Set ACL only when ACL is not exists yet.
1 parent a21ef99 commit a6b0dc1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/role.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ module.exports = function(AV) {
3636
if (acl === undefined) {
3737
var defaultAcl = new AV.ACL();
3838
defaultAcl.setPublicReadAccess(true);
39-
acl = defaultAcl;
40-
}
41-
if (!(acl instanceof AV.ACL)) {
39+
if(!this.getACL()) {
40+
this.setACL(defaultAcl);
41+
}
42+
} else if (!(acl instanceof AV.ACL)) {
4243
throw new TypeError('acl must be an instance of AV.ACL');
44+
} else {
45+
this.setACL(acl);
4346
}
44-
this.setACL(acl);
4547
},
4648

4749
/**

0 commit comments

Comments
 (0)