Revision 94d3a3e9
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Auth.pm | ||
---|---|---|
34 | 34 |
sub new { |
35 | 35 |
$main::lxdebug->enter_sub(); |
36 | 36 |
|
37 |
my $type = shift;
|
|
38 |
my $self = {};
|
|
37 |
my ($type, %params) = @_;
|
|
38 |
my $self = bless {}, $type;
|
|
39 | 39 |
|
40 |
bless $self, $type; |
|
41 |
|
|
42 |
$self->_read_auth_config(); |
|
40 |
$self->_read_auth_config(%params); |
|
43 | 41 |
$self->reset; |
44 | 42 |
|
45 | 43 |
$main::lxdebug->leave_sub(); |
... | ... | |
50 | 48 |
sub reset { |
51 | 49 |
my ($self, %params) = @_; |
52 | 50 |
|
51 |
delete $self->{dbh}; |
|
53 | 52 |
$self->{SESSION} = { }; |
54 | 53 |
$self->{FULL_RIGHTS} = { }; |
55 | 54 |
$self->{RIGHTS} = { }; |
... | ... | |
100 | 99 |
sub _read_auth_config { |
101 | 100 |
$main::lxdebug->enter_sub(); |
102 | 101 |
|
103 |
my $self = shift;
|
|
102 |
my ($self, %params) = @_;
|
|
104 | 103 |
|
105 | 104 |
map { $self->{$_} = $::lx_office_conf{authentication}->{$_} } keys %{ $::lx_office_conf{authentication} }; |
106 | 105 |
|
107 | 106 |
# Prevent password leakage to log files when dumping Auth instances. |
108 | 107 |
$self->{admin_password} = sub { $::lx_office_conf{authentication}->{admin_password} }; |
109 | 108 |
|
110 |
$self->{DB_config} = $::lx_office_conf{'authentication/database'}; |
|
111 |
$self->{LDAP_config} = $::lx_office_conf{'authentication/ldap'}; |
|
109 |
if ($params{unit_tests_database}) { |
|
110 |
$self->{DB_config} = $::lx_office_conf{'testing/database'}; |
|
111 |
$self->{module} = 'DB'; |
|
112 |
|
|
113 |
} else { |
|
114 |
$self->{DB_config} = $::lx_office_conf{'authentication/database'}; |
|
115 |
$self->{LDAP_config} = $::lx_office_conf{'authentication/ldap'}; |
|
116 |
} |
|
112 | 117 |
|
113 | 118 |
if ($self->{module} eq 'DB') { |
114 | 119 |
$self->{authenticator} = SL::Auth::DB->new($self); |
config/kivitendo.conf.default | ||
---|---|---|
209 | 209 |
log_file = /tmp/kivitendo_console_debug.log |
210 | 210 |
|
211 | 211 |
[testing] |
212 |
# Automatic login will only work if both "client" and "login" are |
|
213 |
# given. "client" can be a client's database ID or its name. "login" |
|
214 |
# is simply a user's login name. |
|
215 |
client = |
|
216 |
login = |
|
212 |
|
|
213 |
# Several tests need a database they can alter data in freely. This |
|
214 |
# database will be dropped & created before any other test is run. The |
|
215 |
# following parameters must be given: |
|
216 |
[testing/database] |
|
217 |
host = localhost |
|
218 |
port = 5432 |
|
219 |
db = |
|
220 |
user = postgres |
|
221 |
password = |
|
222 |
template = template1 |
|
217 | 223 |
|
218 | 224 |
[devel] |
219 | 225 |
# Several settings related to the development of kivitendo. |
Auch abrufbar als: Unified diff
Auth: Support für Verbindung zur Unit-Test-Datenbank