Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename quatUser & quatPassword to something more descriptive #5785

Merged
merged 7 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<username>%USERNAME%</username>
<password>%PASSWORD%</password>
<database>%DATABASE%</database>
<quatUser>%USERNAME%</quatUser>
<quatPassword>%PASSWORD%</quatPassword>
<adminUser>%USERNAME%</adminUser>
<adminPassword>%PASSWORD%</adminPassword>
<name>Example database</name>
</database>

Expand All @@ -43,7 +43,7 @@
<seq type="alphanumeric" length="4"/> <!-- Ex: AAA0001-->
</structure>
</PSCID>

<ExternalID>
<generation>random</generation>
<structure>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ The Instrument Manager module is designed allow the Loris database Admin superus

To enable upload and installation of `*.linst` instrument files created using the Instrument Builder:

i. **Create a separate MySQL user account with CREATE, SELECT, INSERT, UPDATE and DELETE privileges** on the database. This credential should be stored in `project/config.xml` within the `<database>` tag section as `<quatUser>` and `<quatPassword>` :
i. **Create a separate MySQL user account with CREATE, SELECT, INSERT, UPDATE and DELETE privileges** on the database. This credential should be stored in `project/config.xml` within the `<database>` tag section as `<adminUser>` and `<adminPassword>` :
```xml
<database>
...
<quatUser>%USERNAME%</quatUser>
<quatPassword>%PASSWORD%</quatPassword>
<adminUser>%USERNAME%</adminUser>
<adminPassword>%PASSWORD%</adminPassword>
...
</database>
```

ii. **Ensure that the project-specific directories are Apache-writeable**: `project/instruments/` and `project/tables_sql/`

**[[NEXT: (4) Imaging Database|Imaging-Database]]**
**[[NEXT: (4) Imaging Database|Imaging-Database]]**
3 changes: 2 additions & 1 deletion modules/instrument_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ directories (to write the instrument itself, and instrument table
patch respectively.)

In order to automatically source the SQL patch and fully configure
LINST instruments, the LORIS `quatUser` and `quatPassword` configuration
LINST instruments, the LORIS `adminUser` and `adminPassword` configuration
must be set to a user which has the MySQL `CREATE TABLE` permission.

