-
Notifications
You must be signed in to change notification settings - Fork 259
Add RLS reference to document level security documentation #1969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -23,6 +23,10 @@ Configure collection level permissions by navigating to **Your collection** > ** | |||
Document level permissions grant access to individual documents. | |||
If a user has read, create, update, or delete permissions at the document level, the user can access the **individual document**. | |||
|
|||
{% info title="Does Appwrite support Row Level Security (RLS)?" %} | |||
Document level security in Appwrite is similar to what is known as Row Level Security (RLS) found in database systems like PostgreSQL. Both concepts allow you to control access to individual records based on user identity and roles. If you're familiar with RLS, you'll find Appwrite's document level security provides similar granular access control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provides similar granular access control.
While both allows giving granular access, RLS is quite different than Appwrite's permission model so we should make sure that's clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stnguyen90 Can you help with the specific difference(s) so we can make it clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Postgres' RLS allows you to add a policy to a table. For example, given table:
CREATE TABLE accounts (manager text, company text, contact_email text);
this policy:
CREATE POLICY account_managers ON accounts TO managers
USING (manager = current_user);
Makes it so when a query is done on the accounts
table, only rows where the manager
column matches current_user
will return.
With Appwrite's document-level permissions, you set on the document which user should have access to that document.
Does that give you enough information to better word it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes sense @stnguyen90. What do you think about the update I made?
The preview deployment failed. 🔴 Last updated at: 2025-07-07 17:03:58 CET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment.
6e3c6b4
to
83e3ebc
Compare
@@ -23,6 +23,10 @@ Configure collection level permissions by navigating to **Your collection** > ** | |||
Document level permissions grant access to individual documents. | |||
If a user has read, create, update, or delete permissions at the document level, the user can access the **individual document**. | |||
|
|||
{% info title="Does Appwrite support Row Level Security (RLS)?" %} | |||
Document level security in Appwrite is similar to Row Level Security (RLS) found in database systems like PostgreSQL, as both provide granular access control to individual records. However, they work differently: RLS uses policies that automatically filter results based on conditions, while Appwrite requires explicitly setting permissions on each document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicitly setting permissions
Does this sound negative to you? Can you reword it to not sound like a drawback/flaw?
What does this PR do?
Test Plan
/docs/products/databases/permissions