@@ -777,7 +777,7 @@ describe('ProtectedFields', function() {
777
777
object . set ( 'revision' , 0 ) ;
778
778
object . set ( 'test' , 'test' ) ;
779
779
780
- await object . save ( { useMasterKey : true } ) ;
780
+ await object . save ( null , { useMasterKey : true } ) ;
781
781
}
782
782
783
783
beforeEach ( async ( ) => {
@@ -812,6 +812,24 @@ describe('ProtectedFields', function() {
812
812
} )
813
813
) . toBeResolved ( ) ;
814
814
} ) ;
815
+
816
+ it ( 'should not allow protecting default fields' , async ( ) => {
817
+ const defaultFields = [ 'objectId' , 'createdAt' , 'updatedAt' , 'ACL' ] ;
818
+ for ( const field of defaultFields ) {
819
+ await expectAsync (
820
+ updateCLP ( {
821
+ protectedFields : {
822
+ '*' : [ field ] ,
823
+ } ,
824
+ } )
825
+ ) . toBeRejectedWith (
826
+ new Parse . Error (
827
+ Parse . Error . INVALID_JSON ,
828
+ `Default field '${ field } ' can not be protected`
829
+ )
830
+ ) ;
831
+ }
832
+ } ) ;
815
833
} ) ;
816
834
817
835
describe ( 'targeting public access' , ( ) => {
@@ -1310,10 +1328,10 @@ describe('ProtectedFields', function() {
1310
1328
1311
1329
// admin supersets moder role
1312
1330
moder . relation ( 'roles' ) . add ( admin ) ;
1313
- await moder . save ( { useMasterKey : true } ) ;
1331
+ await moder . save ( null , { useMasterKey : true } ) ;
1314
1332
1315
1333
tester . relation ( 'roles' ) . add ( moder ) ;
1316
- await tester . save ( { useMasterKey : true } ) ;
1334
+ await tester . save ( null , { useMasterKey : true } ) ;
1317
1335
1318
1336
const roleAdmin = `role:${ admin . get ( 'name' ) } ` ;
1319
1337
const roleModer = `role:${ moder . get ( 'name' ) } ` ;
0 commit comments