Replace $uid parameter by $obj['uid'] in Item::enumeratePermissions

This commit is contained in:
Hypolite Petovan 2019-07-27 18:04:24 -04:00
parent 9d20705700
commit c149ba2d59
2 changed files with 7 additions and 7 deletions

View file

@ -2799,7 +2799,7 @@ class Item extends BaseObject
*/ */
if (self::hasPermissions($photo)) { if (self::hasPermissions($photo)) {
if ($cid) { if ($cid) {
$recips = self::enumeratePermissions($uid, $photo); $recips = self::enumeratePermissions($photo);
if (in_array($cid, $recips)) { if (in_array($cid, $recips)) {
$replace = true; $replace = true;
} }
@ -2865,8 +2865,8 @@ class Item extends BaseObject
} }
// This is harder. Parse all the permissions and compare the resulting set. // This is harder. Parse all the permissions and compare the resulting set.
$recipients1 = self::enumeratePermissions($uid, $obj1); $recipients1 = self::enumeratePermissions($obj1);
$recipients2 = self::enumeratePermissions($uid, $obj2); $recipients2 = self::enumeratePermissions($obj2);
sort($recipients1); sort($recipients1);
sort($recipients2); sort($recipients2);
@ -2875,12 +2875,12 @@ class Item extends BaseObject
} }
// returns an array of contact-ids that are allowed to see this object // returns an array of contact-ids that are allowed to see this object
public static function enumeratePermissions($uid, array $obj) public static function enumeratePermissions(array $obj)
{ {
$allow_people = expand_acl($obj['allow_cid']); $allow_people = expand_acl($obj['allow_cid']);
$allow_groups = Group::expand($uid, expand_acl($obj['allow_gid'])); $allow_groups = Group::expand($obj['uid'], expand_acl($obj['allow_gid']));
$deny_people = expand_acl($obj['deny_cid']); $deny_people = expand_acl($obj['deny_cid']);
$deny_groups = Group::expand($uid, expand_acl($obj['deny_gid'])); $deny_groups = Group::expand($obj['uid'], expand_acl($obj['deny_gid']));
$recipients = array_unique(array_merge($allow_people, $allow_groups)); $recipients = array_unique(array_merge($allow_people, $allow_groups));
$deny = array_unique(array_merge($deny_people, $deny_groups)); $deny = array_unique(array_merge($deny_people, $deny_groups));
$recipients = array_diff($recipients, $deny); $recipients = array_diff($recipients, $deny);

View file

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