Back

[SOLVED] Document security not working

  • 0
  • Databases
  • Web
  • Users
Nimit Savant
7 Jun, 2023, 15:37

Appwrite should throw document not accessible by this role but the user can access the doc :(

TL;DR
[SOLVED] Document security not working; Solution: Remove the 'read' permissions for 'any' and ensure that collection permissions are also checked. Additionally, check for any discrepancies in user permissions to access specific documents.
Nimit Savant
7 Jun, 2023, 15:38

but userId: 64806f760ae83e634ce3 can also access this

Binyamin
7 Jun, 2023, 15:40

You also need to check collection permissions

From the console πŸ‘‡

When document security is enabled, users will be able to access documents for which they have been granted either **Document **or **Collection **permissions.

Binyamin
7 Jun, 2023, 15:41

What I meant is that even if the user don't have permission for the document maybe the user has permissions for the collection (read).

Nimit Savant
7 Jun, 2023, 15:41

ohhh

Nimit Savant
7 Jun, 2023, 15:41

if the user has read collection, he can also read a doc which he has no perms for?

Nimit Savant
7 Jun, 2023, 15:42

can see why that's happening

Binyamin
7 Jun, 2023, 15:42

Exactly

Nimit Savant
7 Jun, 2023, 15:43

but I want my users to get their documents with listDocuments from this collection. But don't want them to access someone elses documents from this collection

Nimit Savant
7 Jun, 2023, 15:45

I don't think so we can do that, I'll have to write this in my backend and fetch list all docs ig

Binyamin
7 Jun, 2023, 15:48

So remove the read permissions for any

Nimit Savant
7 Jun, 2023, 15:49

done done its working now

Nimit Savant
7 Jun, 2023, 15:49

but I wanted to also allow users to do list documents for their own documents

Binyamin
7 Jun, 2023, 15:51

For that you give a user permission of is own documents, don't you?

Nimit Savant
7 Jun, 2023, 15:52

done done

Nimit Savant
7 Jun, 2023, 15:52

ohh waittt

Nimit Savant
7 Jun, 2023, 15:52

fish its working

Nimit Savant
7 Jun, 2023, 15:53

thanks solved @Binyamin

Binyamin
7 Jun, 2023, 16:02

πŸ‘

Drake
7 Jun, 2023, 17:24

[SOLVED] Document security not working

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