Granular CLP pointer permissions (#6352)
* set pointer permissions per operatioon; tests * more tests * fixes addField permission; tests
This commit is contained in:
committed by
Antonio Davi Macedo Coelho de Castro
parent
4beb89fc2e
commit
3c46117d9b
@@ -758,4 +758,37 @@ describe('ProtectedFields', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('schema setup', () => {
|
||||
const className = 'AObject';
|
||||
async function updateCLP(clp) {
|
||||
const config = Config.get(Parse.applicationId);
|
||||
const schemaController = await config.database.loadSchema();
|
||||
|
||||
await schemaController.updateClass(className, {}, clp);
|
||||
}
|
||||
|
||||
it('should fail setting non-existing protected field', async () => {
|
||||
const object = new Parse.Object(className, {
|
||||
revision: 0,
|
||||
});
|
||||
await object.save();
|
||||
|
||||
const field = 'non-existing';
|
||||
const entity = '*';
|
||||
|
||||
await expectAsync(
|
||||
updateCLP({
|
||||
protectedFields: {
|
||||
[entity]: [field],
|
||||
},
|
||||
})
|
||||
).toBeRejectedWith(
|
||||
new Parse.Error(
|
||||
Parse.Error.INVALID_JSON,
|
||||
`Field '${field}' in protectedFields:${entity} does not exist`
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user