Skip to content

Commit 2307abb

Browse files
committed
docs(SDB): update
1 parent 04fb904 commit 2307abb

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This requires setting up different [IAM permissions sets](/identity-and-access-m
4848
CREATE POLICY pets_keeper ON pets TO role_readwrite USING (keeper = current_user);
4949
```
5050

51-
5. (Optional) Check that you can see all the data with your current connection:
51+
5. (Optional) Run the command below to check that you can see all the data with your current connection:
5252
```sql
5353
SELECT * FROM pets;
5454
```
@@ -63,27 +63,30 @@ 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](https://www.scaleway.com/en/docs/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/) or use an existing one.
6767

68-
2. Add **ServerlessSQLDatabaseDataReadWrite** permission set to this application by creating a new [IAM policy](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-policy/)
68+
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

70-
<Message type="tip">
71-
You need to provide **ServerlessSQLDatabaseDataReadWrite** permission set and not **ServerlessSQLDatabaseReadWrite** permission set. Indeed, all connections to your database performed with **ServerlessSQLDatabaseDataReadWrite** permissions will use `role_readwrite` in PostgreSQL, whereas all connections performed with **ServerlessSQLDatabaseReadWrite** or **ServerlessSQLDatabaseFullAccess** will use `role_admin` in PostgreSQL.
70+
<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.
7272
</Message>
7373

74-
3. Create an [API Key](https://www.scaleway.com/en/docs/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. List the `pets` this application has access to with:
79+
4. Run the follwoing command to list the `pets` this application has access to with:
8080
```sql
8181
SELECT * FROM pets;
8282
```
83-
You should only see pets with a `keeper` column value of `role_readwrite`.
83+
Only the pets with a `keeper` column value of `role_readwrite`.
8484

8585
Your new application can now only access a specific subset of rows based on its permissions.
8686

8787
<Message type="tip">
88-
Note that 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 `select * from pg_tables where tablename = 'pets';`.
88+
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:
89+
```sql
90+
select * from pg_tables where tablename = 'pets';
91+
```
8992
</Message>

0 commit comments

Comments
 (0)