forgot required changes in acl class, to read grants of a different user

This commit is contained in:
Ralf Becker 2011-06-26 13:00:51 +00:00
parent 04be4c57fe
commit 7b83209e7c

View File

@ -669,14 +669,21 @@ class acl
* @param string $app optional defaults to $GLOBALS['egw_info']['flags']['currentapp']
* @param boolean/array $enum_group_acls=true should group acls be returned for all members of that group, default yes
* if an array of group-id's is given, that id's will NOT be enumerated!
* @param int $user=null user whos grants to return, default current user
* @return array with account-ids (of owners) and granted rights as values
*/
function get_grants($app='',$enum_group_acls=true)
function get_grants($app='',$enum_group_acls=true,$user=null)
{
if (!$app) $app = $GLOBALS['egw_info']['flags']['currentapp'];
if (!$user) $user = $this->account_id;
$memberships = array($this->account_id);
foreach((array)$GLOBALS['egw']->accounts->membership($this->account_id) as $group)
static $cache = array(); // some caching withing the request
$grants =& $cache[$app][$user];
if (!isset($grants))
{
$memberships = array($user);
foreach((array)$GLOBALS['egw']->accounts->membership($user) as $group)
{
$memberships[] = $group['account_id'];
}
@ -719,8 +726,8 @@ class acl
}
}
// user has implizit all rights on own data
$grants[$GLOBALS['egw_info']['user']['account_id']] = ~0;
$grants[$user] = ~0;
}
//echo "acl::get_grants('$app',$enum_group_acls) ".function_backtrace(); _debug_array($grants);
return $grants;
}