implement republish permission for use in sourced channels

This commit is contained in:
friendica
2013-09-30 21:49:26 -07:00
parent 2353e6d23f
commit dffce63662
8 changed files with 68 additions and 38 deletions

View File

@@ -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)
);

View File

@@ -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;

View File

@@ -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);