Back

How to get specific users data without using query

  • 0
  • Databases
  • Flutter
Ponguta_
25 Apr, 2023, 18:09

How are you storing data from the user right now?

TL;DR
User is seeking help on how to get specific user data without using a query. There is a discussion on filtering documents based on user permissions. The user encounters an error when trying to create new documents and receives advice to change the permission to 'write' instead of 'create'. There is a suggestion to move the creation of documents to a function and add permissions. The user shares their data structure and there is a suggestion to remove the Users permission and recheck. No final solution is provided in the thread.
Binyamin
25 Apr, 2023, 18:10

You can see here

new user
25 Apr, 2023, 18:12

as i have enable the document security then why its not working

Binyamin
25 Apr, 2023, 18:13

If you want to have permission per user just remove the Users permission here and recheck

new user
25 Apr, 2023, 18:13

storing data inside a single collection

new user
25 Apr, 2023, 18:13

ok, let me check.

Ponguta_
25 Apr, 2023, 18:15

Can you share a bit of the structure?

new user
25 Apr, 2023, 18:16

users collection then document

Ponguta_
25 Apr, 2023, 18:18

But, what I mean, is that how are you telling database which document is from one user or another?

Just permissions?

new user
25 Apr, 2023, 18:23

via user id like getuser.$id

new user
25 Apr, 2023, 18:57

i have removed user permission which is collection permission now its showing me only the specific users document but unable create a new document because collections permission is removed,

Binyamin
25 Apr, 2023, 18:58

Makes sense.

What would be the best practice now is to move the creation of a document to a function. And adding the permissions.

Binyamin
25 Apr, 2023, 18:58

Or You can leave the only the create permission for the Users group

new user
25 Apr, 2023, 19:01

yes i did the same but its saying Unhandled Exception: AppwriteException: general_argument_invalid, Invalid permissions: Permission "create("user:6439c344c13c402c0629")" is not allowed. Must be one of: read, update, delete, write. (400) and this user is existing in my database

Binyamin
25 Apr, 2023, 19:02

In code change it to write

Binyamin
25 Apr, 2023, 19:02

Which means create

Binyamin
25 Apr, 2023, 19:02

I think

new user
25 Apr, 2023, 19:03

ok let me try it

new user
25 Apr, 2023, 19:18

now its working Thanks, but why its not working with create, usually i use create for creating new documents inside collection

Binyamin
25 Apr, 2023, 19:21

I'm not sure

new user
25 Apr, 2023, 19:26

no problem, is filtering users data by permission is a good decision for production level application ?

Binyamin
25 Apr, 2023, 19:27

I didn't quite understand What you mean filtering by permissions?

Filtering the documents that each one can have access? If this is the case then sure

new user
25 Apr, 2023, 19:29

yes this is the case Filtering the documents that each one can have access? then it will not give any performance issue ?

Binyamin
25 Apr, 2023, 19:30

Don't think so. I think this is how it meant to be used

new user
25 Apr, 2023, 19:31

Ok Thank you so much for your time and help.

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