Skip to content

Commit

Permalink
finalized sql
Browse files Browse the repository at this point in the history
  • Loading branch information
ridz1208 committed Nov 21, 2024
1 parent 1e64ea5 commit 410bceb
Show file tree
Hide file tree
Showing 18 changed files with 321 additions and 588 deletions.
1 change: 1 addition & 0 deletions SQL/0000-00-01-Modules.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ INSERT INTO modules (Name, Active) VALUES ('acknowledgements', 'Y');
INSERT INTO modules (Name, Active) VALUES ('api', 'Y');
INSERT INTO modules (Name, Active) VALUES ('battery_manager', 'Y');
INSERT INTO modules (Name, Active) VALUES ('behavioural_qc', 'Y');
INSERT INTO modules (Name, Active) VALUES ('biobank', 'Y');
INSERT INTO modules (Name, Active) VALUES ('brainbrowser', 'Y');
INSERT INTO modules (Name, Active) VALUES ('bvl_feedback', 'Y');
INSERT INTO modules (Name, Active) VALUES ('candidate_list', 'Y');
Expand Down
12 changes: 11 additions & 1 deletion SQL/0000-00-02-Permission.sql
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,17 @@ INSERT INTO `permissions` VALUES
(64,'dataquery_admin','Admin dataquery queries',(SELECT ID FROM modules WHERE Name='dataquery'),NULL,'2'),
(65,'schedule_module','Schedule Module - edit and delete the appointment',(SELECT ID FROM modules WHERE Name='schedule_module'),'View/Create/Edit','2'),
(66,'document_repository_categories','Categories',(SELECT ID FROM modules WHERE Name='document_repository'), 'Edit/Upload/Delete', '2'),
(67,'document_repository_hidden','Restricted files',(SELECT ID FROM modules WHERE Name='document_repository'), 'View', '2');
(67,'document_repository_hidden','Restricted files',(SELECT ID FROM modules WHERE Name='document_repository'), 'View', '2'),
(68,'biobank_specimen_view','View Specimen Data',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(69,'biobank_specimen_create','Create Specimens',(SELECT ID FROM modules WHERE Name='biobank'), 'Create', '2'),
(70,'biobank_specimen_edit','Edit Specimen Data',(SELECT ID FROM modules WHERE Name='biobank'), 'Edit', '2'),
(71,'biobank_container_view','View Container Data',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(72,'biobank_container_create','Create Containers',(SELECT ID FROM modules WHERE Name='biobank'), 'Create', '2'),
(73,'biobank_container_edit','Edit Container Data',(SELECT ID FROM modules WHERE Name='biobank'), 'Edit', '2'),
(74,'biobank_pool_view','View Pool Data',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(75,'biobank_pool_create','Create Pools',(SELECT ID FROM modules WHERE Name='biobank'), 'Create', '2'),
(76,'biobank_fullsiteaccess','Full Site Access',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(77,'biobank_fullprojectaccess','Full Project Access',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2');

INSERT INTO `user_perm_rel` (userID, permID)
SELECT u.ID, p.permID
Expand Down
714 changes: 244 additions & 470 deletions modules/biobank/sql/schema.sql → SQL/0000-00-06-BiobankTables.sql

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions SQL/9999-99-99-drop_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,38 @@ DROP TABLE IF EXISTS dataquery_run_queries;
DROP TABLE IF EXISTS dataquery_query_names;
DROP TABLE IF EXISTS dataquery_queries;

-- 0000-00-6-BiobankTables.sql
DROP TABLE IF EXISTS `biobank_container_shipment_rel`;
DROP TABLE IF EXISTS `shipment`;
DROP TABLE IF EXISTS `shipment_log`;
DROP TABLE IF EXISTS `shipment_status`;
DROP TABLE IF EXISTS `shipment_type`;
DROP TABLE IF EXISTS `biobank_specimen_pool_rel`;
DROP TABLE IF EXISTS `biobank_pool`;
DROP TABLE IF EXISTS `biobank_specimen_project_rel`;
DROP TABLE IF EXISTS `biobank_specimen_parent`;
DROP TABLE IF EXISTS `biobank_specimen_analysis`;
DROP TABLE IF EXISTS `biobank_specimen_preparation`;
DROP TABLE IF EXISTS `biobank_specimen_collection`;
DROP TABLE IF EXISTS `biobank_specimen_freezethaw`;
DROP TABLE IF EXISTS `biobank_specimen`;
DROP TABLE IF EXISTS `biobank_specimen_protocol_attribute_rel`;
DROP TABLE IF EXISTS `biobank_specimen_protocol`;
DROP TABLE IF EXISTS `biobank_specimen_attribute`;
DROP TABLE IF EXISTS `biobank_specimen_attribute_datatype`;
DROP TABLE IF EXISTS `biobank_specimen_process`;
DROP TABLE IF EXISTS `biobank_specimen_type_parent`;
DROP TABLE IF EXISTS `biobank_specimen_type_container_type_rel`;
DROP TABLE IF EXISTS `biobank_specimen_type_unit_rel`;
DROP TABLE IF EXISTS `biobank_specimen_type`;
DROP TABLE IF EXISTS `biobank_container_parent`;
DROP TABLE IF EXISTS `biobank_container`;
DROP TABLE IF EXISTS `biobank_container_type`;
DROP TABLE IF EXISTS `biobank_container_status`;
DROP TABLE IF EXISTS `biobank_container_capacity`;
DROP TABLE IF EXISTS `biobank_container_dimension`;
DROP TABLE IF EXISTS `biobank_unit`;

-- 0000-00-05-ElectrophysiologyTables.sql
DROP TABLE IF EXISTS `physiological_event_parameter_category_level`;
DROP TABLE IF EXISTS `physiological_event_parameter`;
Expand Down
13 changes: 13 additions & 0 deletions SQL/New_patches/2024-11-21_biobank_addmodule.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
INSERT INTO modules (Name, Active) VALUES ('biobank', 'Y');

INSERT INTO `permissions` VALUES
(68,'biobank_specimen_view','View Specimen Data',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(69,'biobank_specimen_create','Create Specimens',(SELECT ID FROM modules WHERE Name='biobank'), 'Create', '2'),
(70,'biobank_specimen_edit','Edit Specimen Data',(SELECT ID FROM modules WHERE Name='biobank'), 'Edit', '2'),
(71,'biobank_container_view','View Container Data',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(72,'biobank_container_create','Create Containers',(SELECT ID FROM modules WHERE Name='biobank'), 'Create', '2'),
(73,'biobank_container_edit','Edit Container Data',(SELECT ID FROM modules WHERE Name='biobank'), 'Edit', '2'),
(74,'biobank_pool_view','View Pool Data',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(75,'biobank_pool_create','Create Pools',(SELECT ID FROM modules WHERE Name='biobank'), 'Create', '2'),
(76,'biobank_fullsiteaccess','Full Site Access',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2'),
(77,'biobank_fullprojectaccess','Full Project Access',(SELECT ID FROM modules WHERE Name='biobank'), 'View', '2');
2 changes: 1 addition & 1 deletion modules/biobank/jsx/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BiobankContainer extends Component {
const {current, data, editable, options, container} = this.props;

const checkoutButton = () => {
if (!(loris.userHasPermission('biobank_container_update'))
if (!(loris.userHasPermission('biobank_container_edit'))
|| (data.containers[container.id].childContainerIds.length == 0)
) {
return;
Expand Down
4 changes: 2 additions & 2 deletions modules/biobank/jsx/containerDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function ContainerDisplay(props) {
'<h5>'+optcon.stati[children[coord].statusId].label+'</h5>';
}
draggable = !loris.userHasPermission(
'biobank_container_update') ||
'biobank_container_edit') ||
editable.loadContainer ||
editable.containerCheckout
? 'false' : 'true';
Expand All @@ -281,7 +281,7 @@ function ContainerDisplay(props) {
}
onDragOver = null;
onDrop = null;
} else if (loris.userHasPermission('biobank_container_update') &&
} else if (loris.userHasPermission('biobank_container_edit') &&
!editable.containerCheckout) {
nodeClass = coordinate == current.coordinate ?
'node selected' : 'node load';
Expand Down
6 changes: 3 additions & 3 deletions modules/biobank/jsx/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Globals(props)
/>
);

const edit = loris.userHasPermission('biobank_specimen_alter')
const edit = loris.userHasPermission('biobank_specimen_edit')
&& specimen && (
() => {
props.edit('containerType');
Expand Down Expand Up @@ -118,7 +118,7 @@ function Globals(props)
// };
// const increaseCycle = () => changeCycle(1);
// const decreaseCycle = () => changeCycle(-1);
// const updateFTCycle = loris.userHasPermission('biobank_specimen_update') ? (
// const updateFTCycle = loris.userHasPermission('biobank_specimen_edit') ? (
// <div>
// {specimen.fTCycle > 0 ? (
// <div className='action' title='Remove Cycle'>
Expand Down Expand Up @@ -311,7 +311,7 @@ function Globals(props)
};

const updateParentContainer = () => {
if (loris.userHasPermission('biobank_container_update')) {
if (loris.userHasPermission('biobank_container_edit')) {
return (
<div>
<div className='action' title='Move Container'>
Expand Down
6 changes: 3 additions & 3 deletions modules/biobank/jsx/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Header extends Component {
};

const alterLotNumber = () => {
if (loris.userHasPermission('biobank_specimen_alter')) {
if (loris.userHasPermission('biobank_specimen_edit')) {
return (
<div className='action' title='Alter Lot Number'>
<span
Expand All @@ -86,7 +86,7 @@ class Header extends Component {
};

const alterExpirationDate = () => {
if (loris.userHasPermission('biobank_specimen_alter')) {
if (loris.userHasPermission('biobank_specimen_edit')) {
return (
<div className='action' title='Alter Expiration Date'>
<span
Expand Down Expand Up @@ -203,7 +203,7 @@ function ContainerCheckout(props)
.then(() => props.updateContainer());
};

return (loris.userHasPermission('biobank_container_update') &&
return (loris.userHasPermission('biobank_container_edit') &&
props.container.parentContainerId) ? (
<div className='action'>
<div
Expand Down
2 changes: 1 addition & 1 deletion modules/biobank/jsx/specimen.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function ProcessPanel(props)
if (protocolExists
&& !specimen[process]
&& !editable[process]
&& loris.userHasPermission('biobank_specimen_update')
&& loris.userHasPermission('biobank_specimen_edit')
) {
const addProcess = () => props.addProcess(process);
panel = (
Expand Down
2 changes: 1 addition & 1 deletion modules/biobank/jsx/specimenForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class SpecimenForm extends React.Component {

const renderRemainingQuantityFields = () => {
if (parent) {
if (loris.userHasPermission('biobank_specimen_update')
if (loris.userHasPermission('biobank_specimen_edit')
&& parent.length === 1
) {
const specimenUnits = mapFormOptions(
Expand Down
4 changes: 2 additions & 2 deletions modules/biobank/jsx/specimenTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,15 @@ class SpecimenTab extends Component {
onClose={this.clearEditable}
onSubmit={this.props.createPool}
/> : null}
{loris.userHasPermission('biobank_specimen_update') ?
{loris.userHasPermission('biobank_specimen_edit') ?
<BatchProcessForm
show={editable.batchProcessForm}
onClose={this.clearEditable}
onSubmit={this.props.updateSpecimens}
options={this.props.options}
data={this.props.data}
/> : null}
{loris.userHasPermission('biobank_specimen_update') ?
{loris.userHasPermission('biobank_specimen_edit') ?
<BatchEditForm
show={editable.batchEditForm}
onClose={this.clearEditable}
Expand Down
2 changes: 1 addition & 1 deletion modules/biobank/php/containercontroller.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ContainerController
}
break;
case 'update':
if (!$this->user->hasPermission('biobank_container_update')) {
if (!$this->user->hasPermission('biobank_container_edit')) {
throw new Forbidden('Container: Update Permission Denied');
}
break;
Expand Down
3 changes: 2 additions & 1 deletion modules/biobank/php/preparation.class.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php declare(strict_types=1);

/**
* This class represents a specimen preparation process and extends the `Process` class.
* This class represents a specimen preparation process and extends the
* `Process` class.
*
* @category Entity
* @package LORIS
Expand Down
4 changes: 3 additions & 1 deletion modules/biobank/php/shipment.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class Shipment implements
$this->id = $data['id'] ?? null;
$this->barcode = $data['barcode'] ?? null;
$this->type = $data['type'] ?? null;
$this->destinationCenterId = new \CenterID($data['destinationCenterId'] ?? null);
$this->destinationCenterId = new \CenterID(
$data['destinationCenterId'] ?? null
);
$this->containerIds = $data['containerIds'] ?? null;
$this->containerBarcodes = $data['containerBarcodes'] ?? null;
$this->_setLogs($data['logs']) ?? null;
Expand Down
2 changes: 1 addition & 1 deletion modules/biobank/php/specimencontroller.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class SpecimenController
}
break;
case 'update':
if (!$this->user->hasPermission('biobank_specimen_update')) {
if (!$this->user->hasPermission('biobank_specimen_edit')) {
throw new Forbidden('Specimen: Update Permission Denied');
}
break;
Expand Down
67 changes: 0 additions & 67 deletions modules/biobank/sql/data.sql

This file was deleted.

33 changes: 0 additions & 33 deletions modules/biobank/sql/permissions.sql

This file was deleted.

0 comments on commit 410bceb

Please sign in to comment.