From 67c8df09ad8b01c16dd79624c1777bbc2f8e112a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Tue, 13 Jul 2021 14:58:03 +0200 Subject: [PATCH] Possibility to exclude attributes in sessions conversion --- lemonldap-ng-common/scripts/convertSessions | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lemonldap-ng-common/scripts/convertSessions b/lemonldap-ng-common/scripts/convertSessions index b5991ee30..66e1465a4 100755 --- a/lemonldap-ng-common/scripts/convertSessions +++ b/lemonldap-ng-common/scripts/convertSessions @@ -23,11 +23,13 @@ our $VERSION = "2.0.12"; # -c: configuration file # -r: rename attributes # -i: ignore errors +# -x: exclude attributes my $debug; my $config_file; my $ignore_errors; my %rename; +my @exclude; my $help; my $nb_converted = 0; my $nb_error = 0; @@ -38,6 +40,7 @@ GetOptions( 'config|c=s' => \$config_file, 'ignore-errors|i' => \$ignore_errors, 'rename|r=s' => \%rename, + 'exclude|x=s' => \@exclude, ) or pod2usage(2); pod2usage( -exitval => 1, @@ -133,6 +136,16 @@ Lemonldap::NG::Common::Apache::Session->get_key_from_all_sessions( } } + if (@exclude) { + for my $excludekey (@exclude) { + if ( $entry->{$excludekey} ) { + print "Exclude $excludekey in session $id\n" + if $debug; + delete $entry->{$excludekey}; + } + } + } + print "Processing session $id\n" if $debug; my $s = Lemonldap::NG::Common::Session->new( { storageModule => $backendTo->{backend},