
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
- phantom relationships appear on parent c...
i have this bug were my past deleted collection apears as relationship to my parent collection. when i try to delete that relationship from parent it gives me e...
- Attribute stuck on proccessing
i tried creating a new attribute butits stuck on proccessing,i did a hard refresh,cleared cache everything but still stuck on proccessing,also in my functions w...
- Appwrite Cloud Custom Domains Issue
Iām trying to configure my custom domain appwrite.qnarweb.com (CNAME pointing to fra.cloud.appwrite.io with Cloudflare proxy disabled) but encountering a TLS ce...
