From 3891b63a1eb52076337885487f251a10580a4a85 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 27 Apr 2016 18:50:13 +0200 Subject: Bug 218917 - Allow the login name to be different from the email address Original patch by Gervase Markham r=gerv a=dkl --- Bugzilla/Config/Auth.pm | 13 ++++-------- Bugzilla/Config/BugChange.pm | 3 ++- Bugzilla/Config/Common.pm | 47 ++++++++++++++++++++++++++++++++++++-------- 3 files changed, 45 insertions(+), 18 deletions(-) (limited to 'Bugzilla/Config') diff --git a/Bugzilla/Config/Auth.pm b/Bugzilla/Config/Auth.pm index 219e834ee..326c4cd3f 100644 --- a/Bugzilla/Config/Auth.pm +++ b/Bugzilla/Config/Auth.pm @@ -74,12 +74,6 @@ sub get_param_list { default => '0' }, - { - name => 'webservice_email_filter', - type => 'b', - default => 0 - }, - { name => 'emailregexp', type => 't', @@ -95,9 +89,10 @@ sub get_param_list { }, { - name => 'emailsuffix', - type => 't', - default => '' + name => 'use_email_as_login', + type => 'b', + default => '1', + onchange => \&change_use_email_as_login }, { diff --git a/Bugzilla/Config/BugChange.pm b/Bugzilla/Config/BugChange.pm index b8a80dd94..b6cd7ae43 100644 --- a/Bugzilla/Config/BugChange.pm +++ b/Bugzilla/Config/BugChange.pm @@ -38,7 +38,8 @@ sub get_param_list { type => 's', choices => \@closed_bug_statuses, default => $closed_bug_statuses[0], - checker => \&check_bug_status + checker => \&check_bug_status, + onchange => \&change_duplicate_or_move_bug_status }, { diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm index 6e89fdcae..e6e0d4a23 100644 --- a/Bugzilla/Config/Common.pm +++ b/Bugzilla/Config/Common.pm @@ -29,6 +29,8 @@ use parent qw(Exporter); check_bug_status check_smtp_auth check_theschwartz_available check_maxattachmentsize check_email check_smtp_ssl check_comment_taggers_group check_smtp_server check_resolution + + change_use_email_as_login change_duplicate_or_move_bug_status ); # Checking functions for the various values @@ -362,18 +364,36 @@ sub check_comment_taggers_group { return check_group($group_name); } +# Change handler functions for various parameters + +# If use_email_as_login is turned on, update all login names to be email +# addresses. +sub change_use_email_as_login { + my $newvalue = shift; + if ($newvalue) { + Bugzilla->dbh->do('UPDATE profiles SET login_name = email'); + } +} + +sub change_duplicate_or_move_bug_status { + my $newvalue = shift; + Bugzilla::Status::add_missing_bug_status_transitions($newvalue); +} + # OK, here are the parameter definitions themselves. # # Each definition is a hash with keys: # -# name - name of the param -# desc - description of the param (for editparams.cgi) -# type - see below -# choices - (optional) see below -# default - default value for the param -# checker - (optional) checking function for validating parameter entry -# It is called with the value of the param as the first arg and a -# reference to the param's hash as the second argument +# name - name of the param +# desc - description of the param (for editparams.cgi) +# type - see below +# choices - (optional) see below +# default - default value for the param +# checker - (optional) checking function for validating parameter entry. +# It is called with the value of the param as the first arg +# and a reference to the param's hash as the second argument. +# onchange - (optional) handling function for parameter changes. +# The argument is the new value of the param. # # The type value can be one of the following: # @@ -467,6 +487,17 @@ Checks that the value is a valid regexp Checks that the required modules for comment tagging are installed, and that a valid group is provided. +=item C + +Change handler for "use_email_as_login" parameter - if param is changed to +true, updates login_name field to be the value of the email field for all +users. + +=item C + +Change handler for "duplicate_or_move_bug_status" parameter - if param is +changed, insert all missing transitions to the new bug status. + =back =head1 B -- cgit v1.2.3-24-g4f1b