From a019e94e5588950bdf13757545bd9fcb35d945ca Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 22 Feb 2011 17:43:33 +0000 Subject: [PATCH] Respect global setting export_limit = 'no' -> disable exporting --- ...ass.importexport_admin_prefs_sidebox_hooks.inc.php | 10 +++++++--- .../inc/class.importexport_definitions_ui.inc.php | 11 ++++++++++- importexport/inc/class.importexport_export_ui.inc.php | 7 +++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php b/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php index 2c2bbe28b8..01746be79e 100644 --- a/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php +++ b/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php @@ -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( diff --git a/importexport/inc/class.importexport_definitions_ui.inc.php b/importexport/inc/class.importexport_definitions_ui.inc.php index 174162382c..c14d376df3 100644 --- a/importexport/inc/class.importexport_definitions_ui.inc.php +++ b/importexport/inc/class.importexport_definitions_ui.inc.php @@ -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; } diff --git a/importexport/inc/class.importexport_export_ui.inc.php b/importexport/inc/class.importexport_export_ui.inc.php index 92732fc5bc..43bf4c2324 100644 --- a/importexport/inc/class.importexport_export_ui.inc.php +++ b/importexport/inc/class.importexport_export_ui.inc.php @@ -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'];