Do not export anything from Bugzilla::User
parent
5a400911bb
commit
cfd8911bdc
|
@ -48,7 +48,7 @@ sub create_or_update_user {
|
||||||
# A passed-in user_id always overrides anything else, for determining
|
# A passed-in user_id always overrides anything else, for determining
|
||||||
# what account we should return.
|
# what account we should return.
|
||||||
if (!$user_id) {
|
if (!$user_id) {
|
||||||
my $username_user_id = login_to_id($username || '');
|
my $username_user_id = Bugzilla::User::login_to_id($username || '');
|
||||||
my $extern_user_id;
|
my $extern_user_id;
|
||||||
if ($extern_id) {
|
if ($extern_id) {
|
||||||
trick_taint($extern_id);
|
trick_taint($extern_id);
|
||||||
|
|
|
@ -123,7 +123,7 @@ sub check_credentials {
|
||||||
# Cycle through the adresses and check if they're Bugzilla logins.
|
# Cycle through the adresses and check if they're Bugzilla logins.
|
||||||
# Use the first one that returns a valid id.
|
# Use the first one that returns a valid id.
|
||||||
foreach my $email (@emails) {
|
foreach my $email (@emails) {
|
||||||
if ( login_to_id($email) ) {
|
if ( Bugzilla::User::login_to_id($email) ) {
|
||||||
$params->{bz_username} = $email;
|
$params->{bz_username} = $email;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,19 +235,19 @@ sub Send
|
||||||
my $changer = $forced->{changer};
|
my $changer = $forced->{changer};
|
||||||
if ($forced->{owner})
|
if ($forced->{owner})
|
||||||
{
|
{
|
||||||
push @assignees, login_to_id($forced->{owner}, THROW_ERROR);
|
push @assignees, Bugzilla::User::login_to_id($forced->{owner}, THROW_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forced->{qacontact})
|
if ($forced->{qacontact})
|
||||||
{
|
{
|
||||||
push @qa_contacts, login_to_id($forced->{qacontact}, THROW_ERROR);
|
push @qa_contacts, Bugzilla::User::login_to_id($forced->{qacontact}, THROW_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forced->{cc})
|
if ($forced->{cc})
|
||||||
{
|
{
|
||||||
foreach my $cc (@{$forced->{cc}})
|
foreach my $cc (@{$forced->{cc}})
|
||||||
{
|
{
|
||||||
push @ccs, login_to_id($cc, THROW_ERROR);
|
push @ccs, Bugzilla::User::login_to_id($cc, THROW_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,18 +429,18 @@ sub Send
|
||||||
{
|
{
|
||||||
foreach my $cc_user (split(/[\s,]+/, $diff->{removed}))
|
foreach my $cc_user (split(/[\s,]+/, $diff->{removed}))
|
||||||
{
|
{
|
||||||
my $uid = login_to_id($cc_user);
|
my $uid = Bugzilla::User::login_to_id($cc_user);
|
||||||
$recipients{$uid}->{+REL_CC} = BIT_DIRECT if $uid;
|
$recipients{$uid}->{+REL_CC} = BIT_DIRECT if $uid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ($diff->{fielddesc} eq "QAContact")
|
elsif ($diff->{fielddesc} eq "QAContact")
|
||||||
{
|
{
|
||||||
my $uid = login_to_id($diff->{removed});
|
my $uid = Bugzilla::User::login_to_id($diff->{removed});
|
||||||
$recipients{$uid}->{+REL_QA} = BIT_DIRECT if $uid;
|
$recipients{$uid}->{+REL_QA} = BIT_DIRECT if $uid;
|
||||||
}
|
}
|
||||||
elsif ($diff->{fielddesc} eq "AssignedTo")
|
elsif ($diff->{fielddesc} eq "AssignedTo")
|
||||||
{
|
{
|
||||||
my $uid = login_to_id($diff->{removed});
|
my $uid = Bugzilla::User::login_to_id($diff->{removed});
|
||||||
$recipients{$uid}->{+REL_ASSIGNEE} = BIT_DIRECT if $uid;
|
$recipients{$uid}->{+REL_ASSIGNEE} = BIT_DIRECT if $uid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ sub Send
|
||||||
my @watchers = split(/[,\s]+/, Bugzilla->params->{globalwatchers});
|
my @watchers = split(/[,\s]+/, Bugzilla->params->{globalwatchers});
|
||||||
foreach (@watchers)
|
foreach (@watchers)
|
||||||
{
|
{
|
||||||
my $watcher_id = login_to_id($_);
|
my $watcher_id = Bugzilla::User::login_to_id($_);
|
||||||
next unless $watcher_id;
|
next unless $watcher_id;
|
||||||
$recipients{$watcher_id}->{+REL_GLOBAL_WATCHER} = BIT_DIRECT;
|
$recipients{$watcher_id}->{+REL_GLOBAL_WATCHER} = BIT_DIRECT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ sub _check_cc_list
|
||||||
my %cc_ids;
|
my %cc_ids;
|
||||||
foreach my $cc (@$cc_list)
|
foreach my $cc (@$cc_list)
|
||||||
{
|
{
|
||||||
my $id = login_to_id($cc, THROW_ERROR);
|
my $id = Bugzilla::User::login_to_id($cc, THROW_ERROR);
|
||||||
$cc_ids{$id} = 1;
|
$cc_ids{$id} = 1;
|
||||||
}
|
}
|
||||||
return [ keys %cc_ids ];
|
return [ keys %cc_ids ];
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ sub show_flag_reminders
|
||||||
$flag = Bugzilla::Flag->new({ id => $2 });
|
$flag = Bugzilla::Flag->new({ id => $2 });
|
||||||
$flag->{status} = $ARGS->{$_};
|
$flag->{status} = $ARGS->{$_};
|
||||||
if (($login = trim($ARGS->{"requestee-".$flag->{id}})) &&
|
if (($login = trim($ARGS->{"requestee-".$flag->{id}})) &&
|
||||||
($login = login_to_id($login)))
|
($login = Bugzilla::User::login_to_id($login)))
|
||||||
{
|
{
|
||||||
$flag->{requestee_id} = $login;
|
$flag->{requestee_id} = $login;
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,8 +285,7 @@ sub make_admin {
|
||||||
my ($user) = @_;
|
my ($user) = @_;
|
||||||
my $dbh = Bugzilla->dbh;
|
my $dbh = Bugzilla->dbh;
|
||||||
|
|
||||||
$user = ref($user) ? $user
|
$user = ref($user) ? $user : Bugzilla::User->check($user);
|
||||||
: new Bugzilla::User(login_to_id($user, THROW_ERROR));
|
|
||||||
|
|
||||||
my $admin_group = new Bugzilla::Group({ name => 'admin' });
|
my $admin_group = new Bugzilla::Group({ name => 'admin' });
|
||||||
|
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ sub init
|
||||||
foreach my $name (@guessed)
|
foreach my $name (@guessed)
|
||||||
{
|
{
|
||||||
$name = trim($name);
|
$name = trim($name);
|
||||||
if ($name && lc $name ne '%user%' && !login_to_id($name))
|
if ($name && lc $name ne '%user%' && !Bugzilla::User::login_to_id($name))
|
||||||
{
|
{
|
||||||
# Do a match on user login or name
|
# Do a match on user login or name
|
||||||
my $u = Bugzilla::User::match_name($name, 1)->[0];
|
my $u = Bugzilla::User::match_name($name, 1)->[0];
|
||||||
|
@ -2296,7 +2296,7 @@ sub _cc_nonchanged
|
||||||
sub _long_desc_changedby
|
sub _long_desc_changedby
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $id = login_to_id($self->{value}, THROW_ERROR);
|
my $id = Bugzilla::User::login_to_id($self->{value}, THROW_ERROR);
|
||||||
my @priv = $self->{user}->is_insider ? () : "longdescs.isprivate=0";
|
my @priv = $self->{user}->is_insider ? () : "longdescs.isprivate=0";
|
||||||
$self->{term} = {
|
$self->{term} = {
|
||||||
base_table => "longdescs",
|
base_table => "longdescs",
|
||||||
|
@ -2494,7 +2494,7 @@ sub _longdescs_isprivate
|
||||||
sub _work_time_changedby
|
sub _work_time_changedby
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $id = login_to_id($self->{value}, THROW_ERROR);
|
my $id = Bugzilla::User::login_to_id($self->{value}, THROW_ERROR);
|
||||||
my @priv = $self->{user}->is_insider ? () : "longdescs.isprivate=0";
|
my @priv = $self->{user}->is_insider ? () : "longdescs.isprivate=0";
|
||||||
$self->{term} = {
|
$self->{term} = {
|
||||||
base_table => "longdescs",
|
base_table => "longdescs",
|
||||||
|
@ -3034,7 +3034,7 @@ sub _changedby
|
||||||
ThrowUserError("invalid_activity_field", { field => $self->{field} });
|
ThrowUserError("invalid_activity_field", { field => $self->{field} });
|
||||||
}
|
}
|
||||||
$fieldid = $fieldid->id;
|
$fieldid = $fieldid->id;
|
||||||
my $id = login_to_id($self->{value}, THROW_ERROR);
|
my $id = Bugzilla::User::login_to_id($self->{value}, THROW_ERROR);
|
||||||
$self->{term} = {
|
$self->{term} = {
|
||||||
base_table => 'bugs_activity',
|
base_table => 'bugs_activity',
|
||||||
where => [ "bugs_activity.fieldid = $fieldid",
|
where => [ "bugs_activity.fieldid = $fieldid",
|
||||||
|
@ -3053,7 +3053,7 @@ sub _in_search_results
|
||||||
{
|
{
|
||||||
# Allow to match on shared searches via 'SearchName <user@domain.com>' syntax
|
# Allow to match on shared searches via 'SearchName <user@domain.com>' syntax
|
||||||
$v = $1;
|
$v = $1;
|
||||||
$sharer = login_to_id(trim($2), THROW_ERROR);
|
$sharer = Bugzilla::User::login_to_id(trim($2), THROW_ERROR);
|
||||||
}
|
}
|
||||||
my $query = Bugzilla::Search::Saved->check({
|
my $query = Bugzilla::Search::Saved->check({
|
||||||
name => trim($v),
|
name => trim($v),
|
||||||
|
|
|
@ -55,7 +55,7 @@ use DateTime::TimeZone;
|
||||||
use Scalar::Util qw(blessed);
|
use Scalar::Util qw(blessed);
|
||||||
use Storable qw(dclone);
|
use Storable qw(dclone);
|
||||||
|
|
||||||
use base qw(Bugzilla::Object Exporter);
|
use base qw(Bugzilla::Object);
|
||||||
# FIXME Remove procedural APIs
|
# FIXME Remove procedural APIs
|
||||||
@Bugzilla::User::EXPORT = qw(
|
@Bugzilla::User::EXPORT = qw(
|
||||||
is_available_username login_to_id validate_password
|
is_available_username login_to_id validate_password
|
||||||
|
|
|
@ -56,7 +56,7 @@ if ($changer !~ /$match/) {
|
||||||
print STDERR "Changer \"$changer\" doesn't match email regular expression.\n";
|
print STDERR "Changer \"$changer\" doesn't match email regular expression.\n";
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
if(!login_to_id($changer)) {
|
if(!Bugzilla::User::login_to_id($changer)) {
|
||||||
print STDERR "\"$changer\" is not a login ID.\n";
|
print STDERR "\"$changer\" is not a login ID.\n";
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ if ($action eq 'save' && $current_module)
|
||||||
# can not use Bugzilla::User
|
# can not use Bugzilla::User
|
||||||
foreach my $watcher (split(/[,\s]+/, $value))
|
foreach my $watcher (split(/[,\s]+/, $value))
|
||||||
{
|
{
|
||||||
unless (login_to_id($watcher))
|
unless (Bugzilla::User::login_to_id($watcher))
|
||||||
{
|
{
|
||||||
ThrowUserError('invalid_parameter', { name => $name, err => "no such user $watcher" });
|
ThrowUserError('invalid_parameter', { name => $name, err => "no such user $watcher" });
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ if ($ARGS->{update})
|
||||||
{
|
{
|
||||||
if ($mailto_type == MAILTO_USER)
|
if ($mailto_type == MAILTO_USER)
|
||||||
{
|
{
|
||||||
$mailto_id = login_to_id($mailto);
|
$mailto_id = Bugzilla::User::login_to_id($mailto);
|
||||||
}
|
}
|
||||||
elsif ($mailto_type == MAILTO_GROUP)
|
elsif ($mailto_type == MAILTO_GROUP)
|
||||||
{
|
{
|
||||||
|
|
|
@ -254,7 +254,7 @@ sub email_in_after_parse {
|
||||||
my $dbh = Bugzilla->dbh;
|
my $dbh = Bugzilla->dbh;
|
||||||
|
|
||||||
# No other check needed if this is a valid regular user.
|
# No other check needed if this is a valid regular user.
|
||||||
return if login_to_id($reporter);
|
return if Bugzilla::User::login_to_id($reporter);
|
||||||
|
|
||||||
# The reporter is not a regular user. We create an account for him,
|
# The reporter is not a regular user. We create an account for him,
|
||||||
# but he can only comment on existing bugs.
|
# but he can only comment on existing bugs.
|
||||||
|
|
|
@ -201,7 +201,7 @@ sub changePassword
|
||||||
my $password = delete $ARGS->{password};
|
my $password = delete $ARGS->{password};
|
||||||
my $matchpassword = delete $ARGS->{matchpassword};
|
my $matchpassword = delete $ARGS->{matchpassword};
|
||||||
defined $password && defined $matchpassword || ThrowUserError('require_new_password');
|
defined $password && defined $matchpassword || ThrowUserError('require_new_password');
|
||||||
validate_password($password, $matchpassword);
|
Bugzilla::User::validate_password($password, $matchpassword);
|
||||||
|
|
||||||
my $dbh = Bugzilla->dbh;
|
my $dbh = Bugzilla->dbh;
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ sub changeEmail
|
||||||
}
|
}
|
||||||
# The new email address should be available as this was
|
# The new email address should be available as this was
|
||||||
# confirmed initially so cancel token if it is not still available
|
# confirmed initially so cancel token if it is not still available
|
||||||
if (!is_available_username($new_email, $old_email))
|
if (!Bugzilla::User::is_available_username($new_email, $old_email))
|
||||||
{
|
{
|
||||||
$vars->{email} = $new_email; # Needed for Bugzilla::Token::Cancel's mail
|
$vars->{email} = $new_email; # Needed for Bugzilla::Token::Cancel's mail
|
||||||
Bugzilla::Token::Cancel($token, "account_exists", $vars);
|
Bugzilla::Token::Cancel($token, "account_exists", $vars);
|
||||||
|
@ -349,7 +349,7 @@ sub confirm_create_account
|
||||||
my (undef, undef, $login_name) = Bugzilla::Token::GetTokenData($token);
|
my (undef, undef, $login_name) = Bugzilla::Token::GetTokenData($token);
|
||||||
|
|
||||||
my $password = delete $ARGS->{passwd1} || '';
|
my $password = delete $ARGS->{passwd1} || '';
|
||||||
validate_password($password, delete $ARGS->{passwd2} || '');
|
Bugzilla::User::validate_password($password, delete $ARGS->{passwd2} || '');
|
||||||
|
|
||||||
my $otheruser = Bugzilla::User->create({
|
my $otheruser = Bugzilla::User->create({
|
||||||
login_name => $login_name,
|
login_name => $login_name,
|
||||||
|
|
|
@ -100,7 +100,7 @@ sub SaveAccount
|
||||||
if ($pwd1 ne "" || $pwd2 ne "")
|
if ($pwd1 ne "" || $pwd2 ne "")
|
||||||
{
|
{
|
||||||
$pwd1 || ThrowUserError("new_password_missing");
|
$pwd1 || ThrowUserError("new_password_missing");
|
||||||
validate_password($pwd1, $pwd2);
|
Bugzilla::User::validate_password($pwd1, $pwd2);
|
||||||
|
|
||||||
if ($oldpassword ne $pwd1)
|
if ($oldpassword ne $pwd1)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ sub SaveAccount
|
||||||
# Before changing an email address, confirm one does not exist.
|
# Before changing an email address, confirm one does not exist.
|
||||||
validate_email_syntax($new_login_name)
|
validate_email_syntax($new_login_name)
|
||||||
|| ThrowUserError('illegal_email_address', { addr => $new_login_name });
|
|| ThrowUserError('illegal_email_address', { addr => $new_login_name });
|
||||||
is_available_username($new_login_name)
|
Bugzilla::User::is_available_username($new_login_name)
|
||||||
|| ThrowUserError("account_exists", { email => $new_login_name });
|
|| ThrowUserError("account_exists", { email => $new_login_name });
|
||||||
|
|
||||||
Bugzilla::Token::IssueEmailChangeToken($user, $old_login_name, $new_login_name);
|
Bugzilla::Token::IssueEmailChangeToken($user, $old_login_name, $new_login_name);
|
||||||
|
@ -321,13 +321,13 @@ sub SaveEmail
|
||||||
|
|
||||||
# New watched users
|
# New watched users
|
||||||
push @$add_wdwr,
|
push @$add_wdwr,
|
||||||
map { [ login_to_id(trim($_), THROW_ERROR), $userid ] }
|
map { [ Bugzilla::User::login_to_id(trim($_), THROW_ERROR), $userid ] }
|
||||||
split /[,\s]+/,
|
split /[,\s]+/,
|
||||||
join(',', $ARGS->{new_watchedusers}) || '';
|
join(',', $ARGS->{new_watchedusers}) || '';
|
||||||
|
|
||||||
# New watchers
|
# New watchers
|
||||||
push @$add_wdwr,
|
push @$add_wdwr,
|
||||||
map { [ $userid, login_to_id(trim($_), THROW_ERROR) ] }
|
map { [ $userid, Bugzilla::User::login_to_id(trim($_), THROW_ERROR) ] }
|
||||||
split /[,\s]+/,
|
split /[,\s]+/,
|
||||||
join(',', $ARGS->{new_watchers}) || '';
|
join(',', $ARGS->{new_watchers}) || '';
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ sub SaveEmail
|
||||||
{
|
{
|
||||||
# User wants to remove selected watched users
|
# User wants to remove selected watched users
|
||||||
push @$del_wdwr,
|
push @$del_wdwr,
|
||||||
map { [ login_to_id(trim($_), THROW_ERROR), $userid ] }
|
map { [ Bugzilla::User::login_to_id(trim($_), THROW_ERROR), $userid ] }
|
||||||
$ARGS->{watched_by_you};
|
$ARGS->{watched_by_you};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ sub SaveEmail
|
||||||
{
|
{
|
||||||
# User wants to remove selected watchers
|
# User wants to remove selected watchers
|
||||||
push @$del_wdwr,
|
push @$del_wdwr,
|
||||||
map { [ $userid, login_to_id(trim($_), THROW_ERROR) ] }
|
map { [ $userid, Bugzilla::User::login_to_id(trim($_), THROW_ERROR) ] }
|
||||||
$ARGS->{watchers};
|
$ARGS->{watchers};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue