-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Adds count class level permission #3814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,6 +178,38 @@ describe('SchemaController', () => { | |
}); | ||
}); | ||
|
||
it('class-level permissions test count', (done) => { | ||
var obj; | ||
return config.database.loadSchema() | ||
// Create a valid class | ||
.then(schema => schema.validateObject('Stuff', {foo: 'bar'})) | ||
.then(schema => { | ||
var count = {}; | ||
return schema.setPermissions('Stuff', { | ||
'create': {'*': true}, | ||
'find': {'*': true}, | ||
'count': count | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm assuming that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah but |
||
}) | ||
}).then(() => { | ||
obj = new Parse.Object('Stuff'); | ||
obj.set('foo', 'bar'); | ||
return obj.save(); | ||
}).then((o) => { | ||
obj = o; | ||
var query = new Parse.Query('Stuff'); | ||
return query.find(); | ||
}).then((results) => { | ||
expect(results.length).toBe(1); | ||
var query = new Parse.Query('Stuff'); | ||
return query.count(); | ||
}).then(() => { | ||
fail('Class permissions should have rejected this query.'); | ||
}, (err) => { | ||
expect(err.message).toEqual('Permission denied for action count on class Stuff.'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('can add classes without needing an object', done => { | ||
config.database.loadSchema() | ||
.then(schema => schema.addClassIfNotExists('NewClass', { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no quotes around object members
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was to match the style of the rest of the file, we'll update those at a later time (i.e. test linting)