Add a column for run rights, each of which gets their own row

This commit is contained in:
nathangray 2017-11-02 10:24:47 -06:00
parent 069d49afba
commit 42ca76e824
4 changed files with 36 additions and 5 deletions

View File

@ -26,7 +26,7 @@ class admin_egw_acl_record implements importexport_iface_egw_record
static $types = array(
'select' => array('acl_appname'),
'select-account' => array('acl_account', 'acl_location'),
'select-bool' => array('acl1', 'acl2','acl4','acl8','acl16','acl64','acl128','acl256'),
'select-bool' => array('acl_run', 'acl1', 'acl2','acl4','acl8','acl16','acl64','acl128','acl256'),
);
/**

View File

@ -56,10 +56,7 @@ class admin_export_acl_csv implements importexport_iface_export_plugin
}
foreach($accounts as $account_id => $account_data)
{
$query['account_id'] = $account_id;
$account_acl = array();
admin_acl::get_rows($query, $account_acl);
$selection = array_merge($selection, $account_acl);
$this->get_account_acl($account_id, $options['mapping']['acl_run'], $query, $selection);
}
$options['begin_with_fieldnames'] = true;
@ -110,6 +107,38 @@ class admin_export_acl_csv implements importexport_iface_export_plugin
return $export_object;
}
/**
* Get the acl data for one account & format it as needed
*
* @param int $account_id
* @param boolean $run_rights Include run rights
* @param array $query
* @param array $selection
*/
protected function get_account_acl($account_id, $run_rights, $query, &$selection)
{
$query['account_id'] = $account_id;
$query['filter'] = 'other';
$account_acl = array();
admin_acl::get_rows($query, $account_acl);
$selection = array_merge($selection, $account_acl);
$run = array();
if($run_rights)
{
$query['filter'] = 'run';
admin_acl::get_rows($query, $run);
foreach($run as &$run_row)
{
$run_row['acl_run'] = true;
unset($run_row['acl_location']);
unset($run_row['acl1']);
}
$selection = array_merge($selection, $run);
}
}
/**
* returns translated name of plugin
*

View File

@ -23,6 +23,7 @@ class admin_wizard_export_acl_csv extends importexport_wizard_basic_export_csv
'acl_appname' => lang('Application'),
'acl_location' => lang('Data from'),
'all_acls' => lang('All ACLs'),
'acl_run' => lang('Run'),
'acl1' => lang('Read'),
'acl2' => lang('Add'),
'acl4' => lang('Edit'),

View File

@ -17,6 +17,7 @@
<entry type="string" name="acl_account">acl_account</entry>
<entry type="string" name="acl_appname">acl_appname</entry>
<entry type="string" name="acl_location">acl_location</entry>
<entry type="string" name="acl1">acl_run</entry>
<entry type="string" name="acl1">acl1</entry>
<entry type="string" name="acl2">acl2</entry>
<entry type="string" name="acl4">acl4</entry>