Release of v1.1.6
This commit is contained in:
parent
89e6bd46ad
commit
d3870cb5d0
@ -14,7 +14,10 @@ defined('_JEXEC') or die('Restricted access');
|
|||||||
|
|
||||||
use Joomla\CMS\Application\CMSApplication;
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
use Joomla\CMS\Plugin\CMSPlugin;
|
use Joomla\CMS\Plugin\CMSPlugin;
|
||||||
use Joomla\Registry\Registry;
|
use Joomla\Registry\Registry;
|
||||||
|
use VDM\Joomla\Utilities\JsonHelper;
|
||||||
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
|
|
||||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
||||||
|
|
||||||
@ -27,7 +30,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
|||||||
* Extension - Componentbuilder Privacy Compiler plugin.
|
* Extension - Componentbuilder Privacy Compiler plugin.
|
||||||
*
|
*
|
||||||
* @package ComponentbuilderPrivacyCompiler
|
* @package ComponentbuilderPrivacyCompiler
|
||||||
* @since 1.1.4
|
* @since 1.1.6
|
||||||
*/
|
*/
|
||||||
class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
||||||
{
|
{
|
||||||
@ -70,20 +73,6 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
*/
|
*/
|
||||||
protected $permissionFields = array();
|
protected $permissionFields = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* The permissions core
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $permissionCore = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The permissions Builder
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $permissionBuilder = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event Triggered in the compiler [on Before Model View Data]
|
* Event Triggered in the compiler [on Before Model View Data]
|
||||||
*
|
*
|
||||||
@ -94,8 +83,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
public function jcb_ce_onBeforeModelViewData(&$context, &$view, &$placeholders)
|
public function jcb_ce_onBeforeModelViewData(&$context, &$view, &$placeholders)
|
||||||
{
|
{
|
||||||
// add the privacy
|
// add the privacy
|
||||||
$view->params = (isset($view->params) && ComponentbuilderHelper::checkJson($view->params)) ? json_decode($view->params, true) : $view->params;
|
$view->params = (isset($view->params) && JsonHelper::check($view->params)) ? json_decode($view->params, true) : $view->params;
|
||||||
if (ComponentbuilderHelper::checkArray($view->params) && isset($view->params['privacy']) && ComponentbuilderHelper::checkArray($view->params['privacy']) &&
|
if (ArrayHelper::check($view->params) && isset($view->params['privacy']) && ArrayHelper::check($view->params['privacy']) &&
|
||||||
isset($view->params['privacy']['activate']) && $view->params['privacy']['activate'] == 1)
|
isset($view->params['privacy']['activate']) && $view->params['privacy']['activate'] == 1)
|
||||||
{
|
{
|
||||||
// activate the load of the privacy plugin
|
// activate the load of the privacy plugin
|
||||||
@ -103,8 +92,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
// load the admin view details
|
// load the admin view details
|
||||||
$this->activeViews[$view->id] = $view;
|
$this->activeViews[$view->id] = $view;
|
||||||
// add permissions
|
// add permissions
|
||||||
$view->addpermissions = (isset($view->addpermissions) && ComponentbuilderHelper::checkJson($view->addpermissions)) ? json_decode($view->addpermissions, true) : null;
|
$view->addpermissions = (isset($view->addpermissions) && JsonHelper::check($view->addpermissions)) ? json_decode($view->addpermissions, true) : null;
|
||||||
if (ComponentbuilderHelper::checkArray($view->addpermissions))
|
if (ArrayHelper::check($view->addpermissions))
|
||||||
{
|
{
|
||||||
$view->addpermissions = array_values($view->addpermissions);
|
$view->addpermissions = array_values($view->addpermissions);
|
||||||
// add the new permissions
|
// add the new permissions
|
||||||
@ -121,25 +110,6 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Event Triggered in the compiler [on After Build Access Sections]
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public function jcb_ce_onAfterBuildAccessSections(&$context, $compiler)
|
|
||||||
{
|
|
||||||
// check if this component needs a privacy plugin loaded
|
|
||||||
if ($this->loadPrivacy)
|
|
||||||
{
|
|
||||||
// get the permission builder array
|
|
||||||
$this->permissionBuilder = $compiler->permissionBuilder;
|
|
||||||
// get the permission core array
|
|
||||||
$this->permissionCore = $compiler->permissionCore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event Triggered in the compiler [on After Get]
|
* Event Triggered in the compiler [on After Get]
|
||||||
*
|
*
|
||||||
@ -154,7 +124,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
{
|
{
|
||||||
$plugin = JPluginHelper::getPlugin('content', 'componentbuilderprivacytabs');
|
$plugin = JPluginHelper::getPlugin('content', 'componentbuilderprivacytabs');
|
||||||
// check if this is json
|
// check if this is json
|
||||||
if (isset($plugin->params) && ComponentbuilderHelper::checkJson($plugin->params))
|
if (isset($plugin->params) && JsonHelper::check($plugin->params))
|
||||||
{
|
{
|
||||||
// Convert the params field to an array.
|
// Convert the params field to an array.
|
||||||
$registry = new Registry;
|
$registry = new Registry;
|
||||||
@ -185,7 +155,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
public function jcb_ce_onBeforeUpdateFiles(&$context, $compiler)
|
public function jcb_ce_onBeforeUpdateFiles(&$context, $compiler)
|
||||||
{
|
{
|
||||||
// check if privacy is to be loaded
|
// check if privacy is to be loaded
|
||||||
if ($this->loadPrivacy && ComponentbuilderHelper::checkArray($this->activeViews))
|
if ($this->loadPrivacy && ArrayHelper::check($this->activeViews))
|
||||||
{
|
{
|
||||||
// get compiler defaults
|
// get compiler defaults
|
||||||
$strictFieldExportPermissions = $compiler->strictFieldExportPermissions;
|
$strictFieldExportPermissions = $compiler->strictFieldExportPermissions;
|
||||||
@ -204,11 +174,11 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
$compiler->exportTextOnly = 1;
|
$compiler->exportTextOnly = 1;
|
||||||
|
|
||||||
// set view list name
|
// set view list name
|
||||||
$viewName_list = ComponentbuilderHelper::safeString($view->name_list);
|
$viewName_list = StringHelper::safe($view->name_list);
|
||||||
// set view single name
|
// set view single name
|
||||||
$viewName_single = ComponentbuilderHelper::safeString($view->name_single);
|
$viewName_single = StringHelper::safe($view->name_single);
|
||||||
// load the function
|
// load the function
|
||||||
CFactory::_('Content')->add_($viewName_list, 'MODELEXPORTMETHOD',
|
CFactory::_('Compiler.Builder.Content.Multi')->add($viewName_list . '|MODELEXPORTMETHOD',
|
||||||
$compiler->setGetItemsModelMethod(
|
$compiler->setGetItemsModelMethod(
|
||||||
$viewName_single,
|
$viewName_single,
|
||||||
$viewName_list,
|
$viewName_list,
|
||||||
@ -222,7 +192,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
// get the permissions building values for later if needed
|
// get the permissions building values for later if needed
|
||||||
if ($compiler->strictFieldExportPermissions &&
|
if ($compiler->strictFieldExportPermissions &&
|
||||||
isset($compiler->permissionFields[$viewName_single]) &&
|
isset($compiler->permissionFields[$viewName_single]) &&
|
||||||
ComponentbuilderHelper::checkArray($compiler->permissionFields[$viewName_single]))
|
ArrayHelper::check($compiler->permissionFields[$viewName_single]))
|
||||||
{
|
{
|
||||||
$this->permissionFields[$viewName_single] = $compiler->permissionFields[$viewName_single];
|
$this->permissionFields[$viewName_single] = $compiler->permissionFields[$viewName_single];
|
||||||
}
|
}
|
||||||
@ -242,8 +212,8 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
|
|
||||||
foreach ($helper_strings as $helper)
|
foreach ($helper_strings as $helper)
|
||||||
{
|
{
|
||||||
if (($helper_content = CFactory::_('Content')->get($helper)) !== null &&
|
if (($helper_content = CFactory::_('Compiler.Builder.Content.One')->get($helper)) !== null &&
|
||||||
ComponentbuilderHelper::checkString($helper_content))
|
StringHelper::check($helper_content))
|
||||||
{
|
{
|
||||||
foreach ($privacy_events as $privacy_event => &$add)
|
foreach ($privacy_events as $privacy_event => &$add)
|
||||||
{
|
{
|
||||||
@ -258,7 +228,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add the events still needed
|
// add the events still needed
|
||||||
CFactory::_('Content')->add('BOTH_CUSTOM_HELPER_SCRIPT',
|
CFactory::_('Compiler.Builder.Content.One')->add('BOTH_CUSTOM_HELPER_SCRIPT',
|
||||||
CFactory::_('Placeholder')->update_($this->getHelperMethod($privacy_events))
|
CFactory::_('Placeholder')->update_($this->getHelperMethod($privacy_events))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -273,7 +243,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
*/
|
*/
|
||||||
public function jcb_ce_onBeforeSetLangFileData(&$context, $compiler)
|
public function jcb_ce_onBeforeSetLangFileData(&$context, $compiler)
|
||||||
{
|
{
|
||||||
if (ComponentbuilderHelper::checkArray($this->languageArray))
|
if (ArrayHelper::check($this->languageArray))
|
||||||
{
|
{
|
||||||
foreach($this->languageArray as $key => $string)
|
foreach($this->languageArray as $key => $string)
|
||||||
{
|
{
|
||||||
@ -304,7 +274,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// only add header if there was events added
|
// only add header if there was events added
|
||||||
if (ComponentbuilderHelper::checkString($methods))
|
if (StringHelper::check($methods))
|
||||||
{
|
{
|
||||||
$methods = PHP_EOL . PHP_EOL . Indent::_(1) . "//" . Line::_(__Line__, __Class__) . " <<<=== Privacy integration with Joomla Privacy suite ===>>>" . PHP_EOL . $methods;
|
$methods = PHP_EOL . PHP_EOL . Indent::_(1) . "//" . Line::_(__Line__, __Class__) . " <<<=== Privacy integration with Joomla Privacy suite ===>>>" . PHP_EOL . $methods;
|
||||||
}
|
}
|
||||||
@ -339,25 +309,16 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
foreach ($this->activeViews as $view)
|
foreach ($this->activeViews as $view)
|
||||||
{
|
{
|
||||||
// set view single name
|
// set view single name
|
||||||
$viewName_single = ComponentbuilderHelper::safeString($view->name_single);
|
$viewName_single = StringHelper::safe($view->name_single);
|
||||||
// setup correct core target
|
|
||||||
$coreLoad = false;
|
|
||||||
if (isset($this->permissionCore[$viewName_single]))
|
|
||||||
{
|
|
||||||
$core = $this->permissionCore[$viewName_single];
|
|
||||||
$coreLoad = true;
|
|
||||||
}
|
|
||||||
// load the canDo from getActions helper method
|
// load the canDo from getActions helper method
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delete " . $view->name_list;
|
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delete " . $view->name_list;
|
||||||
// set the if statement based on the permission builder
|
// set the if statement based on the permission builder
|
||||||
if ($coreLoad && isset($this->permissionBuilder[$core['core.delete']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.delete']]) && in_array($viewName_single, $this->permissionBuilder[$core['core.delete']]))
|
$methods .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('"
|
||||||
{
|
. CFactory::_('Builder.Permission')->getAction($viewName_single, 'core.delete')
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('" . $core['core.delete'] . "', 'com_" . Placefix::_("component") . "') && !\$user->authorise('" . $core['core.privacy.delete'] . "', 'com_" . Placefix::_("component") . "'))";
|
. "', 'com_" . Placefix::_("component") . "') && !\$user->authorise('"
|
||||||
}
|
. CFactory::_('Builder.Permission')->getAction($viewName_single, 'core.privacy.delete')
|
||||||
else
|
. "', 'com_" . Placefix::_("component") . "'))";
|
||||||
{
|
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (!\$user->authorise('core.delete', 'com_" . Placefix::_("component") . "') && !\$user->authorise('" . $core['core.privacy.delete'] . "', 'com_" . Placefix::_("component") . "'))";
|
|
||||||
}
|
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "{";
|
$methods .= PHP_EOL . Indent::_(2) . "{";
|
||||||
// set language key
|
// set language key
|
||||||
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")] . '_PRIVACY_CANT_REMOVE_' . $view->placeholders[Placefix::_("VIEWS")];
|
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")] . '_PRIVACY_CANT_REMOVE_' . $view->placeholders[Placefix::_("VIEWS")];
|
||||||
@ -369,7 +330,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")] . '_PRIVACY_CANT_REMOVE_CONTACT_SUPPORT';
|
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")] . '_PRIVACY_CANT_REMOVE_CONTACT_SUPPORT';
|
||||||
}
|
}
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if any reasons were found not to allow removal";
|
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if any reasons were found not to allow removal";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (self::checkArray(\$reasons))";
|
$methods .= PHP_EOL . Indent::_(2) . "if (ArrayHelper::check(\$reasons))";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "{";
|
$methods .= PHP_EOL . Indent::_(2) . "{";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "\$status->canRemove = false;";
|
$methods .= PHP_EOL . Indent::_(3) . "\$status->canRemove = false;";
|
||||||
// set language string
|
// set language string
|
||||||
@ -405,27 +366,17 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
foreach ($this->activeViews as $view)
|
foreach ($this->activeViews as $view)
|
||||||
{
|
{
|
||||||
// set view list name
|
// set view list name
|
||||||
$viewName_list = ComponentbuilderHelper::safeString($view->name_list);
|
$viewName_list = StringHelper::safe($view->name_list);
|
||||||
// set view single name
|
// set view single name
|
||||||
$viewName_single = ComponentbuilderHelper::safeString($view->name_single);
|
$viewName_single = StringHelper::safe($view->name_single);
|
||||||
// setup correct core target
|
|
||||||
$coreLoad = false;
|
|
||||||
if (isset($this->permissionCore[$viewName_single]))
|
|
||||||
{
|
|
||||||
$core = $this->permissionCore[$viewName_single];
|
|
||||||
$coreLoad = true;
|
|
||||||
}
|
|
||||||
// load the canDo from getActions helper method
|
// load the canDo from getActions helper method
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to access " . $view->name_list;
|
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to access " . $view->name_list;
|
||||||
// set the if statement based on the permission builder
|
// set the if statement based on the permission builder
|
||||||
if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.access']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.access']]))
|
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('"
|
||||||
{
|
. CFactory::_('Builder.Permission')->getGlobal($viewName_single, 'core.access')
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('" . $core['core.access'] . "', 'com_" . Placefix::_("component") . "') || \$user->authorise('" . $core['core.privacy.access'] . "', 'com_" . Placefix::_("component") . "'))";
|
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
|
||||||
}
|
. CFactory::_('Builder.Permission')->getGlobal($viewName_single, 'core.privacy.access')
|
||||||
else
|
. "', 'com_" . Placefix::_("component") . "'))";
|
||||||
{
|
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('" . $core['core.privacy.access'] . "', 'com_" . Placefix::_("component") . "'))";
|
|
||||||
}
|
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "{";
|
$methods .= PHP_EOL . Indent::_(2) . "{";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get " . $view->name_single . " domain";
|
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Get " . $view->name_single . " domain";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "\$domains[] = self::create" . ucfirst($viewName_list) . "Domain(\$plugin, \$user);";
|
$methods .= PHP_EOL . Indent::_(3) . "\$domains[] = self::create" . ucfirst($viewName_list) . "Domain(\$plugin, \$user);";
|
||||||
@ -437,9 +388,9 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
foreach ($this->activeViews as $view)
|
foreach ($this->activeViews as $view)
|
||||||
{
|
{
|
||||||
// set view list name
|
// set view list name
|
||||||
$viewName_list = ComponentbuilderHelper::safeString($view->name_list);
|
$viewName_list = StringHelper::safe($view->name_list);
|
||||||
// set view single name
|
// set view single name
|
||||||
$viewName_single = ComponentbuilderHelper::safeString($view->name_single);
|
$viewName_single = StringHelper::safe($view->name_single);
|
||||||
|
|
||||||
$methods .= PHP_EOL . Indent::_(1) . "/**";
|
$methods .= PHP_EOL . Indent::_(1) . "/**";
|
||||||
$methods .= PHP_EOL . Indent::_(1) . " * Create the domain for the " . $view->name_single;
|
$methods .= PHP_EOL . Indent::_(1) . " * Create the domain for the " . $view->name_single;
|
||||||
@ -492,7 +443,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Get all item details of " . $view->name_list . " that belong to this user";
|
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Get all item details of " . $view->name_list . " that belong to this user";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "\$items = \$model->getPrivacyExport(\$pks, \$user);";
|
$methods .= PHP_EOL . Indent::_(2) . "\$items = \$model->getPrivacyExport(\$pks, \$user);";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " check if we have items since permissions could block the request";
|
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " check if we have items since permissions could block the request";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (self::checkArray(\$items))";
|
$methods .= PHP_EOL . Indent::_(2) . "if (ArrayHelper::check(\$items))";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "{";
|
$methods .= PHP_EOL . Indent::_(2) . "{";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Remove " . $view->name_single . " default columns";
|
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Remove " . $view->name_single . " default columns";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "foreach (array('params', 'asset_id', 'checked_out', 'checked_out_time', 'created', 'created_by', 'modified', 'modified_by', 'published', 'ordering', 'access', 'version', 'hits') as \$column)";
|
$methods .= PHP_EOL . Indent::_(3) . "foreach (array('params', 'asset_id', 'checked_out', 'checked_out_time', 'created', 'created_by', 'modified', 'modified_by', 'published', 'ordering', 'access', 'version', 'hits') as \$column)";
|
||||||
@ -611,33 +562,23 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
{
|
{
|
||||||
// set the anonymize switch
|
// set the anonymize switch
|
||||||
$anonymize = false;
|
$anonymize = false;
|
||||||
if (isset($view->params['privacy']['anonymize']) && $view->params['privacy']['anonymize'] == 1 && isset($view->params['privacy']['anonymize_fields']) && ComponentbuilderHelper::checkArray($view->params['privacy']['anonymize_fields'], true))
|
if (isset($view->params['privacy']['anonymize']) && $view->params['privacy']['anonymize'] == 1 && isset($view->params['privacy']['anonymize_fields']) && ArrayHelper::check($view->params['privacy']['anonymize_fields'], true))
|
||||||
{
|
{
|
||||||
// Anonymize the data
|
// Anonymize the data
|
||||||
$anonymize = true;
|
$anonymize = true;
|
||||||
}
|
}
|
||||||
// set view list name
|
// set view list name
|
||||||
$viewName_list = ComponentbuilderHelper::safeString($view->name_list);
|
$viewName_list = StringHelper::safe($view->name_list);
|
||||||
// set view single name
|
// set view single name
|
||||||
$viewName_single = ComponentbuilderHelper::safeString($view->name_single);
|
$viewName_single = StringHelper::safe($view->name_single);
|
||||||
// setup correct core target
|
|
||||||
$coreLoad = false;
|
|
||||||
if (isset($this->permissionCore[$viewName_single]))
|
|
||||||
{
|
|
||||||
$core = $this->permissionCore[$viewName_single];
|
|
||||||
$coreLoad = true;
|
|
||||||
}
|
|
||||||
// load the canDo from getActions helper method
|
// load the canDo from getActions helper method
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delet " . $view->name_list;
|
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " Check if user has permission to delet " . $view->name_list;
|
||||||
// set the if statement based on the permission builder
|
// set the if statement based on the permission builder
|
||||||
if ($coreLoad && isset($this->permissionBuilder[$core['core.delete']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.delete']]) && in_array($viewName_single, $this->permissionBuilder[$core['core.delete']]))
|
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('"
|
||||||
{
|
. CFactory::_('Builder.Permission')->getAction($viewName_single, 'core.delete')
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('" . $core['core.delete'] . "', 'com_" . Placefix::_("component") . "') || \$user->authorise('" . $core['core.privacy.delete'] . "', 'com_" . Placefix::_("component") . "'))";
|
. "', 'com_" . Placefix::_("component") . "') || \$user->authorise('"
|
||||||
}
|
. CFactory::_('Builder.Permission')->getAction($viewName_single, 'core.privacy.delete')
|
||||||
else
|
. "', 'com_" . Placefix::_("component") . "'))";
|
||||||
{
|
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "if (\$user->authorise('core.delete', 'com_" . Placefix::_("component") . "') || \$user->authorise('" . $core['core.privacy.delete'] . "', 'com_" . Placefix::_("component") . "'))";
|
|
||||||
}
|
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "{";
|
$methods .= PHP_EOL . Indent::_(2) . "{";
|
||||||
// check if this is a plain delete, or it is a Anonymize
|
// check if this is a plain delete, or it is a Anonymize
|
||||||
if ($anonymize)
|
if ($anonymize)
|
||||||
@ -660,15 +601,15 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
{
|
{
|
||||||
// set the anonymize switch
|
// set the anonymize switch
|
||||||
$anonymize = false;
|
$anonymize = false;
|
||||||
if (isset($view->params['privacy']['anonymize']) && $view->params['privacy']['anonymize'] == 1 && isset($view->params['privacy']['anonymize_fields']) && ComponentbuilderHelper::checkArray($view->params['privacy']['anonymize_fields'], true))
|
if (isset($view->params['privacy']['anonymize']) && $view->params['privacy']['anonymize'] == 1 && isset($view->params['privacy']['anonymize_fields']) && ArrayHelper::check($view->params['privacy']['anonymize_fields'], true))
|
||||||
{
|
{
|
||||||
// Anonymize the data
|
// Anonymize the data
|
||||||
$anonymize = true;
|
$anonymize = true;
|
||||||
}
|
}
|
||||||
// set view list name
|
// set view list name
|
||||||
$viewName_list = ComponentbuilderHelper::safeString($view->name_list);
|
$viewName_list = StringHelper::safe($view->name_list);
|
||||||
// set view single name
|
// set view single name
|
||||||
$viewName_single = ComponentbuilderHelper::safeString($view->name_single);
|
$viewName_single = StringHelper::safe($view->name_single);
|
||||||
|
|
||||||
$methods .= PHP_EOL . Indent::_(1) . "/**";
|
$methods .= PHP_EOL . Indent::_(1) . "/**";
|
||||||
|
|
||||||
@ -739,7 +680,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " get all items for the " . $view->name_list . " table that belong to this user";
|
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " get all items for the " . $view->name_list . " table that belong to this user";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "\$pks = \$db->setQuery(\$query)->loadColumn();";
|
$methods .= PHP_EOL . Indent::_(2) . "\$pks = \$db->setQuery(\$query)->loadColumn();";
|
||||||
|
|
||||||
$methods .= PHP_EOL .PHP_EOL . Indent::_(2) . "if (self::checkArray(\$pks))";
|
$methods .= PHP_EOL .PHP_EOL . Indent::_(2) . "if (ArrayHelper::check(\$pks))";
|
||||||
$methods .= PHP_EOL . Indent::_(2) . "{";
|
$methods .= PHP_EOL . Indent::_(2) . "{";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " get the " . $viewName_single . " model";
|
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " get the " . $viewName_single . " model";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "\$model = self::getModel('" . $viewName_single . "', JPATH_ADMINISTRATOR . '/components/com_" . Placefix::_("component") . "');";
|
$methods .= PHP_EOL . Indent::_(3) . "\$model = self::getModel('" . $viewName_single . "', JPATH_ADMINISTRATOR . '/components/com_" . Placefix::_("component") . "');";
|
||||||
@ -770,7 +711,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
|
|
||||||
// add the permissional removal of values the user has not right to view or access
|
// add the permissional removal of values the user has not right to view or access
|
||||||
$hasPermissional = false;
|
$hasPermissional = false;
|
||||||
if (isset($this->permissionFields[$viewName_single]) && ComponentbuilderHelper::checkArray($this->permissionFields[$viewName_single]))
|
if (isset($this->permissionFields[$viewName_single]) && ArrayHelper::check($this->permissionFields[$viewName_single]))
|
||||||
{
|
{
|
||||||
foreach ($this->permissionFields[$viewName_single] as $fieldName => $permission_options)
|
foreach ($this->permissionFields[$viewName_single] as $fieldName => $permission_options)
|
||||||
{
|
{
|
||||||
@ -826,7 +767,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
$methods .= PHP_EOL . Indent::_(3) . "\$table = \$model->getTable();";
|
$methods .= PHP_EOL . Indent::_(3) . "\$table = \$model->getTable();";
|
||||||
|
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " check that we still have pseudoanonymised data for " . $view->name_list . " set";
|
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " check that we still have pseudoanonymised data for " . $view->name_list . " set";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "if (!self::checkArray(\$pseudoanonymisedData))";
|
$methods .= PHP_EOL . Indent::_(3) . "if (!ArrayHelper::check(\$pseudoanonymisedData))";
|
||||||
$methods .= PHP_EOL . Indent::_(3) . "{";
|
$methods .= PHP_EOL . Indent::_(3) . "{";
|
||||||
$methods .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " still archive all items";
|
$methods .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " still archive all items";
|
||||||
$methods .= PHP_EOL . Indent::_(4) . "\$table->publish(\$pks, 2);";
|
$methods .= PHP_EOL . Indent::_(4) . "\$table->publish(\$pks, 2);";
|
||||||
@ -838,7 +779,7 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
$methods .= PHP_EOL . Indent::_(3) . "{";
|
$methods .= PHP_EOL . Indent::_(3) . "{";
|
||||||
$methods .= PHP_EOL . Indent::_(4) . "\$table->reset();";
|
$methods .= PHP_EOL . Indent::_(4) . "\$table->reset();";
|
||||||
$methods .= PHP_EOL . Indent::_(4) . "\$pseudoanonymisedData['id'] = \$pk;";
|
$methods .= PHP_EOL . Indent::_(4) . "\$pseudoanonymisedData['id'] = \$pk;";
|
||||||
if (ComponentbuilderHelper::checkArray($_random_bucket))
|
if (ArrayHelper::check($_random_bucket))
|
||||||
{
|
{
|
||||||
foreach ($_random_bucket as $fieldName => $size)
|
foreach ($_random_bucket as $fieldName => $size)
|
||||||
{
|
{
|
||||||
@ -876,6 +817,5 @@ class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
|
|||||||
$methods .= PHP_EOL . Indent::_(2) . "}";
|
$methods .= PHP_EOL . Indent::_(2) . "}";
|
||||||
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
|
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="plugin" version="4" group="extension" method="upgrade">
|
<extension type="plugin" version="4" group="extension" method="upgrade">
|
||||||
<name>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER</name>
|
<name>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER</name>
|
||||||
<creationDate>2nd May, 2023</creationDate>
|
<creationDate>18th October, 2023</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
<version>1.1.4</version>
|
<version>1.1.6</version>
|
||||||
<description>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION</description>
|
<description>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION</description>
|
||||||
|
|
||||||
<!-- Scripts to run on installation -->
|
<!-- Scripts to run on installation -->
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
|
||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.1.4)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.1.6)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."
|
@ -1,4 +1,4 @@
|
|||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension - Componentbuilder Privacy Compiler"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin."
|
||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.1.4)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>"
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Privacy Compiler (v.1.1.6)</h1> <div style='clear: both;'></div><p>This plugin is used to build the privacy plugin for your component during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to link your admin views to the privacy suite of Joomla via our other Content - Componentbuilder Privacy Tabs plugin.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 17th August, 2019</small></p>"
|
||||||
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."
|
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You do not have a global privacy plugin setup, so the integration with Joomla privacy suite could not be build."
|
Loading…
x
Reference in New Issue
Block a user