Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d8ac0828

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID d8ac08282dad52789b8bea785e8cddae44085483
  • Vorgänger 738fb45b
  • Nachfolger 672e9658

Admin: Teile von admin.pl in neuen Controller Admin verschoben; Mandanten anzeigen

Unterschiede anzeigen:

SL/Dispatcher.pm
59 59
  return $self->{interface} eq 'cgi' ? 'CGI' : 'FastCGI';
60 60
}
61 61

  
62
sub is_admin_request {
63
  my %params = @_;
64
  return ($params{script} eq 'admin.pl') || (($params{routing_type} eq 'controller') && ($params{script_name} eq 'Admin'));
65
}
66

  
62 67
sub pre_request_checks {
68
  my (%params) = @_;
69

  
63 70
  _check_for_old_config_files();
64 71

  
65
  if (!$::auth->session_tables_present) {
66
    if ($::form->{script} eq 'admin.pl') {
67
      ::run();
68
      ::end_of_request();
69
    } else {
70
      show_error('login_screen/auth_db_unreachable');
71
    }
72
  if (!$::auth->session_tables_present && !is_admin_request(%params)) {
73
    show_error('login_screen/auth_db_unreachable');
72 74
  }
73 75

  
74 76
  if ($::request->type !~ m/^ (?: html | js | json ) $/x) {
......
231 233
  }
232 234

  
233 235
  eval {
234
    pre_request_checks();
236
    pre_request_checks(script => $script, action => $action, routing_type => $routing_type, script_name => $script_name);
235 237

  
236
    $::form->error($::locale->text('System currently down for maintenance!')) if -e ($::lx_office_conf{paths}->{userspath} . "/nologin") && $script ne 'admin';
238
    if (   (-e ($::lx_office_conf{paths}->{userspath} . "/nologin"))
239
        && !is_admin_request(script => $script, script_name => $script_name, routing_type => $routing_type)) {
240
      $::form->error($::locale->text('System currently down for maintenance!'));
241
    }
237 242

  
238 243
    # For compatibility with a lot of database upgrade scripts etc:
239 244
    # Re-write request to old 'login.pl?action=login' to new
......
246 251
    if (($script eq 'login') && !$action) {
247 252
      print $::request->{cgi}->redirect('controller.pl?action=LoginScreen/user_login');
248 253

  
249
    } elsif ($script eq 'admin') {
250
      $::form->{titlebar} = "kivitendo " . $::locale->text('Version') . " $::form->{version}";
251
      ::run($session_result);
252

  
253 254
    } else {
254
      if (SL::Auth::SESSION_EXPIRED == $session_result) {
255
        print $::request->{cgi}->redirect('controller.pl?action=LoginScreen/user_login&error=session');
256
        ::end_of_request();
257
      }
255
      $self->redirect_to_login($script) if SL::Auth::SESSION_EXPIRED == $session_result;
258 256

  
259 257
      my %auth_result = $self->{auth_handler}->handle(
260 258
        routing_type => $routing_type,
......
320 318
  $::lxdebug->leave_sub;
321 319
}
322 320

  
321
sub redirect_to_login {
322
  my ($self, $script) = @_;
323
  my $action          = $script =~ m/^admin/i ? 'Admin/login' : 'LoginScreen/user_login&error=session';
324
  print $::request->cgi->redirect("controller.pl?action=${action}");
325
  ::end_of_request();
326
}
327

  
323 328
sub unrequire_bin_mozilla {
324 329
  my $self = shift;
325 330
  return unless $self->_interface_is_fcgi;

Auch abrufbar als: Unified diff