From b3ab7081255da811e6b89e5a300ac434ef989652 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 23 Aug 2018 16:58:14 +0200 Subject: [PATCH] Implement an admin-config setting to be able to disable PGP encryption feature --- admin/templates/default/config.xet | 12 ++++++++++++ api/src/Hooks.php | 2 +- infolog/inc/class.infolog_ui.inc.php | 6 +++++- mail/inc/class.mail_compose.inc.php | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/admin/templates/default/config.xet b/admin/templates/default/config.xet index 1367acbda3..a629dc9a51 100644 --- a/admin/templates/default/config.xet +++ b/admin/templates/default/config.xet @@ -294,6 +294,18 @@ + + + + + + + + + diff --git a/api/src/Hooks.php b/api/src/Hooks.php index 67f825f1bb..3071fdf603 100644 --- a/api/src/Hooks.php +++ b/api/src/Hooks.php @@ -284,7 +284,7 @@ class Hooks */ public static function pgp_encryption_menu($appname) { - if (Header\UserAgent::mobile()) return; + if (Header\UserAgent::mobile() || $GLOBALS['egw_info']['server']['disable_pgp_encryption']) return; // PGP Encryption (Mailvelope plugin) restore/backup menu $file = Array( diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index a7a4025c2f..2069778f3e 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -2271,10 +2271,14 @@ class infolog_ui { $sel_options['action']['schedule'] = array('label' => 'Schedule', 'title' => 'Schedule appointment'); } - if ($GLOBALS['egw_info']['user']['apps']['stylite']) + if ($GLOBALS['egw_info']['user']['apps']['stylite'] && !$GLOBALS['egw_info']['server']['disable_pgp_encryption']) { $content['encryption_ts'] = filemtime(EGW_SERVER_ROOT.'/stylite/js/infolog-encryption.js'); } + elseif ($GLOBALS['egw_info']['server']['disable_pgp_encryption']) + { + $readonlys['encrypt'] = true; + } $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '. ($content['status_only'] ? lang('Edit Status') : lang('Edit')); $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd')); diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index da1c3b7a97..ffb45b609c 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -271,6 +271,7 @@ class mail_compose } unset($actions['pgp']); } + if ($GLOBALS['egw_info']['server']['disable_pgp_encryption']) unset($actions['pgp']); // remove vfs actions if the user has no run access to filemanager if (!$GLOBALS['egw_info']['user']['apps']['filemanager']) {