diff --git a/gen/user_uid_mapping b/gen/user_uid_mapping deleted file mode 100755 index 248af539..00000000 --- a/gen/user_uid_mapping +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use perunServicesInit; -use perunServicesUtils; - -local $::SERVICE_NAME = "user_uid_mapping"; -local $::PROTOCOL_VERSION = "3.0.0"; -my $SCRIPT_VERSION = "3.0.1"; - -perunServicesInit::init; -my $DIRECTORY = perunServicesInit::getDirectory; -my $data = perunServicesInit::getHashedHierarchicalData; - -#Constants -our $A_USER_LOGIN; *A_USER_LOGIN = \'urn:perun:user:attribute-def:def:login-namespace:einfra'; -our $A_UID_NAMESPACE_ICS; *A_UID_NAMESPACE_ICS = \'urn:perun:user:attribute-def:def:uid-namespace:ics'; -our $A_UID_NAMESPACE_RUK; *A_UID_NAMESPACE_RUK = \'urn:perun:user:attribute-def:def:uid-namespace:ruk'; -our $A_UID_NAMESPACE_ZCU; *A_UID_NAMESPACE_ZCU = \'urn:perun:user:attribute-def:def:uid-namespace:zcu'; - -our $UID_ICS; *UID_ICS = \0; -our $UID_RUK; *UID_RUK = \1; -our $UID_ZCU; *UID_ZCU = \2; - -our $userStruc = {}; - -foreach my $memberId ( $data->getMemberIdsForFacility() ) { - - my $login = $data->getUserAttributeValue( member => $memberId, attrName => $A_USER_LOGIN ); - - unless(exists $userStruc->{$login}) { - $userStruc->{$login} = {}; - $userStruc->{$login}->{$UID_ICS} = $data->getUserAttributeValue( member => $memberId, attrName => $A_UID_NAMESPACE_ICS ); - $userStruc->{$login}->{$UID_RUK} = $data->getUserAttributeValue( member => $memberId, attrName => $A_UID_NAMESPACE_RUK ); - $userStruc->{$login}->{$UID_ZCU} = $data->getUserAttributeValue( member => $memberId, attrName => $A_UID_NAMESPACE_ZCU ); - } -} - -my $fileName = "$DIRECTORY/$::SERVICE_NAME.csv"; -open FILE,">$fileName" or die "Cannot open $fileName: $! \n"; - -# csv header - attributes' friendly name -print FILE "login-namespace:einfra", ",", "uid-namespace:ics", ",", "uid-namespace:ruk", ",", "uid-namespace:zcu", "\n"; - -# csv content: -# login, uid:ics, uid:ruk, uid:zcu, uid:cerit -foreach my $login (sort keys %$userStruc) { - print FILE $login, ",", $userStruc->{$login}->{$UID_ICS}, ",", $userStruc->{$login}->{$UID_RUK}, ",", $userStruc->{$login}->{$UID_ZCU}, "\n"; -} - -close (FILE); -perunServicesInit::finalize;