Search code examples
c#parse-cloud-codeparse-server

Access Cloud Code in parse-server from c#


Does the C# .NET client library for the open source self hosted parse-server have support for calling Cloud Code functions? If so, how can this be done?

EDIT: I did find this http://parseplatform.github.io/docs/cloudcode/guide/ which does give an example of using the .NET library for calling a Cloud Code function, however it doesn't seem to provide any information on the client app providing authentication information so the Cloud Code function can check user permissions for a specific action. Is this possible?

Thanks!


Solution

  • You can access all your cloud code function from the client after you initialize Parse SDK with you appId and serverURL. If your requirement is that only logged in users will be able to access one or more cloud functions then in your cloud code you can check the following:

    if (request.user) {
       // user is logged in
    }
    

    because in parse-server there is not Parse.User.current() anymore so the logged in user is being sent as part of the request.

    Now in order to allow/prevent a user to read/write a specific object you need to use ACL (Access control list). When you create new ACL you can specify which users/roles can read/write this object. You can even decide if this object is public read or public write and it is any user will be able to read or write from/to this object.

    You can read about ACL's and Roles in here