Manage exported variables for DBI (#636)
This commit is contained in:
parent
cb6df779be
commit
cb67ac1e61
|
@ -155,6 +155,13 @@ has 'dbiAuthnLevel' => (
|
|||
documentation => 'DBI authentication level',
|
||||
);
|
||||
|
||||
has 'dbiExportedVars' => (
|
||||
is => 'rw',
|
||||
isa => 'HashRef',
|
||||
default => sub { return {}; },
|
||||
documentation => 'DBI exported variables',
|
||||
);
|
||||
|
||||
has 'demoExportedVars' => (
|
||||
is => 'rw',
|
||||
isa => 'HashRef',
|
||||
|
|
|
@ -106,6 +106,7 @@ sub unserialize {
|
|||
|authChoiceModules
|
||||
|CAS_proxiedServices
|
||||
|casStorageOptions
|
||||
|dbiExportedVars
|
||||
|demoExportedVars
|
||||
|exportedHeaders
|
||||
|exportedVars
|
||||
|
|
|
@ -608,10 +608,15 @@ sub struct {
|
|||
# DBI
|
||||
dbiParams => {
|
||||
_nodes => [
|
||||
qw(dbiAuthnLevel n:dbiConnection n:dbiSchema n:dbiPassword)
|
||||
qw(dbiAuthnLevel cn:dbiExportedVars n:dbiConnection n:dbiSchema n:dbiPassword)
|
||||
],
|
||||
_help => 'authDBI',
|
||||
dbiAuthnLevel => 'int:/dbiAuthnLevel:authDBILevel:int',
|
||||
dbiExportedVars => {
|
||||
_nodes => ['hash:/dbiExportedVars:vars:btext'],
|
||||
_js => 'hashRoot',
|
||||
_help => 'authDBI',
|
||||
},
|
||||
dbiConnection => {
|
||||
_nodes => [qw(n:dbiConnectionAuth n:dbiConnectionUser)],
|
||||
dbiConnectionAuth => {
|
||||
|
|
|
@ -95,6 +95,7 @@ sub en {
|
|||
dbiConnection => 'Connection',
|
||||
dbiConnectionAuth => 'Authentication process',
|
||||
dbiConnectionUser => 'User process',
|
||||
dbiExportedVars => 'Exported variables',
|
||||
dbiParams => 'DBI parameters',
|
||||
dbiPassword => 'Password',
|
||||
dbiPasswordMailCol => 'Mail field name',
|
||||
|
@ -577,6 +578,7 @@ sub fr {
|
|||
dbiConnection => 'Connexion',
|
||||
dbiConnectionAuth => 'Authentification',
|
||||
dbiConnectionUser => 'Utilisateurs',
|
||||
dbiExportedVars => 'Variables exportées',
|
||||
dbiParams => 'Paramètres DBI',
|
||||
dbiPassword => 'Mot de passe',
|
||||
dbiPasswordMailCol => 'Champ mail',
|
||||
|
|
|
@ -9,7 +9,7 @@ use strict;
|
|||
use Lemonldap::NG::Portal::Simple;
|
||||
use Lemonldap::NG::Portal::_DBI; #inherits
|
||||
|
||||
our $VERSION = '1.2.3';
|
||||
our $VERSION = '1.4.0';
|
||||
|
||||
## @apmethod int userDBInit()
|
||||
# Set default values
|
||||
|
@ -102,16 +102,16 @@ sub setSessionInfo {
|
|||
# Set _user unless already defined
|
||||
$self->{sessionInfo}->{_user} ||= $self->{user};
|
||||
|
||||
# Return if no data to collect
|
||||
return PE_OK
|
||||
unless ( $self->{exportedVars}
|
||||
and ref( $self->{exportedVars} ) eq 'HASH' );
|
||||
|
||||
while ( my ( $var, $attr ) = each %{ $self->{exportedVars} } ) {
|
||||
$self->{sessionInfo}->{$var} = $self->{entry}->{$attr}
|
||||
if ( defined $self->{entry}->{$attr} );
|
||||
}
|
||||
|
||||
while ( my ( $var, $attr ) = each %{ $self->{dbiExportedVars} } ) {
|
||||
$self->{sessionInfo}->{$var} = $self->{entry}->{$attr}
|
||||
if ( defined $self->{entry}->{$attr} );
|
||||
}
|
||||
|
||||
PE_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user