Posts

Showing posts with the label dynamic policies

Row-Level Security

Image
Introduction This is an Access Control feature used to secure data. It determines whether a user has the right to see or modify a specific row of data. RLS allows you to control SELECT, INSERT, UPDATE, or DELETE privileges on specific rows of data based on the identity of the user executing the command. How it works First, you need to enable RLS for each table you want to use Then, you define Policies to permit how users can perform data operations. If no Policy exists, by default no one (except the Superuser/Owner ) can see any row of data in the table anymore Next, when a query is submitted, the system does not run that command immediately but performs a step called Query Rewrite It will automatically add filter conditions (like a WHERE clause) based on the created Policies to hide rows that the user does not have permission to view. Example: In a SaaS system, you enable RLS to ensure that customers of one Company only see data rows belonging to that Company, remaining com...