parse-dashboard icon indicating copy to clipboard operation
parse-dashboard copied to clipboard

Add context to dashboard calls

Open dblythy opened this issue 3 years ago • 5 comments

New Feature / Enhancement Checklist

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

dblythy avatar Nov 29 '22 01:11 dblythy

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.

mtrezza avatar Nov 29 '22 08:11 mtrezza

Would not be easy just add a header in the dashboard calls?

matheusfrozzi avatar Feb 16 '23 13:02 matheusfrozzi

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

mtrezza avatar Feb 16 '23 16:02 mtrezza

Note: Bounty is for the dashboard PR only, any Parse Server PR as mentioned above would receive a separate bounty.

mtrezza avatar Jun 07 '23 20:06 mtrezza