Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Johaney-s committed Apr 11, 2022
2 parents bb4d7bf + be349ef commit 34f0cb4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 66 deletions.
5 changes: 3 additions & 2 deletions gen/ldap_it4i
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use perunServicesUtils;

our $SERVICE_NAME = "ldap_it4i";
local $::PROTOCOL_VERSION = "3.0.0";
my $SCRIPT_VERSION = "3.0.0";
my $SCRIPT_VERSION = "3.0.1";

perunServicesInit::init;
my $DIRECTORY = perunServicesInit::getDirectory;
Expand Down Expand Up @@ -136,7 +136,8 @@ for my $login (sort keys %$users) {

my $sshKeys = $users->{$login}->{$A_SSHKEYS};
if (defined $sshKeys and length $sshKeys) {
foreach my $sshKey (sort @$sshKeys) {
# make sure SSH keys are unique
foreach my $sshKey (sort keys %{{ map { $_ => 1 } @$sshKeys }}) {
print FILE "sshPublicKey: " . $sshKey . "\n";
}
}
Expand Down
53 changes: 0 additions & 53 deletions gen/user_uid_mapping

This file was deleted.

25 changes: 14 additions & 11 deletions send/ldap_it4i
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,22 @@ sub process_update() {

sub process_archive() {

# Switch User to ARCHIVED if not present in perun data and doesn't have correct status in LDAP already.
foreach my $previousUser (@previousUsers) {
unless (exists $usersMap{$previousUser->get_value('uid')}) {
$previousUser->replace(
'status' => 'ARCHIVED'
);
my $response = $previousUser->update($ldap);
unless ($response->is_error()) {
ldap_log($service_name, "Archived: " . $previousUser->dn());
$counter_archive++;
} else {
ldap_log($service_name, "NOT archived: " . $previousUser->dn() . " | " . $response->error());
ldap_log($service_name, $previousUser->ldif());
$counter_fail++;
if ('ARCHIVED' ne $previousUser->get_value('status')) {
$previousUser->replace(
'status' => 'ARCHIVED'
);
my $response = $previousUser->update($ldap);
unless ($response->is_error()) {
ldap_log($service_name, "Archived: " . $previousUser->dn());
$counter_archive++;
} else {
ldap_log($service_name, "NOT archived: " . $previousUser->dn() . " | " . $response->error());
ldap_log($service_name, $previousUser->ldif());
$counter_fail++;
}
}
}
}
Expand Down

0 comments on commit 34f0cb4

Please sign in to comment.