aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-30 21:49:26 -0700
committerfriendica <info@friendica.com>2013-09-30 21:49:26 -0700
commitdffce63662c54db7ebb61786d39db6a900d1381f (patch)
tree88004c4a8362f4ee77bf670207076f76d876eb84 /include
parent2353e6d23f54902d3b2b9e3fd46f1baa6e803450 (diff)
downloadvolse-hubzilla-dffce63662c54db7ebb61786d39db6a900d1381f.tar.gz
volse-hubzilla-dffce63662c54db7ebb61786d39db6a900d1381f.tar.bz2
volse-hubzilla-dffce63662c54db7ebb61786d39db6a900d1381f.zip
implement republish permission for use in sourced channels
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php3
-rwxr-xr-xinclude/items.php11
-rw-r--r--include/permissions.php1
3 files changed, 14 insertions, 1 deletions
diff --git a/include/Contact.php b/include/Contact.php
index b9e879bcf..46c84aab6 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -219,7 +219,8 @@ function channel_remove($channel_id, $local = true) {
$r = q("update channel set channel_pageflags = (channel_pageflags | %d), channel_r_stream = 0, channel_r_profile = 0,
channel_r_photos = 0, channel_r_abook = 0, channel_w_stream = 0, channel_w_wall = 0, channel_w_tagwall = 0,
channel_w_comment = 0, channel_w_mail = 0, channel_w_photos = 0, channel_w_chat = 0, channel_a_delegate = 0,
- channel_r_storage = 0, channel_w_storage = 0, channel_r_pages = 0, channel_w_pages = 0 where channel_id = %d limit 1",
+ channel_r_storage = 0, channel_w_storage = 0, channel_r_pages = 0, channel_w_pages = 0, channel_a_republish = 0
+ where channel_id = %d limit 1",
intval(PAGE_REMOVED),
intval($channel_id)
);
diff --git a/include/items.php b/include/items.php
index dcd9eb6fc..18736f974 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2308,6 +2308,17 @@ function check_item_source($uid,$item) {
if(! $r)
return false;
+ $x = q("select abook_their_perms from abook where abook_channel = %d and abook_xchan = '%s' limit 1",
+ intval($uid),
+ dbesc($item['owner_xchan'])
+ );
+
+ if(! $x)
+ return false;
+
+ if(! ($x[0]['abook_their_perms'] & PERMS_A_REPUBLISH))
+ return false;
+
if($r[0]['src_channel_xchan'] === $item['owner_xchan'])
return false;
diff --git a/include/permissions.php b/include/permissions.php
index bf50ebdd1..45ea7c3eb 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -28,6 +28,7 @@ function get_perms() {
'write_storage' => array('channel_w_storage', intval(PERMS_W_STORAGE), false, t('Can write to my "public" file storage'), ''),
'write_pages' => array('channel_w_pages', intval(PERMS_W_PAGES), false, t('Can edit my "public" pages'), ''),
+ 'republish' => array('channel_a_republish', intval(PERMS_A_REPUBLISH), false, t('Can source my "public" posts in derived channels'), t('Somewhat advanced - very useful in open communities')),
'delegate' => array('channel_a_delegate', intval(PERMS_A_DELEGATE), false, t('Can administer my channel resources'), t('Extremely advanced. Leave this alone unless you know what you are doing')),
);
$ret = array('global_permissions' => $global_perms);