Fix ACL data

This commit is contained in:
Michael 2018-03-24 18:38:05 +00:00
parent 801d2ee166
commit 885d794958

View file

@ -221,6 +221,10 @@ class ACL extends BaseObject
return $o; return $o;
} }
private static function fixACL(&$item) {
$item = intval(str_replace(['<', '>'], ['', ''], $item));
}
/** /**
* Return the default permission of the provided user array * Return the default permission of the provided user array
* *
@ -242,6 +246,12 @@ class ACL extends BaseObject
preg_match_all($acl_regex, defaults($user, 'deny_gid', ''), $matches); preg_match_all($acl_regex, defaults($user, 'deny_gid', ''), $matches);
$deny_gid = $matches[1]; $deny_gid = $matches[1];
// Reformats the ACL data so that it is accepted by the JS frontend
array_walk($allow_cid, 'self::fixACL');
array_walk($allow_gid, 'self::fixACL');
array_walk($deny_cid, 'self::fixACL');
array_walk($deny_gid, 'self::fixACL');
Contact::pruneUnavailable($allow_cid); Contact::pruneUnavailable($allow_cid);
return [ return [
@ -290,7 +300,7 @@ class ACL extends BaseObject
L10n::t('Hide your profile details from unknown viewers?')); L10n::t('Hide your profile details from unknown viewers?'));
} }
} }
logger('Blubb: '.json_encode($perms));
$tpl = get_markup_template('acl_selector.tpl'); $tpl = get_markup_template('acl_selector.tpl');
$o = replace_macros($tpl, [ $o = replace_macros($tpl, [
'$showall' => L10n::t('Visible to everybody'), '$showall' => L10n::t('Visible to everybody'),