Skip to content

Commit 842ed0a

Browse files
authored
update grant-access script documentation to include read-update
update grant-access script documentation to include read-update
2 parents 1d76c8d + 5b7d6d6 commit 842ed0a

1 file changed

Lines changed: 54 additions & 4 deletions

File tree

docs/3dcitydb/db-scripts.md

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tags:
88

99
The 3DCityDB `v5` software package comes with shell and SQL scripts for tasks such as
1010
[setting up](../first-steps/setup.md#3dcitydb-setup-steps) or removing a 3DCityDB instance, creating
11-
additional schemas, and granting or revoking access permissions.
11+
additional schemas, and [granting or revoking access permissions](#granting-and-revoking-access).
1212

1313
!!! tip
1414
Follow the [download instructions](../download.md) to obtain the database scripts. They are available as an individual
@@ -32,8 +32,8 @@ The following table provides an overview of the available shell scripts and thei
3232
| `create-schema` | Creates an additional data schema (analogous to the default schema `citydb`) with a user-defined name |
3333
| `drop-db` | Drops a 3DCityDB instance (incl. all elements of the relational schema) |
3434
| `drop-schema` | Drops a data schema that has been created with `create-schema` |
35-
| `grant-access` | Grants read-only or read-write access to a 3DCityDB instance |
36-
| `revoke-access` | Revokes read-only or read-write access to a 3DCityDB instance, which has been granted with `grant-access` |
35+
| `grant-access` | Grants read-only, read-update, or read-write access to a 3DCityDB instance |
36+
| `revoke-access` | Revokes access to a 3DCityDB instance that has been granted with `grant-access` |
3737
| `create-changelog` | Create the changelog extension for a 3DCityDB instance |
3838
| `drop-changelog` | Remove the changelog extension from a 3DCityDB instance |
3939
| `upgrade-db` | Upgrade an existing 3DCityDB instance to a newer minor or patch version |
@@ -151,4 +151,54 @@ on its usage and command-line options.
151151
By using shell or environment variables instead of hardcoding values directly into your command as shown above, you make
152152
it easier to reuse the SQL scripts across different setups or systems. This makes automating things, integrating them
153153
into other software, or running them as part of a CI/CD pipeline way more flexible. This is an easy way to streamline
154-
workflows using the SQL scripts.
154+
workflows using the SQL scripts.
155+
156+
## Granting and revoking access
157+
158+
The `grant-access` script allows you to grant database access to a specified user (the _grantee_) for a 3DCityDB
159+
instance. Three access modes are available:
160+
161+
| Access mode | Code | Description |
162+
|---|---|---|
163+
| **Read-only** | `RO` | Grants `SELECT` privileges on all tables in the data schema and auxiliary schemas (`citydb_pkg`, `public`). No sequence privileges are granted. The grantee can query data but cannot modify it. This is the default. |
164+
| **Read-update** | `RU` | Grants `SELECT`, `INSERT`, and `UPDATE` privileges on tables in the data schema, and `SELECT` on auxiliary schemas (`citydb_pkg`, `public`). Grants `USAGE` and `SELECT` on sequences in the data schema. This mode is suitable when users need to read and modify city objects but should not delete data or alter the database structure. |
165+
| **Read-write** | `RW` | Grants `ALL` privileges on all tables in the data schema and auxiliary schemas (`citydb_pkg`, `public`), and `ALL` privileges on sequences in the data schema. The grantee has full access to the 3DCityDB instance. |
166+
167+
To run the script, execute it from the shell scripts directory:
168+
169+
=== "Linux"
170+
171+
```bash
172+
./grant-access.sh
173+
```
174+
175+
=== "Windows CMD"
176+
177+
```bat
178+
grant-access.bat
179+
```
180+
181+
The script will prompt for the following inputs:
182+
183+
1. **Grantee** -- the name of the database user to whom access should be granted.
184+
2. **Schema** -- the target 3DCityDB schema (default: `citydb`).
185+
3. **Access mode** -- the level of access: `RO`, `RU`, or `RW` (default: `RO`).
186+
187+
To revoke previously granted access, use the `revoke-access` script:
188+
189+
=== "Linux"
190+
191+
```bash
192+
./revoke-access.sh
193+
```
194+
195+
=== "Windows CMD"
196+
197+
```bat
198+
revoke-access.bat
199+
```
200+
201+
The script will prompt for the following inputs:
202+
203+
1. **Grantee** -- the name of the database user whose access should be revoked.
204+
2. **Schema** -- the target 3DCityDB schema (default: `citydb`).

0 commit comments

Comments
 (0)