rfe: User Profile Privacy Settings (#507) - users now have granular control of whether or not their profile fields are viewable - admin settings still apply
This commit is contained in:
parent
2945189adb
commit
6eff997f81
8 changed files with 266 additions and 46 deletions
Binary file not shown.
|
|
@ -24,6 +24,7 @@ use WebGUI::Asset::Wobject::Survey;
|
|||
use WebGUI::Asset::Wobject::Survey::SurveyJSON;
|
||||
use WebGUI::Asset::Wobject::Survey::ResponseJSON;
|
||||
use WebGUI::ProfileField;
|
||||
use JSON;
|
||||
|
||||
my $toVersion = '7.6.4';
|
||||
my $quiet; # this line required
|
||||
|
|
@ -37,9 +38,48 @@ addPosMode($session);
|
|||
fixFriendsGroups( $session );
|
||||
upgradeAccount( $session );
|
||||
removeProcessRecurringPaymentsFromConfig( $session );
|
||||
addExtendedProfilePrivileges( $session );
|
||||
addStorageUrlMacro( $session );
|
||||
finish($session); # this line required
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addExtendedProfilePrivileges {
|
||||
my $session = shift;
|
||||
|
||||
print qq{\tExtending User Profile Privileges..} if !$quiet;
|
||||
|
||||
my $userProfDesc = $session->db->buildHashRef('describe userProfileData');
|
||||
if(grep { $_ =~ /^wg_privacySettings/ } keys %{$userProfDesc}) {
|
||||
$session->db->write("alter table userProfileData drop column wg_privacySettings");
|
||||
}
|
||||
$session->db->write("alter table userProfileData add wg_privacySettings longtext");
|
||||
|
||||
my $fields = WebGUI::ProfileField->getFields($session);
|
||||
|
||||
my $users = $session->db->buildArrayRef("select userId from users");
|
||||
foreach my $userId (@{$users}) {
|
||||
my $hash = {};
|
||||
foreach my $field (@{$fields}) {
|
||||
if($field->getId eq "publicEmail") {
|
||||
my $u = WebGUI::User->new($session,$userId);
|
||||
$hash->{$field->getId} = $u->profileField("publicEmail") ? "all" : "none";
|
||||
next;
|
||||
}
|
||||
$hash->{$field->getId} = $field->isViewable ? "all" : "none";
|
||||
}
|
||||
my $json = JSON->new->encode($hash);
|
||||
$session->db->write("update userProfileData set wg_privacySettings=? where userId=?",[$json,$userId]);
|
||||
}
|
||||
|
||||
#Delete the public email field
|
||||
my $publicEmail = WebGUI::ProfileField->new($session,"publicEmail");
|
||||
if(defined $publicEmail) {
|
||||
$publicEmail->delete;
|
||||
}
|
||||
|
||||
print qq{Finished\n} if !$quiet;
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addPosMode {
|
||||
|
|
@ -447,7 +487,6 @@ sub upgradeAccount {
|
|||
$setting->add("shopStyleTemplateId",""); #Use the userStyle by default
|
||||
$setting->add("shopLayoutTemplateId","aUDsJ-vB9RgP-AYvPOy8FQ");
|
||||
|
||||
|
||||
#Add inbox changes
|
||||
$session->db->write(q{
|
||||
create table inbox_messageState (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue