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

View File

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

View File

@ -48,6 +48,13 @@ class importexport_export_ui {
$readonlys = array(); $readonlys = array();
$preserv = 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'); $et = new etemplate(self::_appname. '.export_dialog');
$_appname = $_content['appname'] ? $_content['appname'] : $_GET['appname']; $_appname = $_content['appname'] ? $_content['appname'] : $_GET['appname'];
$_definition = $_content['definition'] ? $_content['definition'] : $_GET['definition']; $_definition = $_content['definition'] ? $_content['definition'] : $_GET['definition'];