From 828368267cba36e39469cbc542744833c8c4d103 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 16 Aug 2019 23:59:48 -0400 Subject: [PATCH] Add check_dead parameter to Item::enumeratePermissions --- src/Model/Item.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index f1983ddf22..8ac88e96db 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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); -- 2.39.5