any example you can refer
Okay can you explain what you mean by conditionally setting document security?
If you're trying to restrict access based on the user, it's possible.
Have you looked at this by any chance? https://appwrite.io/docs/permissions#example-1
i am taking about attribute based conditin, not role boesd
role based examples are there, what I can tell from doc
For example, if there is a user with name Safwan, email as safwan@example.com and user id as 7b9c24929ncnmc11, then you can use the Permission.role(Role.user('7b9c24929ncnmc11')) and only that user will be able to read the document
Attribute as in?
i need something like in a documnet an attribute called let say isPublic which set to boolean, and based on that i will enable the access
so this isPublic attribute will be set for each document right?
yup
and do you plan on setting this attribute manually from the dashboard, or through your client side code, when using createDocument?
any way, I don;t think that matters here
while reading the documnet i need to check if anyone try to access the documnet
I can omit it using serverside code
It kind of does because if you're doing it through code, you can just create that document with Permission.read(Role.any())
but I needed that to work on client, otherwise what; the use here using it , right
I don't see why you need an attribute to do this? Even if you were to use an attribute, you'll have to fetch the document, see if it's isPublic is set to false or true, and based on that move forward. This isn't good practice I believe.
but that's is role based, that's what I was trying to say
This will work on client.
I don;t think, is required, supabase is providing that
Yes but the role is user. So every user will have to satisfy the condition.
Sometime we need, is useful creating internal role based access in project
Can I ask where this is explained in Supabase? I wanna make sure I understand what's happening
I'm sorry I don't quite undersatnd what you meant
Recommended threads
- Paused project can't activate
I have failed to reactivate one my projects which had been paused
- Site deployment keeps getting failed
Hi good folks, need a hand with Sites deploy Error on every deploy: Synchronous function execution timed out... duration doesn't exceed 30 seconds [exact log ...
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...