From d9cbb0f0a62bba345ed26ac68364bb441f41d35d Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 12 May 2006 09:40:56 +0000 Subject: Bug 300410: Bugzilla::Auth needs to be restructured to not require a BEGIN block Patch By Max Kanat-Alexander r=LpSolit, a=myk --- Bugzilla/User.pm | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'Bugzilla/User.pm') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 4fb41d852..93316bdb2 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -155,17 +155,17 @@ sub disabledtext { $_[0]->{'disabledtext'}; } sub is_disabled { $_[0]->disabledtext ? 1 : 0; } sub showmybugslink { $_[0]->{showmybugslink}; } -sub set_flags { - my $self = shift; - while (my $key = shift) { - $self->{'flags'}->{$key} = shift; - } +sub set_authorizer { + my ($self, $authorizer) = @_; + $self->{authorizer} = $authorizer; } - -sub get_flag { - my $self = shift; - my $key = shift; - return $self->{'flags'}->{$key}; +sub authorizer { + my ($self) = @_; + if (!$self->{authorizer}) { + require Bugzilla::Auth; + $self->{authorizer} = new Bugzilla::Auth(); + } + return $self->{authorizer}; } # Generate a string to identify the user by name + login if the user @@ -1505,6 +1505,17 @@ which to identify the user. Currently the part of the user's email address before the at sign (@), but that could change, especially if we implement usernames not dependent on email address. +=item C + +This is the L object that the User logged in with. +If the user hasn't logged in yet, a new, empty Bugzilla::Auth() object is +returned. + +=item C + +Sets the L object to be returned by C. +Should only be called by C, for the most part. + =item C Returns an array of the user's named queries, sorted in a case-insensitive @@ -1718,21 +1729,6 @@ When called with one argument: Returns C<1> if the user can bless the group with that name, returns C<0> otherwise. -=item C -=item C - -User flags are template-accessible user status information, stored in the form -of a hash. For an example of use, when the current user is authenticated in -such a way that they are allowed to log out, the 'can_logout' flag is set to -true (1). The template then checks this flag before displaying the "Log Out" -link. - -C is called with any number of key,value pairs. Flags for each key -will be set to the specified value. - -C is called with a single key name, which returns the associated -value. - =item C Returns true if the user wants mail for a given bug change. -- cgit v1.2.3-24-g4f1b