diff options
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r-- | Bugzilla/User.pm | 13 |
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 |