From cd1692c4a6420bfee398d23279596230251e91fb Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 20 Jan 2016 14:39:16 +0000 Subject: [PATCH] adding an ignore-acl parameter to addressbook_bo::read() and addressbook_merge::get_replacements() --- addressbook/inc/class.addressbook_bo.inc.php | 5 +++-- addressbook/inc/class.addressbook_merge.inc.php | 7 ++++--- etemplate/inc/class.bo_merge.inc.php | 7 ++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/addressbook/inc/class.addressbook_bo.inc.php b/addressbook/inc/class.addressbook_bo.inc.php index 916b07efdc..c6a3353329 100755 --- a/addressbook/inc/class.addressbook_bo.inc.php +++ b/addressbook/inc/class.addressbook_bo.inc.php @@ -1055,15 +1055,16 @@ class addressbook_bo extends addressbook_so * reads contacts matched by key and puts all cols in the data array * * @param int|string $contact_id + * @param boolean $ignore_acl =false true: no acl check * @return array|boolean array with contact data, null if not found or false on no view perms */ - function read($contact_id) + function read($contact_id, $ignore_acl=false) { if (!($data = parent::read($contact_id))) { $data = null; // not found } - elseif (!$this->check_perms(EGW_ACL_READ,$data)) + elseif (!$ignore_acl && !$this->check_perms(EGW_ACL_READ,$data)) { $data = false; // no view perms } diff --git a/addressbook/inc/class.addressbook_merge.inc.php b/addressbook/inc/class.addressbook_merge.inc.php index e36417b2d6..eb191898d5 100644 --- a/addressbook/inc/class.addressbook_merge.inc.php +++ b/addressbook/inc/class.addressbook_merge.inc.php @@ -46,17 +46,18 @@ class addressbook_merge extends bo_merge * * @param int $id id of entry * @param string &$content=null content to create some replacements only if they are use + * @param boolean $ignore_acl =false true: no acl check * @return array|boolean */ - protected function get_replacements($id,&$content=null) + protected function get_replacements($id,&$content=null,$ignore_acl=false) { - if (!($replacements = $this->contact_replacements($id))) + if (!($replacements = $this->contact_replacements($id,'',$ignore_acl))) { return false; } if($content && strpos($content, '$$#') !== 0) { - $this->cf_link_to_expand($this->contacts->read($id), $content, $replacements,'addressbook'); + $this->cf_link_to_expand($this->contacts->read($id, $ignore_acl), $content, $replacements,'addressbook'); } // Links diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index ec81ac6b71..0e10ef195a 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -193,14 +193,15 @@ abstract class bo_merge * Return replacements for a contact * * @param int|string|array $contact contact-array or id - * @param string $prefix='' prefix like eg. 'user' + * @param string $prefix ='' prefix like eg. 'user' + * @param boolean $ignore_acl =false true: no acl check * @return array */ - public function contact_replacements($contact,$prefix='') + public function contact_replacements($contact,$prefix='',$ignore_acl=false) { if (!is_array($contact)) { - $contact = $this->contacts->read($contact); + $contact = $this->contacts->read($contact, $ignore_acl); } if (!is_array($contact)) return array();