From f7ee51f53bfc79a54f44e3d4ae953b9e1ef5ccb6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 10 Mar 2010 12:20:51 +0000 Subject: [PATCH] "egw_links: remove links user has no access to from result, if $cache_titles is set" --- phpgwapi/inc/class.egw_link.inc.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.egw_link.inc.php b/phpgwapi/inc/class.egw_link.inc.php index 846f1713b9..c33926e4b0 100644 --- a/phpgwapi/inc/class.egw_link.inc.php +++ b/phpgwapi/inc/class.egw_link.inc.php @@ -289,6 +289,7 @@ class egw_link extends solink * @param string $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!' * @param string $order='link_lastmod DESC' defaults to newest links first * @param boolean $cache_titles=false should all titles be queryed and cached (allows to query each link app only once!) + * This option also removes links not viewable by current user from the result! * @return array of links or empty array if no matching links found */ static function get_links( $app,$id,$only_app='',$order='link_lastmod DESC',$cache_titles=false ) @@ -333,12 +334,19 @@ class egw_link extends solink { $app_ids[$link['app']][] = $link['id']; } - reset($ids); - foreach($app_ids as $appname => $a_ids) { self::titles($appname,array_unique($a_ids)); } + // remove links, current user has no access, from result + foreach($ids as $key => $link) + { + if (!self::title($link['app'],$link['id'])) + { + unset($ids[$key]); + } + } + reset($ids); } return $ids; } @@ -762,7 +770,7 @@ class egw_link extends solink } $params = $reg['edit']; $params[$reg['edit_id']] = $id; - + $popup = $reg['edit_popup']; return $params;