aboutsummaryrefslogtreecommitdiffstats
path: root/include/permissions.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-04-09 16:30:03 -0700
committerfriendica <info@friendica.com>2014-04-09 16:30:03 -0700
commitbf41ccbf359a6105255055bfb110b904ee268688 (patch)
tree4eb70dcf43c1059a7487d645177304afb36cade3 /include/permissions.php
parentc7080edb1667c7f7d4f79f38d9bbc75fa11ac5c0 (diff)
downloadvolse-hubzilla-bf41ccbf359a6105255055bfb110b904ee268688.tar.gz
volse-hubzilla-bf41ccbf359a6105255055bfb110b904ee268688.tar.bz2
volse-hubzilla-bf41ccbf359a6105255055bfb110b904ee268688.zip
'anybody in this network' permissions were not being allowed for non-connected channels.
Diffstat (limited to 'include/permissions.php')
-rw-r--r--include/permissions.php28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/permissions.php b/include/permissions.php
index eb1a7966f..01dd18f8d 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -100,6 +100,13 @@ function get_all_perms($uid,$observer_xchan,$internal_use = true) {
dbesc($observer_xchan),
intval(ABOOK_FLAG_SELF)
);
+ if(! $x) {
+ // not in address book, see if they've got an xchan
+ $y = q("select xchan_network from xchan where xchan_hash = '%s' limit 1",
+ dbesc($observer_xchan)
+ );
+ }
+
$abook_checked = true;
}
@@ -144,9 +151,11 @@ function get_all_perms($uid,$observer_xchan,$internal_use = true) {
// If we're still here, we have an observer, check the network.
- if(($r[0][$channel_perm] & PERMS_NETWORK) && ($x[0]['xchan_network'] === 'zot')) {
- $ret[$perm_name] = true;
- continue;
+ if($r[0][$channel_perm] & PERMS_NETWORK) {
+ if(($x && $x[0]['xchan_network'] === 'zot') || ($y && $y[0]['xchan_network'] === 'zot')) {
+ $ret[$perm_name] = true;
+ continue;
+ }
}
// If PERMS_SITE is specified, find out if they've got an account on this hub
@@ -263,6 +272,12 @@ function perm_is_allowed($uid,$observer_xchan,$permission) {
if(($x) && (! $global_perms[$permission][2]) && ($x[0]['abook_flags'] & ABOOK_FLAG_IGNORED))
return false;
+ if(! $x) {
+ // not in address book, see if they've got an xchan
+ $y = q("select xchan_network from xchan where xchan_hash = '%s' limit 1",
+ dbesc($observer_xchan)
+ );
+ }
}
@@ -283,9 +298,10 @@ function perm_is_allowed($uid,$observer_xchan,$permission) {
// If we're still here, we have an observer, check the network.
- if(($r[0][$channel_perm] & PERMS_NETWORK) && ($x[0]['xchan_network'] === 'zot'))
- return true;
-
+ if($r[0][$channel_perm] & PERMS_NETWORK) {
+ if (($x && $x[0]['xchan_network'] === 'zot') || ($y && $y[0]['xchan_network'] === 'zot'))
+ return true;
+ }
// If PERMS_SITE is specified, find out if they've got an account on this hub