Add context to dashboard calls
New Feature / Enhancement Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am not just asking a question.
- [x] I have searched through existing issues.
Current Limitation
Parse Dashboard uses the JS SDK with the masterKey. It would be helpful to have context in cloud code whether the masterKey is being used in the dashboard, or via the cloud code.
Feature / Enhancement Description
obj.save(null, { context: {dashboard: true }})
Parse.Cloud.beforeFind('Object', ({ context, master}) => {
if (context.dashboard && master) {
// custom logic for dashboard only
}
});
Example Use Case
Alternatives / Workarounds
3rd Party References
Thanks for opening this issue!
- 🎉 We are excited about your ideas for improvement!
I would not make this a default, as it's creating an unnecessary overhead for use cases in which this is irrelevant.
This seems to be a workaround for https://github.com/parse-community/parse-dashboard/issues/2311. The underlying issue is that Parse Dashboard calls are unidentifiable because they are not requested by a user.
Would not be easy just add a header in the dashboard calls?
Actually a special context.dashboard parameter or dedicated dashboard header seem to be too specific. We can consider Parse Dashboard to be just another client. So whether it's the official Parse Dashboard or a custom dashboard or any other client, it would be good to make them identifiable in the Cloud Code triggers. For that we already have the concept of a clientKey. We just need to make it accessible in Cloud Code.
PRs needed could be:
- Add Parse Dashboard option to set the client key
- Make client key accessible in Cloud Code trigger
Note: Bounty is for the dashboard PR only, any Parse Server PR as mentioned above would receive a separate bounty.