Commit b2620c26 authored by Xavier Guimard's avatar Xavier Guimard

s/datas/data

datas => des données
data => les données
parent 9402f9ff
......@@ -144,7 +144,7 @@ sub base {
## @method hashRef get(string id)
# @param $id Apache::Session session ID.
# @return User datas
# @return User data
sub get {
my $self = shift;
my $id = shift;
......@@ -165,7 +165,7 @@ sub get {
## @method hashRef newSession()
# Build a new Apache::Session session.
# @return User datas (just the session ID)
# @return User data (just the session ID)
sub newSession {
my $self = shift;
$self->generate unless ( $self->{data}->{_session_id} );
......@@ -200,7 +200,7 @@ sub newSession {
}
## @method boolean save()
# Save user datas if modified.
# Save user data if modified.
sub save {
my $self = shift;
return unless ( $self->{modified} );
......
......@@ -147,7 +147,7 @@ sub _soapCall {
## @method hashRef get(string id)
# @param $id Apache::Session session ID.
# @return User datas
# @return User data
sub get {
my $self = shift;
my $id = shift;
......@@ -169,7 +169,7 @@ sub get {
## @method hashRef newSession()
# Build a new Apache::Session session.
# @return User datas (just the session ID)
# @return User data (just the session ID)
sub newSession {
my $self = shift;
$self->{data} = $self->_soapCall("newSession");
......@@ -187,7 +187,7 @@ sub newSession {
}
## @method boolean save()
# Save user datas if modified.
# Save user data if modified.
sub save {
my $self = shift;
return unless ( $self->{modified} );
......
......@@ -100,18 +100,18 @@ sub getConfByNum {
# * openIdIDPList() (old OpenID)
# * applicationList()
# - root:
# root query (/confs/latest for example) is redirected to metadatas()
# root query (/confs/latest for example) is redirected to metadata()
# - other requests:
# they are managed by getKey()
# - newRSAKey() returns a new RSA key pair if /confs/newRSAKey is called in a
# POST request
# - prx() load a request and return the content (for SAML/OIDC metadatas)
# - prx() load a request and return the content (for SAML/OIDC metadata)
# 31 - Complex subnodes
# ----------------
## @method PSGI-JSON-response complexNodesRoot($req, $query, $tpl)
# Respond to root requests for virtual hosts and SAMLmetadatas
# Respond to root requests for virtual hosts and SAMLmetadata
#
#@param $req Lemonldap::NG::Common::PSGI::Request
#@param $query Configuration root key
......@@ -686,15 +686,15 @@ sub combModules {
# 33 - Root queries
# -----------
## @method PSGI-JSON-response metadatas($req)
# Respond to `/conf/:cfgNum` requests by sending configuration metadatas
## @method PSGI-JSON-response metadata($req)
# Respond to `/conf/:cfgNum` requests by sending configuration metadata
#
# NB: if `full=1` is set in the query, configuration is returned directly in
# JSON
#
#@param $req Lemonldap::NG::Common::PSGI::Request
#@return PSGI JSON response
sub metadatas {
sub metadata {
my ( $self, $req ) = @_;
if ( $req->params('full') and $req->params('full') !~ NO ) {
my $c = $self->getConfKey( $req, 'cfgNum' );
......@@ -738,13 +738,13 @@ sub metadatas {
if ( $self->can('userId') ) {
$self->userLogger->info( 'User '
. $self->userId($req)
. ' ask for configuration metadatas ('
. ' ask for configuration metadata ('
. $res->{cfgNum}
. ')' );
}
else {
$self->logger->info(
"REST request to get configuration metadatas ($res->{cfgNum})"
"REST request to get configuration metadata ($res->{cfgNum})"
);
}
return $self->sendJSONresponse( $req, $res );
......@@ -764,7 +764,7 @@ sub metadatas {
sub getKey {
my ( $self, $req, $key, $subkey ) = @_;
unless ($key) {
return $self->metadatas($req);
return $self->metadata($req);
}
$self->userLogger->info(
'User ' . $self->userId($req) . " asks for key $key" );
......
......@@ -50,8 +50,8 @@ sub _getCipher {
## @method string encrypt(string data)
# Encrypt $data and return it in Base64 format
# @param data datas to encrypt
# @return encrypted datas in Base64 format
# @param data data to encrypt
# @return encrypted data in Base64 format
sub encrypt {
my ( $self, $data ) = @_;
......@@ -73,8 +73,8 @@ sub encrypt {
## @method string decrypt(string data)
# Decrypt $data and return it
# @param data datas to decrypt in Base64 format
# @return decrypted datas
# @param data data to decrypt in Base64 format
# @return decrypted data
sub decrypt {
my ( $self, $data ) = @_;
$data =~ s/%2B/\+/ig;
......@@ -100,9 +100,9 @@ sub decrypt {
# Encrypt $data and return it in hexadecimal format
# Data must be hexadecimal and its length must be a multiple of 32
# the encrypted data have same length as the original data
# @param data datas to encrypt
# @param data data to encrypt
# @param key optional secondary key
# @return encrypted datas in hexadecimal data
# @return encrypted data in hexadecimal data
sub encryptHex {
my ( $self, $data, $key ) = @_;
return _cryptHex( $self, $data, $key, "encrypt" );
......@@ -112,9 +112,9 @@ sub encryptHex {
# Decrypt $data and return it in hexadecimal format
# Data must be hexadecimal and its length must be a multiple of 32
# the decrypted data have same length as the encrypted data
# @param data datas to decrypt
# @param data data to decrypt
# @param key optional secondary key
# @return decrypted datas in hexadecimal data
# @return decrypted data in hexadecimal data
sub decryptHex {
my ( $self, $data, $key ) = @_;
return _cryptHex( $self, $data, $key, "decrypt" );
......@@ -122,10 +122,10 @@ sub decryptHex {
## @method private string _cryptHex (string data, string key, string sub)
# Auxiliary method to share code between encrypt and decrypt
# @param data datas to decrypt
# @param data data to decrypt
# @param key secondary key
# @param sub may be "encrypt" or "decrypt"
# @return decrypted datas in hexadecimal data
# @return decrypted data in hexadecimal data
sub _cryptHex {
my ( $self, $data, $key, $sub ) = @_;
unless ( $data =~ /^([0-9a-fA-F]{2})*$/ ) {
......
......@@ -17,7 +17,7 @@ sub newNotification {
my @notifs;
$json = [$json] unless ( ref($json) eq 'ARRAY' );
foreach my $notif (@$json) {
my @datas;
my @data;
# Mandatory information
foreach (qw(date uid reference)) {
......@@ -26,10 +26,10 @@ sub newNotification {
$self->logger->error("Attribute $_ is missing");
return 0;
}
push @datas, $tmp;
push @data, $tmp;
}
push @datas, ( $notif->{condition} // '' );
push @notifs, [ @datas, $jsonString ];
push @data, ( $notif->{condition} // '' );
push @notifs, [ @data, $jsonString ];
}
my $count;
foreach (@notifs) {
......
......@@ -14,7 +14,7 @@ has parser => (
}
);
# Check XML datas and insert new notifications.
# Check XML data and insert new notifications.
# @param $xml XML string containing notification
# @return number of notifications done
sub newNotification {
......@@ -29,7 +29,7 @@ sub newNotification {
foreach
my $notif ( $xml->documentElement->getElementsByTagName('notification') )
{
my @datas = ();
my @data = ();
# Mandatory information
foreach (qw(date uid reference)) {
......@@ -38,16 +38,16 @@ sub newNotification {
$self->logger->error("Attribute $_ is missing");
return 0;
}
push @datas, $tmp;
push @data, $tmp;
}
# Other information
foreach (qw(condition)) {
my $tmp;
if ( $tmp = $notif->getAttribute($_) ) {
push @datas, $tmp;
push @data, $tmp;
}
else { push @datas, ""; }
else { push @data, ""; }
}
my $result = XML::LibXML::Document->new( $version, $encoding );
......@@ -56,7 +56,7 @@ sub newNotification {
$result->setDocumentElement($root);
$result = $result->serialize;
utf8::encode($result);
push @notifs, [ @datas, $result ];
push @notifs, [ @data, $result ];
}
my $count;
foreach (@notifs) {
......
......@@ -33,13 +33,13 @@ sub new {
$self->env->{PATH_INFO} ||= '/';
$self->{uri} = uri_unescape( $self->env->{REQUEST_URI} );
$self->{uri} =~ s|^//+|/|g;
$self->{datas} = {};
$self->{data} = {};
$self->{error} = 0;
$self->{respHeaders} = [];
return bless( $self, $_[0] );
}
sub datas { $_[0]->{datas} }
sub data { $_[0]->{data} }
sub uri { $_[0]->{uri} }
......
......@@ -20,12 +20,12 @@ sub new {
return bless { obj => $obj, func => \@func, req => $req }, $class;
}
## @method datas AUTOLOAD()
## @method data AUTOLOAD()
# Call the wanted function with the object given to the constructor.
# AUTOLOAD() is a magic method called by Perl interpreter fon non existent
# functions. Here, we use it to call the wanted function (given by $AUTOLOAD)
# if it is authorizated
# @return datas provided by the exported function
# @return data provided by the exported function
sub AUTOLOAD {
my $self = shift;
$AUTOLOAD =~ s/.*:://;
......
......@@ -162,7 +162,7 @@ sub redirectFilter {
while ( $f->read( my $buffer, 1024 ) ) {
}
$class->updateStatus( $f->r, '$class->REDIRECT',
$class->datas->{ $class->tsv->{whatToTrace} }, 'filter' );
$class->data->{ $class->tsv->{whatToTrace} }, 'filter' );
return $class->OK;
}
......
......@@ -62,9 +62,9 @@ sub new {
return $self;
}
sub datas {
sub data {
my ($self) = @_;
return $self->{datas} ||= {};
return $self->{data} ||= {};
}
1;
......@@ -169,7 +169,7 @@ sub _authAndTrace {
}
## @method hashRef user()
# @return hash of user datas
# @return hash of user data
sub user {
my ( $self, $req ) = @_;
return $req->userData
......
......@@ -94,7 +94,7 @@ sub run {
unless $class->_isAlive();
# Value to store
my $value = $class->datas->{$secureTokenAttribute};
my $value = $class->data->{$secureTokenAttribute};
# Set token
my $key = $class->_setToken( $value, $secureTokenExpiration );
......
......@@ -53,7 +53,7 @@ sub run {
# Build URL
my $zimbra_url =
$class->_buildZimbraPreAuthUrl( $req, $zimbraPreAuthKey, $zimbraUrl,
$class->datas->{$zimbraAccountKey},
$class->data->{$zimbraAccountKey},
$zimbraBy, $timeout );
# Header location
......@@ -76,7 +76,7 @@ sub _buildZimbraPreAuthUrl {
# Expiration time is calculated with _utime and timeout
my $expires =
$timeout ? ( $class->datas->{_utime} + $timeout ) * 1000 : $timeout;
$timeout ? ( $class->data->{_utime} + $timeout ) * 1000 : $timeout;
# Timestamp
my $timestamp = time() * 1000;
......
......@@ -406,7 +406,7 @@ sub postUrlInit {
{
$class->tsv->{maintenance}->{$vhost} = 1;
$class->logger->error(
"$class: Unable to build post datas: "
"$class: Unable to build post data: "
. $class->tsv->{jail}->error );
}
......@@ -552,7 +552,7 @@ sub substitute {
$expr =~ s/\$vhost\b/\$ENV{HTTP_HOST}/sg;
$expr =~ s/\$ip\b/\$ENV{REMOTE_ADDR}/sg;
# substitute vars with session datas, excepts special vars $_ and $\d+
# substitute vars with session data, excepts special vars $_ and $\d+
$expr =~ s/\$(?!ENV)([_a-zA-Z]\w*)/\$s->{$1}/sg;
$expr =~ s/\$ENV\{/\$r->{env}->\{/g;
......
......@@ -160,7 +160,7 @@ sub run {
# Store local macros
if ( keys %$session > $kc ) {
$class->logger->debug("Update local cache");
$req->datas->{session}->update( $session, { updateCache => 2 } );
$req->data->{session}->update( $session, { updateCache => 2 } );
}
# Hide Lemonldap::NG cookie
......@@ -435,16 +435,16 @@ sub retrieveSession {
# persistent connection).
# NB: timout is here the same value as current HTTP/1.1 Keep-Alive timeout
# (15 seconds)
if ( defined $class->datas->{_session_id}
and $id eq $class->datas->{_session_id}
and ( $now - $class->datasUpdate < 15 ) )
if ( defined $class->data->{_session_id}
and $id eq $class->data->{_session_id}
and ( $now - $class->dataUpdate < 15 ) )
{
$class->logger->debug("Get session $id from Handler internal cache");
return $class->datas;
return $class->data;
}
# 2. Get the session from cache or backend
my $session = $req->datas->{session} = (
my $session = $req->data->{session} = (
Lemonldap::NG::Common::Session->new(
{
storageModule => $class->tsv->{sessionStorageModule},
......@@ -459,7 +459,7 @@ sub retrieveSession {
unless ( $session->error ) {
$class->datas( $session->data );
$class->data( $session->data );
$class->logger->debug("Get session $id");
......@@ -470,12 +470,12 @@ sub retrieveSession {
$class->tsv->{timeoutActivityInterval} )
)
{
$req->datas->{session}->update( { '_lastSeen' => $now } );
$class->datas( $session->data );
$req->data->{session}->update( { '_lastSeen' => $now } );
$class->data( $session->data );
if ( $session->error ) {
$class->logger->error("Cannot update session $id");
$class->logger->error( $req->datas->{session}->error );
$class->logger->error( $req->data->{session}->error );
}
else {
$class->logger->debug("Update _lastSeen with $now");
......@@ -497,11 +497,11 @@ sub retrieveSession {
$class->logger->info("Session $id expired");
# Clean cached data
$class->datas( {} );
$class->data( {} );
return 0;
}
$class->datasUpdate($now);
$class->dataUpdate($now);
return $session->data;
}
else {
......@@ -644,13 +644,13 @@ sub localUnlog {
$class->logger->debug('Local handler logout');
if ( $id //= $class->fetchId($req) ) {
# Delete thread datas
if ( $class->datas->{_session_id}
and $id eq $class->datas->{_session_id} )
# Delete thread data
if ( $class->data->{_session_id}
and $id eq $class->data->{_session_id} )
{
$class->datas( {} );
$class->data( {} );
}
delete $req->datas->{session};
delete $req->data->{session};
# Delete local cache
if ( $class->tsv->{refLocalStorage}
......@@ -681,7 +681,7 @@ sub postOutputFilter {
}
## @rmethod protected postInputFilter(string uri)
# Replace request body with form datas defined in configuration
# Replace request body with form data defined in configuration
# @param uri URI to catch
sub postInputFilter {
my ( $class, $req, $session, $uri ) = @_;
......
......@@ -24,7 +24,7 @@ BEGIN {
};
# Current sessions properties
our $_v = { datas => {}, datasUpdate => {}, };
our $_v = { data => {}, dataUpdate => {}, };
# Thread shared accessors
foreach ( keys %$_tshv ) {
......
......@@ -92,7 +92,7 @@ Level of protection. It can be one of:
=head3 user
Returns user session datas. If empty (no protection), returns:
Returns user session data. If empty (no protection), returns:
{ _whatToTrace => 'anonymous' }
......
......@@ -99,7 +99,7 @@ Level of protection. It can be one of:
=head3 user
Returns user session datas. If empty (no protection), returns:
Returns user session data. If empty (no protection), returns:
{ _whatToTrace => 'anonymous' }
......
......@@ -58,7 +58,7 @@ sub _run {
my $res = $self->_authAndTrace( $req, 1 );
if ( $res->[0] < 300 ) {
$self->routes( $self->authRoutes );
$req->userData( $self->api->datas );
$req->userData( $self->api->data );
}
else {
# Unset headers (handler adds a Location header)
......@@ -148,12 +148,12 @@ L<Lemonldap::NG::Common::PSGI::Router>) except that:
=back
Note also that user session datas are available in $req parameter (first argument
Note also that user session data are available in $req parameter (first argument
received by REST methods):
=over
=item $req->userData() returns a hash reference containing user session datas
=item $req->userData() returns a hash reference containing user session data
=back
......
......@@ -105,7 +105,7 @@ sub run {
return $tmp;
";
# Second step, Manager/Constants.pm file will contain datas issued from
# Second step, Manager/Constants.pm file will contain data issued from
# this scan
my $ra = Regexp::Assemble->new;
......
......@@ -1468,7 +1468,7 @@ sub attributes {
test => sub { 1 },
keyTest => qr/^(?:\*\.)?$Regexp::Common::URI::RFC2396::hostname$/,
keyMsgFail => '__badHostname__',
documentation => 'Virtualhost urls/Datas to post',
documentation => 'Virtualhost urls/Data to post',
},
vhostOptions => {
......
......@@ -74,7 +74,7 @@ sub addRoutes {
##@method public PSGI-JSON-response newRSAKey($req)
# Return a hashref containing private and public keys
# The posted datas must contain a JSON object containing
# The posted data must contain a JSON object containing
# {"password":"newpassword"}
#
#@param $req Lemonldap::NG::Common::PSGI::Request object
......
......@@ -121,7 +121,7 @@ sub scanTree {
$self->_scanNodes( $self->tree ) or return 0;
# Set cfgNum to ref cfgNum (will be changed when saving), set other
# metadatas and set a value to the key if empty
# metadata and set a value to the key if empty
$self->newConf->{cfgNum} = $self->req->params('cfgNum');
$self->newConf->{cfgAuthor} =
$self->req->userData->{ $Lemonldap::NG::Handler::Main::tsv->{whatToTrace}
......
......@@ -226,7 +226,7 @@ sub tests {
backend => $conf->{globalStorage}
};
};
return ( -1, "Unable to insert datas ($@)" ) if ($@);
return ( -1, "Unable to insert data ($@)" ) if ($@);
return ( -1, "Unable to recover data stored" )
unless ( $h{a} == 1 );
eval { tied(%h)->delete; };
......
......@@ -272,12 +272,12 @@ sub newNotification {
my $dDate = strftime( "%Y-%m-%d", localtime() );
if ( $json->{date} ) {
$self->logger->debug(
"Posted datas : uid = $json->{uid} - Ref = $json->{reference} - Date = $json->{date}"
"Posted data : uid = $json->{uid} - Ref = $json->{reference} - Date = $json->{date}"
);
}
else {
$self->logger->debug(
"Posted datas : uid = $json->{uid} - Ref = $json->{reference} - Date = ???"
"Posted data : uid = $json->{uid} - Ref = $json->{reference} - Date = ???"
);
$json->{date} = $dDate;
}
......
......@@ -95,7 +95,7 @@ Main and plugin keys must be initializated during initialization. They must
be read-only during receiving requests.
The L<Lemonldap::NG::Portal::Main::Request> request has fixed keys. A plugin
that wants to store a temporary key must store it in $req->datas or use
that wants to store a temporary key must store it in C<$req-E<gt>data> or use
defined keys, but it must never create a root key. Plugin keys may have
explicit names to avoid conflicts.
......
......@@ -208,7 +208,7 @@ sub _choice {
$req,
[
sub { $res }, 'controlUrl',
'buildCookie', @{ $self->p->afterDatas },
'buildCookie', @{ $self->p->afterData },
]
);
}
......
......@@ -165,7 +165,7 @@ sub run {
# Get a challenge (from first key)
my $data = eval {
from_json( $req->datas->{crypter}->[0]->authenticationChallenge );
from_json( $req->data->{crypter}->[0]->authenticationChallenge );
};
if ($@) {
......@@ -175,7 +175,7 @@ sub run {
# Get registered keys
my @rk;
foreach ( @{ $req->datas->{crypter} } ) {
foreach ( @{ $req->data->{crypter} } ) {
my $k = push @rk,
{ keyHandle => $_->{keyHandle}, version => $data->{version} };
......@@ -183,7 +183,7 @@ sub run {
}
# Serialize datas
# Serialize data
$data = to_json(
{
challenge => $data->{challenge},
......@@ -227,7 +227,7 @@ sub run {
return $self->p->sendError( $req, "U2FAnswerError" );
}
my $crypter;
foreach ( @{ $req->datas->{crypter} } ) {
foreach ( @{ $req->data->{crypter} } ) {
$crypter = $_ if ( $_->{keyHandle} eq $data->{keyHandle} );
}
unless ($crypter) {
......@@ -374,7 +374,7 @@ sub loadUser {
unless (@crypters) {
return -1;
}
$req->datas->{crypter} = \@crypters;
$req->data->{crypter} = \@crypters;
return 1;
}
else {
......
......@@ -61,7 +61,7 @@ sub run {
# Get a challenge (from first key)
my $data = eval {
from_json( $req->datas->{crypter}->[0]->authenticationChallenge );
from_json( $req->data->{crypter}->[0]->authenticationChallenge );
};
if ($@) {
......@@ -71,7 +71,7 @@ sub run {
# Get registered keys
my @rk;
foreach ( @{ $req->datas->{crypter} } ) {
foreach ( @{ $req->data->{crypter} } ) {
my $k = push @rk,
{ keyHandle => $_->{keyHandle}, version => $data->{version} };
......@@ -79,7 +79,7 @@ sub run {
$self->ott->updateToken( $token, __ch => $data->{challenge} );
# Serialize datas
# Serialize data
$data = to_json(
{
challenge => $data->{challenge},
......@@ -137,7 +137,7 @@ sub verify {
return $self->fail($req);
}
my $crypter;