Re-order
This commit is contained in:
parent
c00110ed01
commit
35de9fd3e8
|
@ -9,7 +9,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
PE_MALFORMEDUSER
|
||||
);
|
||||
|
||||
our $VERSION = '2.0.6';
|
||||
our $VERSION = '2.0.7';
|
||||
|
||||
extends qw(
|
||||
Lemonldap::NG::Portal::Main::Plugin
|
||||
|
@ -60,6 +60,65 @@ sub init {
|
|||
}
|
||||
|
||||
# RUNNING METHOD
|
||||
sub display {
|
||||
my ( $self, $req ) = @_;
|
||||
my ( $attrs, $array_attrs ) = ( {}, [] );
|
||||
|
||||
$self->logger->debug("Display current session data...");
|
||||
$self->userLogger->info("Using spoofed SSO groups if exist")
|
||||
if ( $self->conf->{impersonationRule} );
|
||||
$attrs = $req->userData;
|
||||
|
||||
# Create an array of hashes for template loop
|
||||
$self->logger->debug("Delete hidden or empty attributes");
|
||||
if ( $self->conf->{checkUserDisplayEmptyValues} ) {
|
||||
foreach my $k ( sort keys %$attrs ) {
|
||||
|
||||
# Ignore hidden attributes
|
||||
push @$array_attrs, { key => $k, value => $attrs->{$k} }
|
||||
unless ( $self->hAttr =~ /\b$k\b/ );
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach my $k ( sort keys %$attrs ) {
|
||||
|
||||
# Ignore hidden attributes and empty values
|
||||
push @$array_attrs, { key => $k, value => $attrs->{$k} }
|
||||
unless ( $self->hAttr =~ /\b$k\b/ or !$attrs->{$k} );
|
||||
}
|
||||
}
|
||||
|
||||
# ARRAY_REF = [ A_REF GROUPS, A_REF MACROS, A_REF OTHERS ]
|
||||
$array_attrs = $self->_splitAttributes($array_attrs);
|
||||
|
||||
# Display form
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
MSG => (
|
||||
$self->{conf}->{impersonationMergeSSOgroups} ? 'checkUserMerged'
|
||||
: 'checkUser'
|
||||
),
|
||||
ALERTE => (
|
||||
$self->{conf}->{impersonationMergeSSOgroups} ? 'alert-warning'
|
||||
: 'alert-info'
|
||||
),
|
||||
LOGIN => $req->{userData}->{ $self->conf->{whatToTrace} },
|
||||
ATTRIBUTES => $array_attrs->[2],
|
||||
MACROS => $array_attrs->[1],
|
||||
GROUPS => $array_attrs->[0],
|
||||
TOKEN => (
|
||||
$self->ottRule->( $req, {} ) ? $self->ott->createToken()
|
||||
: ''
|
||||
)
|
||||
};
|
||||
return $self->sendJSONresponse( $req, $params ) if ( $req->wantJSON );
|
||||
|
||||
# Display form
|
||||
return $self->p->sendHtml( $req, 'checkuser', params => $params, );
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ( $self, $req ) = @_;
|
||||
|
@ -276,65 +335,7 @@ sub check {
|
|||
return $self->p->sendJSONresponse( $req, $params ) if ( $req->wantJSON );
|
||||
|
||||
# Display form
|
||||
return $self->p->sendHtml( $req, 'checkuser', params => $params, );
|
||||
}
|
||||
|
||||
sub display {
|
||||
my ( $self, $req ) = @_;
|
||||
my ( $attrs, $array_attrs ) = ( {}, [] );
|
||||
|
||||
$self->logger->debug("Display current session data...");
|
||||
$self->userLogger->info("Using spoofed SSO groups if exist")
|
||||
if ( $self->conf->{impersonationRule} );
|
||||
$attrs = $req->userData;
|
||||
|
||||
# Create an array of hashes for template loop
|
||||
$self->logger->debug("Delete hidden or empty attributes");
|
||||
if ( $self->conf->{checkUserDisplayEmptyValues} ) {
|
||||
foreach my $k ( sort keys %$attrs ) {
|
||||
|
||||
# Ignore hidden attributes
|
||||
push @$array_attrs, { key => $k, value => $attrs->{$k} }
|
||||
unless ( $self->hAttr =~ /\b$k\b/ );
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach my $k ( sort keys %$attrs ) {
|
||||
|
||||
# Ignore hidden attributes and empty values
|
||||
push @$array_attrs, { key => $k, value => $attrs->{$k} }
|
||||
unless ( $self->hAttr =~ /\b$k\b/ or !$attrs->{$k} );
|
||||
}
|
||||
}
|
||||
|
||||
# ARRAY_REF = [ A_REF GROUPS, A_REF MACROS, A_REF OTHERS ]
|
||||
$array_attrs = $self->_splitAttributes($array_attrs);
|
||||
|
||||
# Display form
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
MSG => (
|
||||
$self->{conf}->{impersonationMergeSSOgroups} ? 'checkUserMerged'
|
||||
: 'checkUser'
|
||||
),
|
||||
ALERTE => (
|
||||
$self->{conf}->{impersonationMergeSSOgroups} ? 'alert-warning'
|
||||
: 'alert-info'
|
||||
),
|
||||
LOGIN => $req->{userData}->{ $self->conf->{whatToTrace} },
|
||||
ATTRIBUTES => $array_attrs->[2],
|
||||
MACROS => $array_attrs->[1],
|
||||
GROUPS => $array_attrs->[0],
|
||||
TOKEN => (
|
||||
$self->ottRule->( $req, {} ) ? $self->ott->createToken()
|
||||
: ''
|
||||
)
|
||||
};
|
||||
return $self->sendJSONresponse( $req, $params ) if ( $req->wantJSON );
|
||||
return $self->p->sendHtml( $req, 'checkuser', params => $params, );
|
||||
return $self->p->sendHtml( $req, 'checkuser', params => $params );
|
||||
}
|
||||
|
||||
sub _urlFormat {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<TMPL_IF NAME="SPOOFID">
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-user icon-blue"></i> </span>
|
||||
</div>
|
||||
<input name="spoofId" type="text" class="form-control" trplaceholder="spoofId" aria-required="false"/>
|
||||
</div>
|
||||
<input name="spoofId" type="text" class="form-control" trplaceholder="spoofId" aria-required="false"/>
|
||||
</div>
|
||||
</TMPL_IF>
|
Loading…
Reference in New Issue
Block a user