diff --git a/documentation/docs/03-rsd-instance/01-getting-started.md b/documentation/docs/03-rsd-instance/01-getting-started.md index 4ac0d69a2..e7f4caddf 100644 --- a/documentation/docs/03-rsd-instance/01-getting-started.md +++ b/documentation/docs/03-rsd-instance/01-getting-started.md @@ -55,22 +55,23 @@ At this point you should be able to see RSD instance running. You should also be The local account login option is only for test purposes. Local accounts do not require a password and are therefore not safe. ::: -## Login as RSD adminstrator +## Log in as RSD administrator -To be able to login as rsd adminstrator you will need to provide the email address of the logged in user in the `RSD_ADMIN_EMAIL_LIST` property of the .env file. In the example below we defined one rsd admin having the email `isaacnewton@university-example.org`. This is the email of SURFconext test account with the username professor3 which has this email address provided in the JWT token that RSD receives from the SURFconext authentication provider. +To be able to log in as RSD administrator, the account id of that account needs to be in the database table `admin_account` first. +To do so, [connect to the database](/rsd-instance/database/#connecting-to-the-database) and execute the following query, changing the value of the UUID: -```env -# Define a semicolon-separated list of user email addresses of RSD admins. -# When someome authenticates with an email address in this list, -# they will get a token with as role rsd_admin, meaning they -# have admin rights for all the tables. -# consumed by: authentication -RSD_ADMIN_EMAIL_LIST=isaacnewton@university-example.org +```sql +INSERT INTO admin_account VALUES ('00000000-0000-0000-0000-000000000000'); ``` :::tip -- When you login to RSD as administrator you will see additional "Administration" option in the profile dropdown menu. -- To define admin email for LOCAL account use @example.org email domain. For example for user `Tester` the email should be `tester@example.org` +A user can see their account ID in their user settings page, which they can find under the `My settings` option in the profile dropdown menu. +::: + +If that user is already logged in, they need to log out and log in again before they can make use of their admin rights. + +:::tip +When you log in to the RSD as administrator, you will see an additional "Administration" option in the profile dropdown menu. ::: ![Login as rsd admin](img/rsd-login-admin.gif) diff --git a/documentation/docs/03-rsd-instance/04-database.md b/documentation/docs/03-rsd-instance/04-database.md index 158033e77..b687ec4d9 100644 --- a/documentation/docs/03-rsd-instance/04-database.md +++ b/documentation/docs/03-rsd-instance/04-database.md @@ -1,9 +1,33 @@ -# Database structure +# Database + +This section contains various topics on the RSD database. + +## Database structure ![database diagram](img/database-scheme.webp) The SQL scripts used to [create tables, relations, RLS and RPC's are in the database folder of our repo](https://github.com/research-software-directory/RSD-as-a-service/tree/main/database). +## Connecting to the database + +In some cases, it can be useful to connect to the database directly, so you can query it. +To do so, first connect to the VM on which your RSD instance lives and go to the directory containing the `docker-compose.yml` file. +Then run the command + +```shell +docker compose exec database bash +``` + +to enter the database Docker container. +Then run + +```shell +psql --dbname=rsd-db --username=rsd +``` + +where you should replace the values if you set them differently in your `.env`. +You can now run arbitrary SQL queries as root user. + ## Database migration scripts We [publish database migration script during the release](https://github.com/research-software-directory/RSD-as-a-service/releases). The migration script can be used to upgrade the database structure from the previous version to released version. We use the published database migration script to update out production RSD instance. diff --git a/documentation/docs/03-rsd-instance/04-database.md.license b/documentation/docs/03-rsd-instance/04-database.md.license index 09eedce0c..715dce5aa 100644 --- a/documentation/docs/03-rsd-instance/04-database.md.license +++ b/documentation/docs/03-rsd-instance/04-database.md.license @@ -1,4 +1,5 @@ SPDX-FileCopyrightText: 2023 Dusan Mijatovic (Netherlands eScience Center) +SPDX-FileCopyrightText: 2023 Ewan Cahen (Netherlands eScience Center) SPDX-FileCopyrightText: 2023 Netherlands eScience Center SPDX-License-Identifier: CC-BY-4.0