Skip to content

Commit

Permalink
fix: changing orgs for pro moderators (#8149)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet authored Mar 1, 2023
1 parent 112b378 commit d7b8592
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cgi/user.pl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
}

# change organization
if ($type eq 'edit_owner' && $admin) {
if ($type eq 'edit_owner') {
# only admin and pro moderators can change organization freely
if ($admin or $User{pro_moderator}) {
ProductOpener::Users::check_edit_owner($user_ref, \@errors);
Expand Down
2 changes: 1 addition & 1 deletion lib/ProductOpener/Users.pm
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ sub check_user_form ($type, $user_ref, $errors_ref) {

$log->debug("check_user_form", {type => $type, user_ref => $user_ref, email => $email}) if $log->is_debug();

if ($user_ref->{email} ne $email) {
if ((defined $email) and ($email ne '') and ($user_ref->{email} ne $email)) {

# check that the email is not already used
my $emails_ref = retrieve("$data_root/users/users_emails.sto");
Expand Down
13 changes: 13 additions & 0 deletions scripts/snippets/remove_broken_entry_with_empty_email.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/perl -w

use ProductOpener::PerlStandards;

use ProductOpener::Config qw/:all/;
use ProductOpener::Store qw/:all/;

my $emails_ref = retrieve("$data_root/users/users_emails.sto");

if (defined $emails_ref->{''}) {
delete $emails_ref->{''};
store("$data_root/users/users_emails.sto", $emails_ref);
}

0 comments on commit d7b8592

Please sign in to comment.