provide a specific permission for liking profiles (reuse the obsolete bookmark permission), also remove the unused 'unconnected contacts' view for now.

This commit is contained in:
friendica 2014-07-17 20:54:30 -07:00
parent 0cb81714d8
commit b19176169c
9 changed files with 56 additions and 28 deletions

View File

@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1117 );
define ( 'DB_UPDATE_VERSION', 1118 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -282,7 +282,7 @@ define ( 'PERMS_W_STORAGE', 0x02000);
define ( 'PERMS_R_PAGES', 0x04000);
define ( 'PERMS_W_PAGES', 0x08000);
define ( 'PERMS_A_REPUBLISH', 0x10000);
define ( 'PERMS_A_BOOKMARK', 0x20000);
define ( 'PERMS_W_LIKE', 0x20000);
// General channel permissions

View File

@ -20,9 +20,11 @@ function get_perms() {
// Write permissions
'send_stream' => array('channel_w_stream', intval(PERMS_W_STREAM), false, t('Can send me their channel stream and posts'), ''),
'post_wall' => array('channel_w_wall', intval(PERMS_W_WALL), false, t('Can post on my channel page ("wall")'), ''),
'post_comments' => array('channel_w_comment', intval(PERMS_W_COMMENT), false, t('Can comment on my posts'), ''),
'post_comments' => array('channel_w_comment', intval(PERMS_W_COMMENT), false, t('Can comment on or like my posts'), ''),
'post_mail' => array('channel_w_mail', intval(PERMS_W_MAIL), false, t('Can send me private mail messages'), ''),
'post_photos' => array('channel_w_photos', intval(PERMS_W_PHOTOS), false, t('Can post photos to my photo albums'), ''),
'post_like' => array('channel_w_like', intval(PERMS_W_LIKE), false, t('Can like/dislike stuff'), 'Profiles and things other than posts/comments'),
'tag_deliver' => array('channel_w_tagwall', intval(PERMS_W_TAGWALL), false, t('Can forward to all my channel contacts via post @mentions'), t('Advanced - useful for creating group forum channels')),
'chat' => array('channel_w_chat', intval(PERMS_W_CHAT), false, t('Can chat with me (when available)'), t('')),
'write_storage' => array('channel_w_storage', intval(PERMS_W_STORAGE), false, t('Can write to my "public" file storage'), ''),
@ -395,6 +397,7 @@ function site_default_perms() {
'write_storage' => 0,
'write_pages' => 0,
'delegate' => 0,
'post_like' => PERMS_NETWORK
);
$global_perms = get_perms();

View File

@ -204,7 +204,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
`channel_r_pages` int(10) unsigned NOT NULL DEFAULT '128',
`channel_w_pages` int(10) unsigned NOT NULL DEFAULT '128',
`channel_a_republish` int(10) unsigned NOT NULL DEFAULT '128',
`channel_a_bookmark` int(10) unsigned NOT NULL DEFAULT '128',
`channel_w_like` int(10) unsigned NOT NULL DEFAULT '128',
PRIMARY KEY (`channel_id`),
UNIQUE KEY `channel_address_unique` (`channel_address`),
KEY `channel_account_id` (`channel_account_id`),
@ -239,7 +239,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
KEY `channel_w_pages` (`channel_w_pages`),
KEY `channel_deleted` (`channel_deleted`),
KEY `channel_a_republish` (`channel_a_republish`),
KEY `channel_a_bookmark` (`channel_a_bookmark`),
KEY `channel_w_like` (`channel_w_like`),
KEY `channel_dirdate` (`channel_dirdate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1117 );
define( 'UPDATE_VERSION' , 1118 );
/**
*
@ -1303,4 +1303,14 @@ function update_r1115() {
function update_r1116() {
@os_mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
return UPDATE_SUCCESS;
}
}
function update_r1117() {
$r = q("ALTER TABLE `channel` CHANGE `channel_a_bookmark` `channel_w_like` INT( 10 ) UNSIGNED NOT NULL DEFAULT '128',
DROP INDEX `channel_a_bookmark` , ADD INDEX `channel_w_like` ( `channel_w_like` ) ");
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -235,11 +235,11 @@ function connections_content(&$a) {
}
nav_set_selected('intros');
break;
case 'unconnected':
$search_flags = ABOOK_FLAG_UNCONNECTED;
$head = t('Unconnected');
$unconnected = true;
break;
// case 'unconnected':
// $search_flags = ABOOK_FLAG_UNCONNECTED;
// $head = t('Unconnected');
// $unconnected = true;
// break;
case 'all':
$head = t('All');
@ -316,12 +316,12 @@ function connections_content(&$a) {
'title' => t('Only show hidden connections'),
),
array(
'label' => t('Unconnected'),
'url' => z_root() . '/connections/unconnected',
'sel' => ($unconnected) ? 'active' : '',
'title' => t('Only show one-way connections'),
),
// array(
// 'label' => t('Unconnected'),
// 'url' => z_root() . '/connections/unconnected',
// 'sel' => ($unconnected) ? 'active' : '',
// 'title' => t('Only show one-way connections'),
// ),
);

View File

@ -149,7 +149,7 @@ function like_content(&$a) {
$perms = get_all_perms($owner_uid,$observer['xchan_hash']);
if(! ($perms['post_wall'] && $perms['view_profile'])) {
if(! ($perms['post_like'] && $perms['view_profile'])) {
if($interactive) {
notice( t('Permission denied.') . EOL);
return $o;

View File

@ -309,7 +309,7 @@ function settings_post(&$a) {
$arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0);
$arr['channel_w_pages'] = (($_POST['write_pages']) ? $_POST['write_pages'] : 0);
$arr['channel_a_republish'] = (($_POST['republish']) ? $_POST['republish'] : 0);
$arr['channel_a_bookmark'] = (($_POST['bookmark']) ? $_POST['bookmark'] : 0);
$arr['channel_w_like'] = (($_POST['post_like']) ? $_POST['post_like'] : 0);
$defperms = 0;
if(x($_POST['def_view_stream']))
@ -346,8 +346,8 @@ function settings_post(&$a) {
$defperms += $_POST['def_write_pages'];
if(x($_POST['def_republish']))
$defperms += $_POST['def_republish'];
if(x($_POST['def_bookmark']))
$defperms += $_POST['def_bookmark'];
if(x($_POST['def_post_like']))
$defperms += $_POST['def_post_like'];
$notify = 0;
@ -405,7 +405,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','hide_online_status',$hide_presence);
set_pconfig(local_user(),'system','channel_menu',$channel_menu);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_default_group = '%s', channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d, channel_a_republish = %d, channel_a_bookmark = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d limit 1",
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_default_group = '%s', channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d, channel_a_republish = %d, channel_w_like = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d limit 1",
dbesc($username),
intval($pageflags),
dbesc($timezone),
@ -432,7 +432,7 @@ function settings_post(&$a) {
intval($arr['channel_r_pages']),
intval($arr['channel_w_pages']),
intval($arr['channel_a_republish']),
intval($arr['channel_a_bookmark']),
intval($arr['channel_w_like']),
dbesc($str_contact_allow),
dbesc($str_group_allow),
dbesc($str_contact_deny),

View File

@ -33,6 +33,7 @@ function connectFullShare() {
$('#me_id_perms_chat').attr('checked','checked');
$('#me_id_perms_view_storage').attr('checked','checked');
$('#me_id_perms_republish').attr('checked','checked');
$('#me_id_perms_post_like').attr('checked','checked');
$('.abook-permschange').show();
$('.abook-permschange').html(aStr['permschange']);
@ -52,6 +53,7 @@ function connectCautiousShare() {
$('#me_id_perms_send_stream').attr('checked','checked');
$('#me_id_perms_post_comments').attr('checked','checked');
$('#me_id_perms_post_mail').attr('checked','checked');
$('#me_id_perms_post_like').attr('checked','checked');
$('.abook-permschange').show();
$('.abook-permschange').html(aStr['permschange']);
@ -75,6 +77,7 @@ function connectForum() {
$('#me_id_perms_post_mail').attr('checked','checked');
$('#me_id_perms_tag_deliver').attr('checked','checked');
$('#me_id_perms_republish').attr('checked','checked');
$('#me_id_perms_post_like').attr('checked','checked');
$('.abook-permschange').show();
$('.abook-permschange').html(aStr['permschange']);

View File

@ -24,6 +24,18 @@ $(document).ready(function() {
});
/**
* 0 nobody
* 1 perms_specific
* 2 perms_contacts
* 3 perms_pending
* 4 perms_site
* 5 perms_network
* 6 perms_authed
* 7 perms_public
*/
function channel_privacy_macro(n) {
if(n == 0) {
$('#id_view_stream option').eq(0).attr('selected','selected');
@ -43,7 +55,7 @@ function channel_privacy_macro(n) {
$('#id_write_pages option').eq(0).attr('selected','selected');
$('#id_delegate option').eq(0).attr('selected','selected');
$('#id_republish option').eq(0).attr('selected','selected');
$('#id_bookmark option').eq(0).attr('selected','selected');
$('#id_post_like option').eq(0).attr('selected','selected');
$('#id_profile_in_directory_onoff .off').removeClass('hidden');
$('#id_profile_in_directory_onoff .on').addClass('hidden');
$('#id_profile_in_directory').val(0);
@ -66,7 +78,7 @@ function channel_privacy_macro(n) {
$('#id_write_pages option').eq(1).attr('selected','selected');
$('#id_delegate option').eq(0).attr('selected','selected');
$('#id_republish option').eq(0).attr('selected','selected');
$('#id_bookmark option').eq(1).attr('selected','selected');
$('#id_post_like option').eq(1).attr('selected','selected');
$('#id_profile_in_directory_onoff .off').removeClass('hidden');
$('#id_profile_in_directory_onoff .on').addClass('hidden');
$('#id_profile_in_directory').val(0);
@ -89,7 +101,7 @@ function channel_privacy_macro(n) {
$('#id_write_pages option').eq(0).attr('selected','selected');
$('#id_delegate option').eq(0).attr('selected','selected');
$('#id_republish option').eq(1).attr('selected','selected');
$('#id_bookmark option').eq(1).attr('selected','selected');
$('#id_post_like option').eq(5).attr('selected','selected');
$('#id_profile_in_directory_onoff .on').removeClass('hidden');
$('#id_profile_in_directory_onoff .off').addClass('hidden');
$('#id_profile_in_directory').val(1);
@ -112,7 +124,7 @@ function channel_privacy_macro(n) {
$('#id_write_pages option').eq(2).attr('selected','selected');
$('#id_delegate option').eq(0).attr('selected','selected');
$('#id_republish option').eq(5).attr('selected','selected');
$('#id_bookmark option').eq(5).attr('selected','selected');
$('#id_post_like option').eq(6).attr('selected','selected');
$('#id_profile_in_directory_onoff .on').removeClass('hidden');
$('#id_profile_in_directory_onoff .off').addClass('hidden');
$('#id_profile_in_directory').val(1);