Merge pull request #7524 from MrPetovan/bug/7337-check-dead-enumeratePermissions

Prune unavailable contacts from AP envelope
2022.09-rc
Philipp 2019-08-18 15:17:11 +02:00 zatwierdzone przez GitHub
commit 0f32ab10d8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -2881,13 +2881,20 @@ class Item extends BaseObject
return ($recipients1 == $recipients2);
}
// returns an array of contact-ids that are allowed to see this object
public static function enumeratePermissions(array $obj)
/**
* Returns an array of contact-ids that are allowed to see this object
*
* @param array $obj Item array with at least uid, allow_cid, allow_gid, deny_cid and deny_gid
* @param bool $check_dead Prunes unavailable contacts from the result
* @return array
* @throws \Exception
*/
public static function enumeratePermissions(array $obj, bool $check_dead = false)
{
$allow_people = expand_acl($obj['allow_cid']);
$allow_groups = Group::expand($obj['uid'], expand_acl($obj['allow_gid']));
$allow_groups = Group::expand($obj['uid'], expand_acl($obj['allow_gid']), $check_dead);
$deny_people = expand_acl($obj['deny_cid']);
$deny_groups = Group::expand($obj['uid'], expand_acl($obj['deny_gid']));
$deny_groups = Group::expand($obj['uid'], expand_acl($obj['deny_gid']), $check_dead);
$recipients = array_unique(array_merge($allow_people, $allow_groups));
$deny = array_unique(array_merge($deny_people, $deny_groups));
$recipients = array_diff($recipients, $deny);

Wyświetl plik

@ -386,7 +386,7 @@ class Transmitter
}
}
} else {
$receiver_list = Item::enumeratePermissions($item);
$receiver_list = Item::enumeratePermissions($item, true);
foreach ($terms as $term) {
$cid = Contact::getIdForURL($term['url'], $item['uid']);