blob: bcd337d2c37d039a8250f18023c4c2d830c25e7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package FS::CurrentUser;
use vars qw($CurrentUser $upgrade_hack);
#not at compile-time, circular dependancey causes trouble
#use FS::Record qw(qsearchs);
#use FS::access_user;
$upgrade_hack = 0;
=head1 NAME
FS::CurrentUser - Package representing the current user
=head1 SYNOPSIS
=head1 DESCRIPTION
=cut
sub load_user {
my( $class, $user ) = @_; #, $pass
if ( $upgrade_hack ) {
return $CurrentUser = new FS::CurrentUser::BootstrapUser;
}
#return "" if $user =~ /^fs_(queue|selfservice)$/;
#not the best thing in the world...
eval "use FS::Record qw(qsearchs);";
die $@ if $@;
eval "use FS::access_user;";
die $@ if $@;
$CurrentUser = qsearchs('access_user', {
'username' => $user,
#'_password' =>
'disabled' => '',
} );
die "unknown user: $user" unless $CurrentUser; # or bad password
$CurrentUser;
}
=head1 BUGS
Creepy crawlies
=head1 SEE ALSO
=cut
package FS::CurrentUser::BootstrapUser;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless ($self, $class);
}
sub AUTOLOAD { 1 };
1;
|