From 87be62ce63827237d567bd3aa63b8665ccba334a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 18 May 2021 14:14:21 +0200 Subject: [PATCH] remove config allowing to immediately delete InfoLog entries (as it's required for sync) --- infolog/inc/class.infolog_bo.inc.php | 45 +++++++++++----------------- infolog/inc/class.infolog_ui.inc.php | 1 - 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/infolog/inc/class.infolog_bo.inc.php b/infolog/inc/class.infolog_bo.inc.php index 13b6df5a31..df93074b61 100644 --- a/infolog/inc/class.infolog_bo.inc.php +++ b/infolog/inc/class.infolog_bo.inc.php @@ -359,34 +359,27 @@ class infolog_bo if (!isset($access)) { // handle delete for the various history modes - if ($this->history) - { - if (!is_array($info) && !($info = $this->so->read(array('info_id' => $info_id)))) return false; + if (!is_array($info) && !($info = $this->so->read(array('info_id' => $info_id)))) return false; - if ($info['info_status'] == 'deleted' && - ($required_rights == Acl::EDIT || // no edit rights for deleted entries - $required_rights == Acl::ADD || // no add rights for deleted entries - $required_rights == Acl::DELETE && ($this->history == 'history_no_delete' || // no delete at all! - $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user!=$this->user)))) // delete only for admins - { - $access = false; - } - elseif ($required_rights == self::ACL_UNDELETE) - { - if ($info['info_status'] != 'deleted') - { - $access = false; // can only undelete deleted items - } - else - { - // undelete requires edit rights - $access = $this->so->check_access( $info,Acl::EDIT,$this->implicit_rights == 'edit',$grants,$user ); - } - } + if ($info['info_status'] == 'deleted' && + ($required_rights == Acl::EDIT || // no edit rights for deleted entries + $required_rights == Acl::ADD || // no add rights for deleted entries + $required_rights == Acl::DELETE && ($this->history == 'history_no_delete' || // no delete at all! + $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user!=$this->user)))) // delete only for admins + { + $access = false; } elseif ($required_rights == self::ACL_UNDELETE) { - $access = false; + if ($info['info_status'] != 'deleted') + { + $access = false; // can only undelete deleted items + } + else + { + // undelete requires edit rights + $access = $this->so->check_access( $info,Acl::EDIT,$this->implicit_rights == 'edit',$grants,$user ); + } } if (!isset($access)) { @@ -705,10 +698,8 @@ class infolog_bo $deleted['info_modifier'] = $this->user; // if we have history switched on and not an already deleted item --> set only status deleted - if ($this->history && $info['info_status'] != 'deleted') + if ($info['info_status'] != 'deleted') { - if ($info['info_status'] == 'deleted') return false; // entry already deleted - $this->so->write($deleted); Link::unlink(0,'infolog',$info_id,'','!file','',true); // keep the file attachments, hide the rest diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 6b6b35ec91..d65eb15975 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -2557,7 +2557,6 @@ class infolog_ui 'copy_excludefields' => $excludefields, 'sub_excludefields' => $sub_excludefields, 'history' => array( - '' => lang('No'), 'history' => lang('Yes, with purging of deleted items possible'), 'history_admin_delete' => lang('Yes, only admins can purge deleted items'), 'history_no_delete' => lang('Yes, noone can purge deleted items'),