Skip to content
Back

Can a user set permission for other user on document he created?

  • 0
  • Databases
  • Android
  • Cloud
Husnain_bashir
17 Jul, 2024, 09:33

Hello, I am implementing live chat support in my app. When the user create a message, I wants the permission on that document to be user and the support agent. Is it's possible to also give read permission on the document to other user along with the author(user who created the message).

TL;DR
Developers want to set permissions on a document created by a user so that both the user and the support agent can read it. This can be achieved by using server functions to handle the permission settings. Realtime doesn't directly support server SDKs, so developers should consider alternative approaches like creating a separate list of chat members. In the case of a single chat room with two members, a string array can be used to store the members' attributes. Cloud functions can be utilized to implement this functionality effectively.
Mosh Ontong
17 Jul, 2024, 09:34

you can by using the cloud function

Mosh Ontong
17 Jul, 2024, 09:35

for instance if the chat is single chat like two members in one room. Then you can create a string array for members attribute. Store here who are the members of that room.

Mosh Ontong
17 Jul, 2024, 09:36

In that case, the list of members well be your base who can read the chats

Mosh Ontong
17 Jul, 2024, 09:36

Otherwise if there are multiple members in one room. I prefer to create another called chat_members

Husnain_bashir
17 Jul, 2024, 09:49

I am using realtime

Husnain_bashir
17 Jul, 2024, 09:50

Realtime don't support server sdks

Joshi
17 Jul, 2024, 09:52

He suggest you using server functions to handle that. Your users will still receive the data via realtime.

Husnain_bashir
17 Jul, 2024, 09:57

For example, I am listening to creation of documents in certain collection. When a user creates a message, i will trigger the function to set permissions on that message that is already created? My understanding from the above discussion is that. Can you please correct me if I am wrong.

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