Querying Project Database
In some customized versions of openBIS an additional project-specific database is storing data from registered data sets. This database can be queried via SQL Select statements in openBIS Web application. In order to protect modification of this database by malicious SQL code openBIS application server should access this database as a user which is member of a read-only group. The name of this read-only group is project specific.
Note
It is possible to configure openBIS to query multiple project-specific databases.
Create Read-Only User in PostgreSQL
A new user (aka role) is created by
CREATE ROLE <read-only user> LOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE;
This new user is added to the read-only group by the following command:
GRANT <read-only group> TO <read-only user>;
The name of the read-only group can be obtained by having a look into the list of all groups:
SELECT * from PG_GROUP;
Note that by default openBIS creates a user openbis_readonly
which has read-only permissions to all database objects. You can use
this user to access the openBIS meta database through the openBIS query
interface.
Enable Querying
To enable querying functionality for additional databases in openBIS Web application a core plugin of type query-databases has to be created. The following plugin.properties have to be specified:
Property |
Description |
|---|---|
label |
Label of the database. It will be used in the Web application in drop down lists for adding / editing customized queries. |
database-driver |
JDBC Driver of the database, e.g. org.postgresql.Driver for postgresql. |
database-url |
JDBC URL to the database containing full database name, e.g. jdbc:postgresql://localhost/database_name for postgresql |
database-username |
Above-mentioned defined read-only user. |
database-password |
Password of the read-only user. |