You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/3dcitydb/db-scripts.md
+54-4Lines changed: 54 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ tags:
8
8
9
9
The 3DCityDB `v5` software package comes with shell and SQL scripts for tasks such as
10
10
[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).
12
12
13
13
!!! tip
14
14
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
32
32
|`create-schema`| Creates an additional data schema (analogous to the default schema `citydb`) with a user-defined name |
33
33
|`drop-db`| Drops a 3DCityDB instance (incl. all elements of the relational schema) |
34
34
|`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`|
37
37
|`create-changelog`| Create the changelog extension for a 3DCityDB instance |
38
38
|`drop-changelog`| Remove the changelog extension from a 3DCityDB instance |
39
39
|`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.
151
151
By using shell or environment variables instead of hardcoding values directly into your command as shown above, you make
152
152
it easier to reuse the SQL scripts across different setups or systems. This makes automating things, integrating them
153
153
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