aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-07-09 21:08:02 -0700
committerredmatrix <git@macgirvin.com>2016-07-09 21:08:02 -0700
commitc9db8c6857d8676b3eb3c19548eb303656dc5fff (patch)
treeb24726528d3fd98803fb481e350964f378fe6f28
parent917a465ccd7dfa4992241b1e5d4418b3a31f1615 (diff)
downloadvolse-hubzilla-c9db8c6857d8676b3eb3c19548eb303656dc5fff.tar.gz
volse-hubzilla-c9db8c6857d8676b3eb3c19548eb303656dc5fff.tar.bz2
volse-hubzilla-c9db8c6857d8676b3eb3c19548eb303656dc5fff.zip
more permissions work
-rw-r--r--Zotlabs/Access/Permissions.php32
-rw-r--r--Zotlabs/Module/Connedit.php17
-rw-r--r--Zotlabs/Module/Settings.php5
-rw-r--r--include/config.php2
-rw-r--r--include/permissions.php4
5 files changed, 39 insertions, 21 deletions
diff --git a/Zotlabs/Access/Permissions.php b/Zotlabs/Access/Permissions.php
index 0f1a04b31..b389fc229 100644
--- a/Zotlabs/Access/Permissions.php
+++ b/Zotlabs/Access/Permissions.php
@@ -27,22 +27,22 @@ class Permissions {
static public function Perms($filter = '') {
$perms = [
- [ 'view_stream' => t('Can view my normal stream and posts') ],
- [ 'send_stream' => t('Can send me their channel stream and posts') ],
- [ 'view_profile' => t('Can view my default channel profile') ],
- [ 'view_contacts' => t('Can view my connections') ],
- [ 'view_storage' => t('Can view my file storage and photos') ],
- [ 'write_storage' => t('Can upload/modify my file storage and photos') ],
- [ 'view_pages' => t('Can view my channel webpages') ],
- [ 'write_pages' => t('Can create/edit my channel webpages') ],
- [ 'post_wall' => t('Can post on my channel (wall) page') ],
- [ 'post_comments' => t('Can comment on or like my posts') ],
- [ 'post_mail' => t('Can send me private mail messages') ],
- [ 'post_like' => t('Can like/dislike profiles and profile things') ],
- [ 'tag_deliver' => t('Can forward to all my channel connections via @+ mentions in posts') ],
- [ 'chat' => t('Can chat with me') ],
- [ 'republish' => t('Can source my public posts in derived channels') ],
- [ 'delegate' => t('Can administer my channel') ]
+ 'view_stream' => t('Can view my channel stream and posts'),
+ 'send_stream' => t('Can send me their channel stream and posts'),
+ 'view_profile' => t('Can view my default channel profile'),
+ 'view_contacts' => t('Can view my connections'),
+ 'view_storage' => t('Can view my file storage and photos'),
+ 'write_storage' => t('Can upload/modify my file storage and photos'),
+ 'view_pages' => t('Can view my channel webpages'),
+ 'write_pages' => t('Can create/edit my channel webpages'),
+ 'post_wall' => t('Can post on my channel (wall) page'),
+ 'post_comments' => t('Can comment on or like my posts'),
+ 'post_mail' => t('Can send me private mail messages'),
+ 'post_like' => t('Can like/dislike profiles and profile things'),
+ 'tag_deliver' => t('Can forward to all my channel connections via @+ mentions in posts'),
+ 'chat' => t('Can chat with me'),
+ 'republish' => t('Can source my public posts in derived channels'),
+ 'delegate' => t('Can administer my channel')
];
$x = array('permissions' => $perms, 'filter' => $filter);
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index a5c5175dc..445219894 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -676,6 +676,18 @@ class Connedit extends \Zotlabs\Web\Controller {
if($slide && $multiprofs)
$affinity = t('Set Affinity & Profile');
+ $theirs = q("select * from abconfig where chan = %d and xchan = '%s' and cat = 'their_perms'",
+ intval(local_channel()),
+ dbesc($contact['abook_xchan'])
+ );
+ $their_perms = array();
+ if($theirs) {
+ foreach($theirs as $t) {
+ $their_perms[$t['k']] = $t['v'];
+ }
+ }
+logger('theris: ' . print_r($their_perms,true));
+
foreach($global_perms as $k => $v) {
$thisperm = get_abconfig(local_channel(),$contact['abook_xchan'],'my_perms',$k);
//fixme
@@ -686,8 +698,11 @@ class Connedit extends \Zotlabs\Web\Controller {
// permissions because they are enabled for the channel owner
if((! $self) && ($existing[$k]))
$thisperm = "1";
+
+
+
- $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4], $checkinherited);
+ $perms[] = array('perms_' . $k, $v, ((array_key_exists($k,$their_perms)) ? intval($their_perms[$k]) : ''),$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited);
}
$locstr = '';
diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php
index 85da261fc..7f34f52b1 100644
--- a/Zotlabs/Module/Settings.php
+++ b/Zotlabs/Module/Settings.php
@@ -896,17 +896,18 @@ class Settings extends \Zotlabs\Web\Controller {
array( t('Anybody on the internet'), PERMS_PUBLIC)
);
+ $limits = \Zotlabs\Access\PermissionLimits::Get(local_channel());
foreach($global_perms as $k => $perm) {
$options = array();
foreach($perm_opts as $opt) {
$options[$opt[1]] = $opt[0];
}
- $permiss[] = array($k,$perm,$channel[$perm[0]],$perm[4],$options);
+ $permiss[] = array($k,$perm,$limits[$k],'',$options);
}
- // logger('permiss: ' . print_r($permiss,true));
+ //logger('permiss: ' . print_r($permiss,true));
diff --git a/include/config.php b/include/config.php
index ece22793f..91e021947 100644
--- a/include/config.php
+++ b/include/config.php
@@ -99,7 +99,7 @@ function del_aconfig($account_id, $family, $key) {
function load_abconfig($chan,$xhash) {
- Zlib\AbConfig::Load($chan,$xhash);
+ return Zlib\AbConfig::Load($chan,$xhash);
}
function get_abconfig($chan,$xhash,$family,$key) {
diff --git a/include/permissions.php b/include/permissions.php
index 5eb602ce0..8e2f9598b 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -81,6 +81,8 @@ function get_all_perms($uid, $observer_xchan, $internal_use = true) {
$ret = array();
+ $abperms = (($uid && $observer_xchan) ? load_abconfig($uid,$observer_xchan) : false);
+
foreach($global_perms as $perm_name => $permission) {
// First find out what the channel owner declared permissions to be.
@@ -122,7 +124,7 @@ function get_all_perms($uid, $observer_xchan, $internal_use = true) {
dbesc($observer_xchan)
);
}
- $abperms = load_abconfig($uid,$observer_xchan);
+
$abook_checked = true;
}