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