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/Common.pm | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'Bugzilla/Config/Common.pm') 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