From b4b2b9d5d266e9d9a318a3c8bf98c17c331930f1 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 | 10 ++++++++++ api/src/Hooks.php | 2 +- infolog/inc/class.infolog_ui.inc.php | 6 +++++- mail/inc/class.mail_compose.inc.php | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/admin/templates/default/config.xet b/admin/templates/default/config.xet index 771592228e..aa02921bdb 100644 --- a/admin/templates/default/config.xet +++ b/admin/templates/default/config.xet @@ -47,6 +47,16 @@ + + + + + + + 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 0a37f62b14..4cdede5d02 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']) {