using accounts->member(ship)s($id, true) instead of accounts->member(ship), as it does not require to read (unused) account_lid, which takes far longer and require more memory on huge installs

This commit is contained in:
Ralf Becker 2012-07-16 12:05:21 +00:00
parent 727bd06868
commit 04f732e653

View File

@ -483,10 +483,8 @@ class acl
$accounts = array($account_id);
if ($use_memberships)
{
foreach((array)$GLOBALS['egw']->accounts->membership($account_id) as $group)
{
$accounts[] = $group['account_id'];
}
$accounts = $GLOBALS['egw']->accounts->memberships($account_id, true);
$accounts[] = $account_id;
}
$rights = array();
foreach($this->db->select(acl::TABLE,'acl_location,acl_rights',array(
@ -682,11 +680,9 @@ class acl
$grants =& $cache[$app][$user];
if (!isset($grants))
{
$memberships = array($user);
foreach((array)$GLOBALS['egw']->accounts->membership($user) as $group)
{
$memberships[] = $group['account_id'];
}
$memberships = $GLOBALS['egw']->accounts->memberships($user, true);
$memberships[] = $user;
$grants = $accounts = Array();
foreach($this->db->select(acl::TABLE,array('acl_account','acl_rights','acl_location'),array(
'acl_appname' => $app,
@ -708,15 +704,13 @@ class acl
(!is_array($enum_group_acls) || !in_array($grantor,$enum_group_acls)))
{
// return the grant for each member of the group
foreach((array)$GLOBALS['egw']->accounts->member($grantor) as $member)
foreach((array)$GLOBALS['egw']->accounts->members($grantor, true) as $grantor)
{
if (!$member) continue; // can happen if group has no members
if (!$grantor) continue; // can happen if group has no members
// Don't allow to override private with group ACL's!
$rights &= ~EGW_ACL_PRIVATE;
$grantor = $member['account_id'];
if(!isset($grants[$grantor]))
{
$grants[$grantor] = 0;