1
0
Fork 0

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
This commit is contained in:
Hypolite Petovan 2021-10-21 18:49:22 -04:00
parent b6faa0878a
commit 096dacf0fd
2 changed files with 6 additions and 2 deletions

View file

@ -5,8 +5,8 @@ namespace Friendica\Module;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
@ -32,6 +32,10 @@ class PermissionTooltip extends \Friendica\BaseModule
} else { } else {
$fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']; $fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
$model = DBA::selectFirst($type, $fields, $condition); $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)) { if (!DBA::isResult($model)) {

View file

@ -38,7 +38,7 @@ final class ACLFormatter
public function expand(string $acl_string = null) public function expand(string $acl_string = null)
{ {
// In case there is no ID list, return empty array (=> no ACL set) // In case there is no ID list, return empty array (=> no ACL set)
if (!isset($acl_string)) { if (empty($acl_string)) {
return []; return [];
} }