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
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...