xchan_fetch() returns a simplified structure
This commit is contained in:
parent
3e286f4f19
commit
e990a35a91
@ -313,7 +313,7 @@
|
|||||||
$perm = ((array_key_exists('perm',$_REQUEST)) ? $_REQUEST['perm'] : '');
|
$perm = ((array_key_exists('perm',$_REQUEST)) ? $_REQUEST['perm'] : '');
|
||||||
|
|
||||||
if(array_key_exists('abook_id',$_REQUEST) && intval($_REQUEST['abook_id'])) {
|
if(array_key_exists('abook_id',$_REQUEST) && intval($_REQUEST['abook_id'])) {
|
||||||
$r = q("select abook_xchan as xchan_hash from abook where abook_id = %d and abook_channel = %d limit 1",
|
$r = q("select abook_xchan as hash from abook where abook_id = %d and abook_channel = %d limit 1",
|
||||||
intval($_REQUEST['abook_id']),
|
intval($_REQUEST['abook_id']),
|
||||||
intval(api_user())
|
intval(api_user())
|
||||||
);
|
);
|
||||||
@ -326,10 +326,10 @@
|
|||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
if($perm)
|
if($perm)
|
||||||
$x = [ [ 'perm' => $perm, 'allowed' => perm_is_allowed(api_user(), $r[0]['xchan_hash'], $perm)] ];
|
$x = [ [ 'perm' => $perm, 'allowed' => perm_is_allowed(api_user(), $r[0]['hash'], $perm)] ];
|
||||||
else {
|
else {
|
||||||
$x = [];
|
$x = [];
|
||||||
$p = get_all_perms(api_user(),$r[0]['xchan_hash']);
|
$p = get_all_perms(api_user(),$r[0]['hash']);
|
||||||
if($p) {
|
if($p) {
|
||||||
foreach($p as $k => $v)
|
foreach($p as $k => $v)
|
||||||
$x[] = [ 'perm' => $k, 'allowed' => $v ];
|
$x[] = [ 'perm' => $k, 'allowed' => $v ];
|
||||||
|
Reference in New Issue
Block a user