Respect global setting export_limit = 'no' -> disable exporting

This commit is contained in:
Nathan Gray 2011-02-22 17:43:33 +00:00
parent 7e3e434e39
commit a019e94e55
3 changed files with 24 additions and 4 deletions

View File

@ -31,14 +31,18 @@ class importexport_admin_prefs_sidebox_hooks
"','_blank',850,440,'yes')",
'icon' => 'import'
),
array(
);
$config = config::read('phpgwapi');
if($GLOBALS['egw_info']['user']['apps']['admin'] || $config['export_limit'] !== 'no')
{
$file[] = array(
'text' => 'Export',
'link' => "javascript:egw_openWindowCentered2('".
egw::link('/index.php','menuaction=importexport.importexport_export_ui.export_dialog',false).
"','_blank',850,440,'yes')",
'icon' => 'export'
),
);
);
}
if($GLOBALS['egw']->acl->check('definition', EGW_ACL_EDIT, $appname))
{
$file['Define imports|exports'] = egw::link('/index.php',array(

View File

@ -80,13 +80,20 @@ class importexport_definitions_ui
{
$filter = array('name' => '*');
// Filter private definitions
if(!$GLOBALS['egw_info']['user']['apps']['admin']) {
// Filter private definitions
$filter['owner'] = $GLOBALS['egw_info']['user']['account_id'];
$config = config::read('phpgwapi');
if($config['export_limit'] == 'no') {
$filter['type'] = 'import';
}
} else {
$filter[] = '!owner || owner IS NULL';
}
$bodefinitions = new importexport_definitions_bo($filter, true);
if (is_array($content))
{
@ -400,7 +407,9 @@ class importexport_definitions_ui
else
{
$content['msg'] = $this->steps['wizard_step20'];
$config = config::read('phpgwapi');
foreach ($this->plugins[$content['application']] as $type => $plugins) {
if($config['export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $type == 'export') continue;
foreach($plugins as $plugin => $name) {
$sel_options['plugin'][$plugin] = $name;
}

View File

@ -48,6 +48,13 @@ class importexport_export_ui {
$readonlys = array();
$preserv = array();
// Check global setting
if(!$GLOBALS['egw_info']['user']['apps']['admin']) {
$config = config::read('phpgwapi');
if($config['export_limit'] == 'no') {
die(lang('Admin disabled exporting'));
}
}
$et = new etemplate(self::_appname. '.export_dialog');
$_appname = $_content['appname'] ? $_content['appname'] : $_GET['appname'];
$_definition = $_content['definition'] ? $_content['definition'] : $_GET['definition'];