summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-04-12 01:33:24 +0200
committerlpsolit%gmail.com <>2009-04-12 01:33:24 +0200
commita589e55a6f061ffbc223ccc99be1ff6052cf41bf (patch)
tree54aab3828565605b0fe1fbd97a5249fa5ac12b4a /Bugzilla/User.pm
parent0e4b2ce5a8e14a95d0eac6776731bcb37fec2741 (diff)
downloadbugzilla-a589e55a6f061ffbc223ccc99be1ff6052cf41bf.tar.gz
bugzilla-a589e55a6f061ffbc223ccc99be1ff6052cf41bf.tar.xz
Bug 487769: checksetup.pl can no longer create versions in TestProduct due to insufficient privileges (checksetup.pl fails) - Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r/a=LpSolit
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm27
1 files changed, 26 insertions, 1 deletions
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<super_user>
+
+Returns a user who is in all groups, but who does not really exist in the
+database. Used for non-web scripts like L<checksetup> that need to make
+database changes and so on.
+
+=back
+
=head2 Saved and Shared Queries
=over