Skip to content

Commit 89f76ca

Browse files
committed
docs(SDB): update
1 parent 2307abb commit 89f76ca

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

serverless/sql-databases/how-to/use-row-level-security.mdx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ categories:
1515

1616
Row-Level Security is a database security mechanism that allows access only to specific rows of a table based on a user's role or permissions.
1717

18-
Row Level Security can be actived with Serverless SQL Database for a maximum 2 different roles having both read and write permissions. This can be used to restrict access to a subset of users with frameworks or tools such as [PostgREST](https://docs.postgrest.org/en/v12/).
18+
Row Level Security can be actived with Serverless SQL Databases for a maximum of two different roles, having both read and write permissions. This can be used to restrict access to a subset of users with frameworks or tools such as [PostgREST](https://docs.postgrest.org/en/v12/).
19+
1920
This requires setting up different [IAM permissions sets](/identity-and-access-management/iam/reference-content/permission-sets/) for each role (**ServerlessSQLDatabaseFullAccess** or **ServerlessSQLDatabaseReadWrite** for one role, and **ServerlessSQLDatabaseDataReadWrite** for the other).
2021

2122
<Macro id="requirements" />
2223

2324
- A Scaleway account logged into the [console](https://console.scaleway.com)
2425
- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
2526
- [Created a Serverless SQL Database](/serverless/sql-databases/how-to/create-a-database/)
26-
- [Created two applications](/identity-and-access-management/iam/how-to/create-application/) in IAM
2727

2828
## Add sample data and create PostgreSQL Row Level Security
2929

@@ -63,26 +63,24 @@ This requires setting up different [IAM permissions sets](/identity-and-access-m
6363

6464
## Create an IAM application with Row Level Security enabled
6565

66-
1. Create a new [IAM application](/identity-and-access-management/iam/how-to/create-application/) or use an existing one.
66+
1. Create a new [IAM application](/identity-and-access-management/iam/how-to/create-application/).
6767

6868
2. Create a new [IAM policy](/identity-and-access-management/iam/how-to/create-policy/), and add the **ServerlessSQLDatabaseDataReadWrite** permission set to the application you just created.
6969

7070
<Message type="note">
71-
You must provide **ServerlessSQLDatabaseDataReadWrite** permission set and not **ServerlessSQLDatabaseReadWrite** permission set. Indeed, all connections to your database performed with the former permissions set will use `role_readwrite` in PostgreSQL, whereas all connections performed with the latter or **ServerlessSQLDatabaseFullAccess** will use `role_admin` in PostgreSQL.
71+
You must provide **ServerlessSQLDatabaseDataReadWrite** permission set and not **ServerlessSQLDatabaseReadWrite** permission set. Indeed, all connections to your database performed with the former permissions set will use `role_readwrite` in PostgreSQL, whereas all connections performed with the latter, or **ServerlessSQLDatabaseFullAccess** will use `role_admin` in PostgreSQL.
7272
</Message>
7373

74-
3. Create an [API Key](/identity-and-access-management/iam/how-to/create-api-keys/) for this application and connect to your Serverless SQL Database with this application.
74+
3. Create an [API Key](/identity-and-access-management/iam/how-to/create-api-keys/) for this application, and connect to your Serverless SQL Database with this application.
7575
```bash
7676
psql "postgres://[new-application-id]:[new-api-secret-key]@[database-hostname]:5432/[database-name]?sslmode=require"
7777
```
7878

79-
4. Run the follwoing command to list the `pets` this application has access to with:
79+
4. Run the following command to list the `pets` this application has access to:
8080
```sql
8181
SELECT * FROM pets;
8282
```
83-
Only the pets with a `keeper` column value of `role_readwrite`.
84-
85-
Your new application can now only access a specific subset of rows based on its permissions.
83+
Only the pets with a `keeper` column value of `role_readwrite` display. Your new application can now only access a specific subset of rows based on its permissions.
8684

8785
<Message type="tip">
8886
Row level security and policies can be created or deleted by a table owner. In this example, you can check table owner with the following command:

0 commit comments

Comments
 (0)