summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-07-02 11:16:08 +0200
committermkanat%bugzilla.org <>2007-07-02 11:16:08 +0200
commitee2eb7de3865e97dd48030da6cf48606d95fe152 (patch)
treeb087e005958df93921c69bbf27aedaed2236c478 /Bugzilla/User.pm
parentf32106f83ffc2dda1420123744881f0e740aa715 (diff)
downloadbugzilla-ee2eb7de3865e97dd48030da6cf48606d95fe152.tar.gz
bugzilla-ee2eb7de3865e97dd48030da6cf48606d95fe152.tar.xz
Bug 384651: Make CC adding and removal use Bugzilla::Bug in process_bug
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm13
1 files changed, 13 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index a14549f84..f13b94fbf 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -131,6 +131,14 @@ sub new {
return $class->SUPER::new(@_);
}
+sub check {
+ my ($username) = @_;
+ $username = trim($username);
+ my $user = new Bugzilla::User({ name => $username })
+ || ThrowUserError('invalid_username', { name => $username });
+ return $user;
+}
+
sub update {
my $self = shift;
my $changes = $self->SUPER::update(@_);
@@ -2072,6 +2080,11 @@ Params: login_name - B<Required> The login name for the new user.
disable_mail - If 1, bug-related mail will not be sent to this user;
if 0, mail will be sent depending on the user's email preferences.
+=item C<check>
+
+Takes a username as its only argument. Throws an error if there is no
+user with that username. Returns a C<Bugzilla::User> object.
+
=item C<is_available_username>
Returns a boolean indicating whether or not the supplied username is