Back

Update document not working on client side

  • 0
  • Databases
  • Apple
  • Self Hosted
Matej
14 Jul, 2023, 22:46

https://appwrite.io/docs/permissions

You can read about permissions here

TL;DR
The user is having issues with updating a document on the client side. They are unsure if all users can update a document within a collection and if they should give read and update permission from the client side. They also ask if it is possible to give temporary permissions using the parameters from the SDK. The issue persists even after trying different solutions. The support team suggests checking the permissions on the document and collection, reviewing the code for appwriteClient, and ensuring that the user is logged in. They also provide a link to the documentation on permissions for further guidance. No specific solution is mentioned in the thread.
Matej
14 Jul, 2023, 22:47

I think examples will show you how to use permissions for your own case

Drake
15 Jul, 2023, 00:39

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Drake
15 Jul, 2023, 00:39

What are the permissions on the document and collection?

nishp77
15 Jul, 2023, 01:32

All I did was to add this under collection settings

Drake
15 Jul, 2023, 01:34

What's the code for appwriteClient? Is the user logged in?

Drake
15 Jul, 2023, 01:37

also you're passing an array for data? I think it needs to be a dictionary. I don't know the syntax for swift though

nishp77
15 Jul, 2023, 02:07

yes after logging in I first run a query to get the document, then I need to update the document, so read permission is working it just the update not working

nishp77
15 Jul, 2023, 02:07

Ohk

nishp77
15 Jul, 2023, 02:10

Still same issue

Drake
15 Jul, 2023, 05:16

Are you self hosting? If so, what version are you on and do you have relationships?

Drake
15 Jul, 2023, 05:22

What's your code for appwriteClient? And how many instances of that do you have?

nishp77
15 Jul, 2023, 17:30

yes self hosting, plus it does have a relationship

Drake
15 Jul, 2023, 17:30

Does the user have update permissions on all the related documents?

nishp77
15 Jul, 2023, 17:31

It didn't have in another collection that had a relationship with, just trying it now

nishp77
15 Jul, 2023, 17:32

Thank you steven

nishp77
15 Jul, 2023, 17:32

It works now

nishp77
15 Jul, 2023, 17:33

I had question what if I don't want to give collection permission, can we use the paramters from sdk to give permission and is that temporary?

nishp77
15 Jul, 2023, 17:39

Like I don't think I should give users read and update permission from client side? Can you suggest a better way?

nishp77
15 Jul, 2023, 17:40

I haven't tried the permission parameter using sdk functions so I don't know how that works internally

Drake
15 Jul, 2023, 18:18

Not sure what you mean

Drake
15 Jul, 2023, 18:18

A user can only grant a permission they already have so I'm not sure what the concern is

Drake
15 Jul, 2023, 18:18

API keys have full access

nishp77
18 Jul, 2023, 19:36

I meant can all users update a document within a collection?

Drake
18 Jul, 2023, 20:23

Only if they're granted permissions

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more