- Controller system/Filters now extends CI_Controller

- Added private method _isAllowed to controller system/Filters
- The method _isAllowed is called in the controller constructor and checks if the caller has the permission to read data with this instance of the FilterWidget
- The permission is given as parameter when calling the FilterWidget, the parameter is called requiredPermissions
- Updated the view system/infocenter/infocenterData to give the infocenter permission to the FilterWidget
- Changed the logic into the FilterWidget to manage the requiredPermissions parameter
This commit is contained in:
Paolo
2018-03-29 16:53:38 +02:00
parent dda27c7d6e
commit 49e24b0431
3 changed files with 54 additions and 5 deletions
+14
View File
@@ -18,6 +18,7 @@ class FilterWidget extends Widget
const HIDE_HEADER = 'hideHeader';
const HIDE_SAVE = 'hideSave';
const COLUMNS_ALIASES = 'columnsAliases';
const REQUIRED_PERMISSIONS = 'requiredPermissions';
const DATASET_PARAMETER = 'dataset';
const METADATA_PARAMETER = 'metaData';
@@ -78,6 +79,7 @@ class FilterWidget extends Widget
private $checkboxes;
private $columnsAliases;
private $filterName;
private $requiredPermissions;
private $dataset;
private $metaData;
@@ -164,6 +166,7 @@ class FilterWidget extends Widget
$filterSessionArray[self::COLUMNS_ALIASES] = $this->_getColumnAliasesFromPost();
$filterSessionArray[self::CHECKBOXES] = $this->checkboxes;
$filterSessionArray[self::REQUIRED_PERMISSIONS] = $this->requiredPermissions;
if ($this->app != null)
{
@@ -482,6 +485,11 @@ class FilterWidget extends Widget
$filterSessionArray[self::DATASET_NAME_PARAMETER] = null;
}
if (!isset($filterSessionArray[self::REQUIRED_PERMISSIONS]))
{
$filterSessionArray[self::REQUIRED_PERMISSIONS] = null;
}
$this->session->set_userdata(self::SESSION_NAME, $filterSessionArray);
}
@@ -503,6 +511,7 @@ class FilterWidget extends Widget
$this->hideSave = false;
$this->columnsAliases = null;
$this->filterName = null;
$this->requiredPermissions = null;
if (!is_array($args) || (is_array($args) && count($args) == 0))
{
@@ -589,6 +598,11 @@ class FilterWidget extends Widget
{
$this->columnsAliases = $args[self::COLUMNS_ALIASES];
}
if (isset($args[self::REQUIRED_PERMISSIONS]))
{
$this->requiredPermissions = $args[self::REQUIRED_PERMISSIONS];
}
}
}