File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed
src/Adapters/Storage/Mongo Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -1478,4 +1478,37 @@ describe('miscellaneous', function() {
1478
1478
done ( ) ;
1479
1479
} ) ;
1480
1480
} ) ;
1481
+
1482
+ it_exclude_dbs ( [ 'postgres' ] ) ( 'should have _acl when locking down (regression for #2465)' , ( done ) => {
1483
+ let headers = {
1484
+ 'X-Parse-Application-Id' : 'test' ,
1485
+ 'X-Parse-REST-API-Key' : 'rest'
1486
+ }
1487
+ rp ( {
1488
+ method : 'POST' ,
1489
+ headers : headers ,
1490
+ uri : 'http://localhost:8378/1/classes/Report' ,
1491
+ body : {
1492
+ ACL : { } ,
1493
+ name : 'My Report'
1494
+ } ,
1495
+ json : true
1496
+ } ) . then ( ( ) => {
1497
+ let config = new Config ( 'test' ) ;
1498
+ let adapter = config . database . adapter ;
1499
+ return adapter . _adaptiveCollection ( "Report" )
1500
+ . then ( collection => collection . find ( { } ) )
1501
+ } ) . then ( ( results ) => {
1502
+ expect ( results . length ) . toBe ( 1 ) ;
1503
+ let result = results [ 0 ] ;
1504
+ expect ( result . name ) . toEqual ( 'My Report' ) ;
1505
+ expect ( result . _wperm ) . toEqual ( [ ] ) ;
1506
+ expect ( result . _rperm ) . toEqual ( [ ] ) ;
1507
+ expect ( result . _acl ) . toEqual ( { } ) ;
1508
+ done ( ) ;
1509
+ } ) . catch ( ( err ) => {
1510
+ fail ( JSON . stringify ( err ) ) ;
1511
+ done ( ) ;
1512
+ } ) ;
1513
+ } ) ;
1481
1514
} ) ;
Original file line number Diff line number Diff line change @@ -341,6 +341,7 @@ const addLegacyACL = restObject => {
341
341
restObject . _wperm . forEach ( entry => {
342
342
_acl [ entry ] = { w : true } ;
343
343
} ) ;
344
+ restObjectCopy . _acl = _acl ;
344
345
}
345
346
346
347
if ( restObject . _rperm ) {
@@ -351,9 +352,6 @@ const addLegacyACL = restObject => {
351
352
_acl [ entry ] . r = true ;
352
353
}
353
354
} ) ;
354
- }
355
-
356
- if ( Object . keys ( _acl ) . length > 0 ) {
357
355
restObjectCopy . _acl = _acl ;
358
356
}
359
357
You can’t perform that action at this time.
0 commit comments