aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-07-04 17:55:13 -0700
committerredmatrix <git@macgirvin.com>2016-07-04 17:55:13 -0700
commitd566ffa678dc9f035a022304a82560b19495a838 (patch)
tree2d9792aea61b9807efba95818094c90337622c68 /Zotlabs
parent6bf2e8a1087546a1986adddcdab486af0891383e (diff)
downloadvolse-hubzilla-d566ffa678dc9f035a022304a82560b19495a838.tar.gz
volse-hubzilla-d566ffa678dc9f035a022304a82560b19495a838.tar.bz2
volse-hubzilla-d566ffa678dc9f035a022304a82560b19495a838.zip
more heavy lifting on extensible perms
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Access/Permissions.php14
-rw-r--r--Zotlabs/Module/Connedit.php11
2 files changed, 22 insertions, 3 deletions
diff --git a/Zotlabs/Access/Permissions.php b/Zotlabs/Access/Permissions.php
index bbf14d7dc..520957638 100644
--- a/Zotlabs/Access/Permissions.php
+++ b/Zotlabs/Access/Permissions.php
@@ -34,6 +34,20 @@ class Permissions {
}
+ static public function BlockedAnonPerms() {
+
+ // Perms from the above list that are blocked from anonymous observers.
+ // e.g. you must be authenticated.
+
+ $perms = [ 'send_stream', 'write_pages', 'post_wall', 'write_storage', 'post_comments', 'post_mail', 'post_like', 'tag_deliver', 'chat', 'republish', 'delegate' ];
+
+ $x = array('permissions' => $perms);
+ call_hooks('write_perms',$x);
+ return($x['permissions']);
+
+ }
+
+
static public function OwnerLimitSet($channel_id,$permission,$limit) {
return Zlib\PConfig::Set($channel_id,'perms',$permission,$limit);
}
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index 7db4950b1..4469330e8 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -131,6 +131,8 @@ class Connedit extends \Zotlabs\Web\Controller {
foreach($_POST as $k => $v) {
if(strpos($k,'perms_') === 0) {
+ $perm = substr($k,6);
+ set_abconfig($channel['channel_id'],$orig_record[0]['abook_xchan'],'my_perms',$perm,(($v) ? 1 : 0));
$abook_my_perms += $v;
}
}
@@ -654,7 +656,8 @@ class Connedit extends \Zotlabs\Web\Controller {
$perms = array();
$channel = \App::get_channel();
- $global_perms = get_perms();
+ $global_perms = \Zotlabs\Access\Permissions::Perms();
+
$existing = get_all_perms(local_channel(),$contact['abook_xchan']);
$unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication'), array(t('No'),('Yes')));
@@ -671,8 +674,10 @@ class Connedit extends \Zotlabs\Web\Controller {
$affinity = t('Set Affinity & Profile');
foreach($global_perms as $k => $v) {
- $thisperm = (($contact['abook_my_perms'] & $v[1]) ? "1" : '');
- $checkinherited = ((($channel[$v[0]]) && ($channel[$v[0]] != PERMS_SPECIFIC)) ? "1" : '');
+ $thisperm = get_abconfig(local_channel(),$contact['abook_xchan'],'my_perms',$k);
+//fixme
+
+ $checkinherited = \Zotlabs\Access\PermissionLimits::Get(local_channel(),$k);
// For auto permissions (when $self is true) we don't want to look at existing
// permissions because they are enabled for the channel owner