only transfer link-registry for apps user has access too, otherwise mime-registry would open eg. iCal files in calender, even if user has no calendar access

This commit is contained in:
Ralf Becker 2012-03-22 13:04:58 +00:00
parent b9335d6cfb
commit e52efa0ed6

View File

@ -213,6 +213,8 @@ class egw_link extends solink
* Get clientside relevant attributes from app registry in json format
*
* Only transfering relevant information cuts approx. half of the size.
* Also only transfering information relevant to apps user has access too.
* Important eg. for mime-registry, to not use calendar for opening iCal files, if user has no calendar!
*
* @return string json encoded object with app: object pairs with attributes "(view|add|edit)(|_id|_popup)"
*/
@ -221,14 +223,17 @@ class egw_link extends solink
$to_json = array();
foreach(self::$app_register as $app => $data)
{
$to_json[$app] = array_intersect_key($data, array_flip(array(
'view','view_id','view_popup',
'add','add_app','add_id','add_popup',
'edit','edit_id','edit_popup',
'list','list_popup',
'name','icon','query',
'mime',
)));
if (isset($GLOBALS['egw_info']['user']['apps'][$app]))
{
$to_json[$app] = array_intersect_key($data, array_flip(array(
'view','view_id','view_popup',
'add','add_app','add_id','add_popup',
'edit','edit_id','edit_popup',
'list','list_popup',
'name','icon','query',
'mime',
)));
}
}
return json_encode($to_json);
}