Back

[SOLVED] Provide Access to specific attributes only

  • 0
  • Databases
  • General
ZiaChoudhary
2 Sep, 2023, 06:54

Hey team Appwrite hope you are doing well. I want to ptovide custom access for every of my attribute in a collection. Like for example, in a posts collection there is an array of likes having ids of users who liked the post. I just want to allow the users to update only likes array not the whole post. Means they can only like the post and their ID gets added in likes array of posts collection. Providing no access to other attributes of post collection.

TL;DR
The user is asking for a way to provide custom access to specific attributes in a collection. They mention workarounds such as using Appwrite Functions or creating one-to-one relationships. They also suggest creating a function that triggers when someone likes a post to update it on their behalf. The user asks if this is a good practice and if there are plans for attribute level security in Appwrite. It is suggested to create a different collection for the likes attribute. The core team suggests opening an issue for this feature request. At the moment, Appwrite does not support attribute level security.
D5
2 Sep, 2023, 11:58

For now Appwrite doesn't support attribute level security

D5
2 Sep, 2023, 11:58

Instead you will need to have a different collection

D5
2 Sep, 2023, 11:58

Or document

D5
2 Sep, 2023, 11:58

Or document in a different collection

ZiaChoudhary
2 Sep, 2023, 12:13

Yep then having a document in a different collection is good to go. And are there any plans to bring attribute level security?

D5
2 Sep, 2023, 12:17

For now it doesn't seems planned as far as I know πŸ‘€

ZiaChoudhary
2 Sep, 2023, 12:22

Okey thank you @D5 for your valuable suggestions. And yes if you request to the Core team to add it in the roadmap it would be great. Because at this moment we don't have stable relationships and if we have to create multiple collection for such tasks the we will have to run more queries that is more resource consuming process.

It would becoke easy to query from multiple collections if we have stable relationships.

ZiaChoudhary
2 Sep, 2023, 12:29

And one more thing i have an idea to create a function that gets triggered when someone likes post and it updates the post on its behalf. In this way user will not be allowed to directly access the permissions of update. Is it a good practice and a safer one?

D5
2 Sep, 2023, 12:41

Please, don't tag core directly πŸ˜…

D5
2 Sep, 2023, 12:42

You can still make relationships manually

D5
2 Sep, 2023, 12:52

I can't find any issues opened with this request. You could open one

ZiaChoudhary
2 Sep, 2023, 15:48

As its related to this post so i think we should proceed with this one instead of creating another with same title/questions.

Tessa
2 Sep, 2023, 16:53

@VincentGe can you look into this with engineering to see if this is in in a near future roadmap? πŸ™‚

VincentGe
2 Sep, 2023, 17:00

Yep!

VincentGe
2 Sep, 2023, 17:01

We've seen this suggestion

VincentGe
2 Sep, 2023, 17:01

What we'll try to solve is how to limit access to individual attributes, might or might not be through permissions, but the underlying problem needs to be sovled for sure

ZiaChoudhary
2 Sep, 2023, 17:57

@VincentGe please throw some light on the above mentioned work around, is it secure and good to go until we get a custom solution by Appwrite team.

VincentGe
2 Sep, 2023, 18:26

There are many workarounds, doing a one to one relationship and restricting access this way, using Appwrite Functions, using events. These are valid.

VincentGe
2 Sep, 2023, 18:26

I would just stick with an Appwrite Function for now, it's probably the most flexible approach.

VincentGe
2 Sep, 2023, 18:26

❀️

ZiaChoudhary
3 Sep, 2023, 03:46

[Solved] Provide Access to specific attributes only

ZiaChoudhary
3 Sep, 2023, 03:46

[SOLVED] Provide Access to specific attributes only

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