Revision 540c0b5e
Von Moritz Bunkus vor mehr als 12 Jahren hinzugefügt
SL/Dispatcher/AuthHandler.pm | ||
---|---|---|
5 | 5 |
use parent qw(Rose::Object); |
6 | 6 |
|
7 | 7 |
use SL::Dispatcher::AuthHandler::Admin; |
8 |
use SL::Dispatcher::AuthHandler::None; |
|
8 | 9 |
use SL::Dispatcher::AuthHandler::User; |
9 | 10 |
|
11 |
my %valid_auth_levels = map { ($_ => 1) } qw(user admin none); |
|
12 |
|
|
10 | 13 |
sub handle { |
11 | 14 |
my ($self, %param) = @_; |
12 | 15 |
|
... | ... | |
16 | 19 |
$self->{handlers}->{$handler_name} ||= $handler_name->new; |
17 | 20 |
$self->{handlers}->{$handler_name}->handle; |
18 | 21 |
|
19 |
return $auth_level; |
|
22 |
return ( |
|
23 |
auth_level => $auth_level, |
|
24 |
keep_auth_vars => $self->get_keep_auth_vars(%param), |
|
25 |
); |
|
20 | 26 |
} |
21 | 27 |
|
22 | 28 |
sub get_auth_level { |
... | ... | |
26 | 32 |
: $param{routing_type} eq 'controller' ? "SL::Controller::$param{controller}"->get_auth_level($param{action}) |
27 | 33 |
: 'user'; |
28 | 34 |
|
29 |
return $auth_level eq 'user' ? 'user' : 'admin'; |
|
35 |
return $valid_auth_levels{$auth_level} ? $auth_level : 'user'; |
|
36 |
} |
|
37 |
|
|
38 |
sub get_keep_auth_vars { |
|
39 |
my ($self, %param) = @_; |
|
40 |
|
|
41 |
return $param{routing_type} eq 'controller' ? "SL::Controller::$param{controller}"->keep_auth_vars_in_form : 0; |
|
30 | 42 |
} |
31 | 43 |
|
32 | 44 |
1; |
Auch abrufbar als: Unified diff
User-Login auf Controller umgestellt