From a589e55a6f061ffbc223ccc99be1ff6052cf41bf Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 11 Apr 2009 23:33:24 +0000 Subject: Bug 487769: checksetup.pl can no longer create versions in TestProduct due to insufficient privileges (checksetup.pl fails) - Patch by Max Kanat-Alexander r/a=LpSolit --- Bugzilla/User.pm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'Bugzilla/User.pm') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 2a616a145..661d2f167 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -50,8 +50,9 @@ use Bugzilla::Classification; use Bugzilla::Field; use Bugzilla::Group; -use Scalar::Util qw(blessed); use DateTime::TimeZone; +use Scalar::Util qw(blessed); +use Storable qw(dclone); use base qw(Bugzilla::Object Exporter); @Bugzilla::User::EXPORT = qw(is_available_username @@ -135,6 +136,18 @@ sub new { return $class->SUPER::new(@_); } +sub super_user { + my $invocant = shift; + my $class = ref($invocant) || $invocant; + my ($param) = @_; + + my $user = dclone(DEFAULT_USER); + $user->{groups} = [Bugzilla::Group->get_all]; + $user->{bless_groups} = [Bugzilla::Group->get_all]; + bless $user, $class; + return $user; +} + sub update { my $self = shift; my $changes = $self->SUPER::update(@_); @@ -1762,6 +1775,18 @@ confirmation screen. =head1 METHODS +=head2 Constructors + +=over + +=item C + +Returns a user who is in all groups, but who does not really exist in the +database. Used for non-web scripts like L that need to make +database changes and so on. + +=back + =head2 Saved and Shared Queries =over -- cgit v1.2.3-24-g4f1b