Merge branch 'feature-25562/PV21_Vertraege_Encryption_Merge'

This commit is contained in:
Werner Masik
2023-03-28 20:12:40 +02:00
parent 279ddddfc8
commit c52cd05436
42 changed files with 3812 additions and 52 deletions
+31 -2
View File
@@ -1,5 +1,22 @@
<?php
/**
* Copyright (C) 2023 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* To display a table that shows data retriev by a SQL statement
*/
@@ -40,6 +57,8 @@ class TableWidget extends Widget
private $_sessionTimeout; // session expiring time
private $_encryptedColumns; // contains info about encrypted columns
private static $_TableWidgetInstance; // static property that contains the instance of itself
/**
@@ -127,6 +146,7 @@ class TableWidget extends Widget
$this->_datasetRepresentationOptions = null;
$this->_datasetRepFieldsDefs = null;
$this->_sessionTimeout = TableWidgetLib::SESSION_DEFAULT_TIMEOUT;
$this->_encryptedColumns = null;
// Retrieved the required permissions parameter if present
if (isset($args[TableWidgetLib::REQUIRED_PERMISSIONS]))
@@ -206,6 +226,14 @@ class TableWidget extends Widget
{
$this->_sessionTimeout = $args[TableWidgetLib::SESSION_TIMEOUT];
}
// Parameter is used to define the ecrypted columns
if (isset($args[TableWidgetLib::ENCRYPTED_COLUMNS])
&& is_array($args[TableWidgetLib::ENCRYPTED_COLUMNS])
&& count($args[TableWidgetLib::ENCRYPTED_COLUMNS]) > 0)
{
$this->_encryptedColumns = $args[TableWidgetLib::ENCRYPTED_COLUMNS];
}
}
/**
@@ -288,7 +316,7 @@ class TableWidget extends Widget
$datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
// Then retrieve dataset from DB
$dataset = $this->tablewidgetlib->getDataset($datasetQuery);
$dataset = $this->tablewidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -310,7 +338,7 @@ class TableWidget extends Widget
$datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
// Then retrieve dataset from DB
$dataset = $this->tablewidgetlib->getDataset($datasetQuery);
$dataset = $this->tablewidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -324,6 +352,7 @@ class TableWidget extends Widget
TableWidgetLib::SESSION_FIELDS => $this->tablewidgetlib->getExecutedQueryListFields(), // all the fields of the dataset
TableWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
TableWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
TableWidgetLib::SESSION_ENCRYPTED_COLUMNS => $this->_encryptedColumns, // encrypted columns
TableWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
TableWidgetLib::SESSION_METADATA => $this->tablewidgetlib->getExecutedQueryMetaData(), // the metadata of the dataset
TableWidgetLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this table