summaryrefslogtreecommitdiff
path: root/rt/lib/RT/CurrentUser.pm
diff options
context:
space:
mode:
authorivan <ivan>2004-03-11 02:05:38 +0000
committerivan <ivan>2004-03-11 02:05:38 +0000
commit289340780927b5bac2c7604d7317c3063c6dd8cc (patch)
treec4100ab9857ae00c330213af8a46e66c208580e6 /rt/lib/RT/CurrentUser.pm
parent945721f48f74d5cfffef7c7cf3a3d6bc2521f5dd (diff)
import of rt 3.0.9RT_3_0_9
Diffstat (limited to 'rt/lib/RT/CurrentUser.pm')
-rwxr-xr-xrt/lib/RT/CurrentUser.pm34
1 files changed, 27 insertions, 7 deletions
diff --git a/rt/lib/RT/CurrentUser.pm b/rt/lib/RT/CurrentUser.pm
index 4ca2f9891..7fcc65ce3 100755
--- a/rt/lib/RT/CurrentUser.pm
+++ b/rt/lib/RT/CurrentUser.pm
@@ -70,7 +70,7 @@ sub _Init {
$self->Load($Name);
}
- $self->CurrentUser($self);
+ # $self->CurrentUser($self);
}
# }}}
@@ -104,15 +104,13 @@ sub Delete {
sub UserObj {
my $self = shift;
- unless ($self->{'UserObj'}) {
use RT::User;
- $self->{'UserObj'} = RT::User->new($self);
- unless ($self->{'UserObj'}->Load($self->Id)) {
+ my $user = RT::User->new($self);
+
+ unless ($user->Load($self->Id)) {
$RT::Logger->err($self->loc("Couldn't load [_1] from the users database.\n", $self->Id));
}
-
- }
- return ($self->{'UserObj'});
+ return ($user);
}
# }}}
@@ -160,6 +158,7 @@ sub _Accessible {
Gecos => 'read',
RealName => 'read',
Password => 'neither',
+ Lang => 'read',
EmailAddress => 'read',
Privileged => 'read',
IsAdministrator => 'read'
@@ -241,6 +240,11 @@ sub Load {
if ($identifier !~ /\D/) {
$self->SUPER::LoadById($identifier);
}
+
+ elsif (UNIVERSAL::isa($identifier,"RT::User")) {
+ # DWIM if they pass a user in
+ $self->SUPER::LoadById($identifier->Id);
+ }
else {
# This is a bit dangerous, we might get false authen if somebody
# uses ambigous userids or real names:
@@ -329,6 +333,9 @@ sub LanguageHandle {
if ((!defined $self->{'LangHandle'}) ||
(!UNIVERSAL::can($self->{'LangHandle'}, 'maketext')) ||
(@_)) {
+ if ( $self->Lang) {
+ push @_, $self->Lang;
+ }
$self->{'LangHandle'} = RT::I18N->get_handle(@_);
}
# Fall back to english.
@@ -365,6 +372,19 @@ sub loc_fuzzy {
}
# }}}
+
+=head2 CurrentUser
+
+Return the current currentuser object
+
+=cut
+
+sub CurrentUser {
+ my $self = shift;
+ return($self);
+
+}
+
eval "require RT::CurrentUser_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/CurrentUser_Vendor.pm});
eval "require RT::CurrentUser_Local";