From d5d6158973ecb83b63d42c57c96dce849842c83b Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Nov 2014 17:11:02 -0800 Subject: ok heads up - potentially destabilising change. I've tried to sort out all the default connection permissions for those who don't have a predefined (or therefore have a "custom") permissions role. Unfortunately this includes most people that were using this software more than a month ago. The real changes are that the SELF address book entry no longer holds "auto-permissions" but instead holds your "default permissions" (if you have a pre-defined role, the defaults will be pulled from the role table). The auto permissions have moved to a pconfig (uid.system.autoperms). A DB update will move these settings into their new homes. What used to be the "Auto-permissions settings" page is now the "default permissions settings" page and a checkbox therein decides whether or not to apply the permissions automatically. A link to this page will only be shown when you have the "custom" role selected. With luck nobody will notice anything wrong. But at least for the next few days, please review permissions that have been assigned to new connections (either automatically or manually) and make sure they make sense (e.g. they aren't "nothing"). You still need to take action when seeing a message "permissions have changed but not yet submitted" as we always let you review and perhaps adjust the settings _before_ a connection is established (unless you have autoperms turned on). --- mod/connedit.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index b10d9f3b8..0e129e32d 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -68,6 +68,14 @@ function connedit_post(&$a) { call_hooks('contact_edit_post', $_POST); + if($orig_record['abook_flags'] & ABOOK_FLAG_SELF) { + $autoperms = intval($_POST['autoperms']); + } + else { + $autoperms = null; + } + + $profile_id = $_POST['profile_assign']; if($profile_id) { $r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1", @@ -121,7 +129,7 @@ function connedit_post(&$a) { if($orig_record[0]['abook_profile'] != $profile_id) { //Update profile photo permissions - logger('As a new profile was assigned updating profile photos'); + logger('A new profile was assigned - updating profile photos'); require_once('mod/profile_photo.php'); profile_photo_set_profile_perms($profile_id); @@ -209,6 +217,9 @@ function connedit_post(&$a) { call_hooks('accept_follow', $arr); } + if(! is_null($autoperms)) + set_pconfig(local_user(),'system','autoperms',(($autoperms) ? $abook_my_perms : 0)); + connedit_clone($a); return; @@ -261,12 +272,8 @@ function connedit_content(&$a) { $x = get_role_perms($role); if($x['perms_accept']) $my_perms = $x['perms_accept']; - else { - // fixme - we need to be able to define these somewhere for the custom role - $my_perms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK - |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT - |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; - } + else + $my_perms = get_channel_default_perms(local_user()); } if($my_perms) { $o .= "