File tree 2 files changed +37
-1
lines changed 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,42 @@ describe('SchemaController', () => {
426
426
} ) ;
427
427
} ) ;
428
428
429
+ it ( 'can update class level permission' , done => {
430
+ const newLevelPermissions = {
431
+ find : { } ,
432
+ get : { '*' : true } ,
433
+ count : { } ,
434
+ create : { '*' : true } ,
435
+ update : { } ,
436
+ delete : { '*' : true } ,
437
+ addField : { } ,
438
+ protectedFields : { '*' : [ ] } ,
439
+ } ;
440
+ config . database . loadSchema ( ) . then ( schema => {
441
+ schema
442
+ . validateObject ( 'NewClass' , { foo : 2 } )
443
+ . then ( ( ) => schema . reloadData ( ) )
444
+ . then ( ( ) =>
445
+ schema . updateClass (
446
+ 'NewClass' ,
447
+ { } ,
448
+ newLevelPermissions ,
449
+ { } ,
450
+ config . database
451
+ )
452
+ )
453
+ . then ( actualSchema => {
454
+ expect ( dd ( actualSchema . classLevelPermissions , newLevelPermissions ) ) . toEqual ( undefined ) ;
455
+ done ( ) ;
456
+ } )
457
+ . catch ( error => {
458
+ console . trace ( error ) ;
459
+ done ( ) ;
460
+ fail ( 'Error creating class: ' + JSON . stringify ( error ) ) ;
461
+ } ) ;
462
+ } ) ;
463
+ } ) ;
464
+
429
465
it ( 'will fail to create a class if that class was already created by an object' , done => {
430
466
config . database . loadSchema ( ) . then ( schema => {
431
467
schema
Original file line number Diff line number Diff line change @@ -768,7 +768,7 @@ export default class SchemaController {
768
768
} )
769
769
. then ( results => {
770
770
enforceFields = results . filter ( result => ! ! result ) ;
771
- this . setPermissions ( className , classLevelPermissions , newSchema ) ;
771
+ return this . setPermissions ( className , classLevelPermissions , newSchema ) ;
772
772
} )
773
773
. then ( ( ) =>
774
774
this . _dbAdapter . setIndexesWithSchemaFormat (
You can’t perform that action at this time.
0 commit comments