From 096dacf0fd1ad7282ec99934af6c55b3a1677c03 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 21 Oct 2021 18:49:22 -0400 Subject: [PATCH] Manually expand ACLs coming from non-permissionset tables - Return early if parameter is empty in ACLFormatter->expand - Address https://github.com/friendica/friendica/issues/10756#issuecomment-949049195 --- src/Module/PermissionTooltip.php | 6 +++++- src/Util/ACLFormatter.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php index df82574e92..7599c2f060 100644 --- a/src/Module/PermissionTooltip.php +++ b/src/Module/PermissionTooltip.php @@ -5,8 +5,8 @@ namespace Friendica\Module; use Friendica\Core\Hook; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Model\Item; use Friendica\Model\Group; +use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Network\HTTPException; @@ -32,6 +32,10 @@ class PermissionTooltip extends \Friendica\BaseModule } else { $fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']; $model = DBA::selectFirst($type, $fields, $condition); + $model['allow_cid'] = DI::aclFormatter()->expand($model['allow_cid']); + $model['allow_gid'] = DI::aclFormatter()->expand($model['allow_gid']); + $model['deny_cid'] = DI::aclFormatter()->expand($model['deny_cid']); + $model['deny_gid'] = DI::aclFormatter()->expand($model['deny_gid']); } if (!DBA::isResult($model)) { diff --git a/src/Util/ACLFormatter.php b/src/Util/ACLFormatter.php index 352c914bcf..03aded3854 100644 --- a/src/Util/ACLFormatter.php +++ b/src/Util/ACLFormatter.php @@ -38,7 +38,7 @@ final class ACLFormatter public function expand(string $acl_string = null) { // In case there is no ID list, return empty array (=> no ACL set) - if (!isset($acl_string)) { + if (empty($acl_string)) { return []; }