allow to identify real changes

This commit is contained in:
Ralf Becker 2018-08-03 11:53:20 +02:00
parent 7f662f8f70
commit c579347ad1
2 changed files with 14 additions and 11 deletions

View File

@ -890,6 +890,7 @@ class Accounts
* *
* @param array $groups array with gidnumbers * @param array $groups array with gidnumbers
* @param int $account_id uidnumber * @param int $account_id uidnumber
* @return boolean true: membership changed, false: no change necessary
*/ */
function set_memberships($groups,$account_id) function set_memberships($groups,$account_id)
{ {
@ -897,17 +898,19 @@ class Accounts
{ {
$account_id = $this->name2id($account_id); $account_id = $this->name2id($account_id);
} }
if (($old_memberships = $this->memberships($account_id, true)) != $groups) if (($old_memberships = $this->memberships($account_id, true)) == $groups)
{ {
$this->backend->set_memberships($groups, $account_id); return false; // nothing changed
if (!$old_memberships) $old_memberships = array();
self::cache_invalidate(array_unique(array_merge(
array($account_id),
array_diff($old_memberships, $groups),
array_diff($groups, $old_memberships)
)));
} }
$this->backend->set_memberships($groups, $account_id);
if (!$old_memberships) $old_memberships = array();
self::cache_invalidate(array_unique(array_merge(
array($account_id),
array_diff($old_memberships, $groups),
array_diff($groups, $old_memberships)
)));
return true;
} }
/** /**

View File

@ -348,7 +348,7 @@ class Acl
* @param int $account_id account id * @param int $account_id account id
* @param int $rights rights * @param int $rights rights
* @param boolean $invalidate_session =true false: do NOT invalidate session * @param boolean $invalidate_session =true false: do NOT invalidate session
* @return boolean allways true * @return int number of affected rows: 0: no change, 1: acl changed
*/ */
function add_repository($app, $location, $account_id, $rights, $invalidate_session=true) function add_repository($app, $location, $account_id, $rights, $invalidate_session=true)
{ {
@ -366,7 +366,7 @@ class Acl
{ {
$GLOBALS['egw']->invalidate_session_cache(); $GLOBALS['egw']->invalidate_session_cache();
} }
return True; return $this->db->affected_rows();
} }
/** /**