sub new {
$main::lxdebug->enter_sub();
- my $type = shift;
- my $self = {};
+ my ($type, %params) = @_;
+ my $self = bless {}, $type;
- bless $self, $type;
-
- $self->_read_auth_config();
+ $self->_read_auth_config(%params);
$self->reset;
$main::lxdebug->leave_sub();
sub reset {
my ($self, %params) = @_;
+ delete $self->{dbh};
$self->{SESSION} = { };
$self->{FULL_RIGHTS} = { };
$self->{RIGHTS} = { };
sub _read_auth_config {
$main::lxdebug->enter_sub();
- my $self = shift;
+ my ($self, %params) = @_;
map { $self->{$_} = $::lx_office_conf{authentication}->{$_} } keys %{ $::lx_office_conf{authentication} };
# Prevent password leakage to log files when dumping Auth instances.
$self->{admin_password} = sub { $::lx_office_conf{authentication}->{admin_password} };
- $self->{DB_config} = $::lx_office_conf{'authentication/database'};
- $self->{LDAP_config} = $::lx_office_conf{'authentication/ldap'};
+ if ($params{unit_tests_database}) {
+ $self->{DB_config} = $::lx_office_conf{'testing/database'};
+ $self->{module} = 'DB';
+
+ } else {
+ $self->{DB_config} = $::lx_office_conf{'authentication/database'};
+ $self->{LDAP_config} = $::lx_office_conf{'authentication/ldap'};
+ }
if ($self->{module} eq 'DB') {
$self->{authenticator} = SL::Auth::DB->new($self);
["customer_vendor_edit", $locale->text("Create customers and vendors. Edit all vendors. Edit only customers where salesman equals employee (login)")],
["customer_vendor_all_edit", $locale->text("Create customers and vendors. Edit all vendors. Edit all customers")],
["part_service_assembly_edit", $locale->text("Create and edit parts, services, assemblies")],
+ ["part_service_assembly_details", $locale->text("Show details and reports of parts, services, assemblies")],
["project_edit", $locale->text("Create and edit projects")],
["--ar", $locale->text("AR")],
["sales_quotation_edit", $locale->text("Create and edit sales quotations")],
["advance_turnover_tax_return", $locale->text('Advance turnover tax return')],
["--batch_printing", $locale->text("Batch Printing")],
["batch_printing", $locale->text("Batch Printing")],
+ ["--configuration", $locale->text("Configuration")],
+ ["config", $locale->text("Change kivitendo installation settings (most entries in the 'System' menu)")],
+ ["admin", $locale->text("Client administration: configuration, editing templates, task server control, background jobs (remaining entries in the 'System' menu)")],
["--others", $locale->text("Others")],
["email_bcc", $locale->text("May set the BCC field when sending emails")],
- ["config", $locale->text("Change kivitendo installation settings (all menu entries beneath 'System')")],
- ["admin", $locale->text("Administration (Used to access instance administration from user logins)")],
["productivity", $locale->text("Productivity")],
["display_admin_link", $locale->text("Show administration link")],
);