2 changes: 1 addition & 1 deletion modules/instrument_manager/jsx/instrumentManagerIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class InstrumentManagerIndex extends Component {
return (
<div className='alert alert-warning'>
Instrument installation is not possible given the current server
configuration; the LORIS 'quatUser' is not configured properly.
configuration; the LORIS 'adminUser' is not configured properly.
File upload is still possible but instruments will need to be
installed manually
</div>
Expand Down
22 changes: 11 additions & 11 deletions modules/instrument_manager/php/instrument_manager.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class Instrument_Manager extends \NDB_Menu_Filter
* Instead, inform users that an administrator must install it
* on their behalf.
* This should only happen for users on a system where automatic
* installation is disabled (ie. has no quatUser).
* installation is disabled (ie. has no adminUser).
*/
return new \LORIS\Http\Response\JSON\Conflict(
self::FILE_ALREADY_EXISTS
Expand All @@ -189,7 +189,7 @@ class Instrument_Manager extends \NDB_Menu_Filter
);

if (!$this->isQuatUserConfigured()) {
// If no quatUser is configured, automatic installation is not
// If no adminUser is configured, automatic installation is not
// possible, so this is the last step.
return (new \LORIS\Http\Response())
->withStatus(200, 'OK')
Expand Down Expand Up @@ -224,8 +224,8 @@ class Instrument_Manager extends \NDB_Menu_Filter
exec(
"mysql".
" -h" . escapeshellarg($db_config['host']).
" -u" . escapeshellarg($db_config['quatUser']).
" -p" . escapeshellarg($db_config['quatPassword']).
" -u" . escapeshellarg($db_config['adminUser']).
" -p" . escapeshellarg($db_config['adminPassword']).
" " . escapeshellarg($db_config['database']).
" < " . $this->path . "project/tables_sql/".
escapeshellarg($table_name . '.sql'),
Expand Down Expand Up @@ -591,21 +591,21 @@ class Instrument_Manager extends \NDB_Menu_Filter
}

/**
* Return whether the quatUser is properly configured, ie. credentials are
* Return whether the adminUser is properly configured, ie. credentials are
* set and are valid.
* The quatUser is a MySQL user with CREATE table permissions.
* The adminUser is a MySQL user with CREATE table permissions.
* `empty` is used instead of `isset` as blank values in the config file
* are still considered set.
*
* @return bool True if a quatUser is configured properly. False if not.
* @return bool True if a adminUser is configured properly. False if not.
*/
protected function isQuatUserConfigured() : bool
{
$db = $this->factory->database();
$db_config = $this->factory->config()->getSetting('database');

$credentials_set = !empty($db_config['quatUser'])
&& !empty($db_config['quatPassword']);
$credentials_set = !empty($db_config['adminUser'])
&& !empty($db_config['adminPassword']);
if (!$credentials_set) {
return false;
}
Expand All @@ -615,8 +615,8 @@ class Instrument_Manager extends \NDB_Menu_Filter
try {
$connected = $db->connect(
$db_config['database'],
$db_config['quatUser'],
$db_config['quatPassword'],
$db_config['adminUser'],
$db_config['adminPassword'],
$db_config['host'],
false
);
Expand Down
4 changes: 2 additions & 2 deletions raisinbread/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<username>%USERNAME%</username>
<password>%PASSWORD%</password>
<database>%DATABASE%</database>
<quatUser>%USERNAME%</quatUser>
<quatPassword>%PASSWORD%</quatPassword>
<adminUser>%USERNAME%</adminUser>
<adminPassword>%PASSWORD%</adminPassword>
<name>Example database</name>
</database>

Expand Down
6 changes: 3 additions & 3 deletions test/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<username>SQLTestUser</username>
<password>TestPassword</password>
<database>LorisTest</database>
<quatUser>SQLTestUser</quatUser>
<quatPassword>TestPassword</quatPassword>
<adminUser>SQLTestUser</adminUser>
<adminPassword>TestPassword</adminPassword>
<name>Example database</name>
</database>

Expand All @@ -39,7 +39,7 @@
<seq type="alphanumeric" length="4"/> <!-- Ex: AAA0001-->
</structure>
</PSCID>

<ExternalID>
<generation>random</generation>
<structure>
Expand Down
10 changes: 5 additions & 5 deletions tools/exporters/DB_dump_table_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
array("dbn"=>$databaseInfo['database'])
);

$dbUser = $databaseInfo["quatUser"];
$dbPassword = $databaseInfo["quatPassword"];
$adminUser = $databaseInfo["adminUser"];
$adminPassword = $databaseInfo["adminPassword"];
$dbHost = $databaseInfo["host"];

if (empty($dbUser) || empty($dbPassword) || empty($dbHost)) {
if (empty($adminUser) || empty($adminPassword) || empty($dbHost)) {
echo "\n\n Some database credentials are missing, please ensure administrator
credentials (quatUser, quatPassword) and a host value are available in your
credentials (adminUser, adminPassword) and a host value are available in your
configuration file. \n\n";
die();
}
Expand Down Expand Up @@ -71,7 +71,7 @@
foreach ($tableNames as $tableName) {
$paths = \NDB_Config::singleton()->getSetting('paths');
$filename = $paths['base'] . "/raisinbread/RB_files/RB_$tableName.sql";
exec('mysqldump -u '.escapeshellarg($dbUser).' -p'.escapeshellarg($dbPassword).' -h '.escapeshellarg($dbHost).' '.
exec('mysqldump -u '.escapeshellarg($adminUser).' -p'.escapeshellarg($adminPassword).' -h '.escapeshellarg($dbHost).' '.
escapeshellarg($databaseInfo['database']).' '.
'--complete-insert '.
'--no-create-db '.
Expand Down
4 changes: 2 additions & 2 deletions tools/single_use/Engine_Change_MyISAM_to_INNODB.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
$dbConfig = $config->getSetting("database");
$adminDB = Database::singleton(
$dbConfig["database"],
$dbConfig["quatUser"],
$dbConfig["quatPassword"],
$dbConfig["adminUser"],
$dbConfig["adminPassword"],
$dbConfig["host"],
true
);
Expand Down