Pass extra args in Combination module (#1903)
This commit is contained in:
parent
1660109e2f
commit
2145483be7
|
@ -5,7 +5,7 @@ use Mouse;
|
|||
use Safe;
|
||||
use constant PE_OK => 0;
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
our $VERSION = '2.0.6';
|
||||
|
||||
# Handle "if then else" (used during init)
|
||||
# return a sub that can be called with ($req) to get a [array] of combination
|
||||
|
@ -134,15 +134,15 @@ sub parseMod {
|
|||
if ( @mods == 1 ) {
|
||||
my ($m) = @mods;
|
||||
return sub {
|
||||
my ( $sub, $req ) = @_;
|
||||
return ( $m->$sub($req), $expr );
|
||||
my ( $sub, $req, %args ) = @_;
|
||||
return ( $m->$sub( $req, %args ), $expr );
|
||||
};
|
||||
}
|
||||
return sub {
|
||||
my ( $sub, $req ) = @_;
|
||||
my ( $sub, $req, %args ) = @_;
|
||||
my %str;
|
||||
for ( my $i = 0 ; $i < @list ; $i++ ) {
|
||||
my $res = $mods[$i]->$sub($req);
|
||||
my $res = $mods[$i]->$sub( $req, %args );
|
||||
|
||||
# Case "string" (form type)
|
||||
if ( $res & ~$res ) {
|
||||
|
|
|
@ -152,7 +152,8 @@ sub authForce {
|
|||
###############
|
||||
# Note that UserDB::Combination uses the same object.
|
||||
sub getUser {
|
||||
return $_[0]->try( 1, 'getUser', $_[1] );
|
||||
my ( $self, $req, %args ) = @_;
|
||||
return $self->try( 1, 'getUser', $req, %args );
|
||||
}
|
||||
|
||||
sub setSessionInfo {
|
||||
|
@ -178,7 +179,7 @@ sub getStack {
|
|||
|
||||
# Main running method: launch the next scheme if the current fails
|
||||
sub try {
|
||||
my ( $self, $type, $subname, $req ) = @_;
|
||||
my ( $self, $type, $subname, $req, %args ) = @_;
|
||||
|
||||
# Get available authentication schemes for this user if not done
|
||||
unless ( defined $req->data->{combinationStack} ) {
|
||||
|
@ -195,7 +196,7 @@ sub try {
|
|||
if ( $nb < @$stack - 1 ) {
|
||||
|
||||
# TODO: change logLevel for userLog()
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req );
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req, %args );
|
||||
|
||||
# On error, restart authentication with next scheme
|
||||
if ( $res > PE_OK ) {
|
||||
|
@ -207,7 +208,7 @@ sub try {
|
|||
}
|
||||
}
|
||||
else {
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req );
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req, %args );
|
||||
}
|
||||
$req->sessionInfo->{ [ '_auth', '_userDB' ]->[$type] } = $name;
|
||||
$req->sessionInfo->{_combinationTry} =
|
||||
|
|
Loading…
Reference in New Issue
Block a user