diff --git a/gen/topdesk b/gen/topdesk deleted file mode 100755 index 7384ffaf..00000000 --- a/gen/topdesk +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use perunServicesInit; -use perunServicesUtils; -use open qw/:std :utf8/; - -local $::SERVICE_NAME = "topdesk"; -local $::PROTOCOL_VERSION = "3.0.0"; - -perunServicesInit::init; -my $DIRECTORY = perunServicesInit::getDirectory; -my $data = perunServicesInit::getHierarchicalData; - -#forward declaration -sub processUsers; - -#Constants -our $A_USER_LASTNAME; *A_USER_LASTNAME = \'urn:perun:user:attribute-def:core:lastName'; -our $A_USER_FIRSTNAME; *A_USER_FIRSTNAME = \'urn:perun:user:attribute-def:core:firstName'; -our $A_USER_EMAIL; *A_USER_EMAIL = \'urn:perun:user:attribute-def:def:preferredMail'; -our $A_USER_LOGIN; *A_USER_LOGIN = \'urn:perun:user:attribute-def:virt:login-namespace:elixir-persistent'; -our $A_USER_STATUS; *A_USER_STATUS = \'urn:perun:member:attribute-def:core:status'; -our $STATUS_VALID; *STATUS_VALID = \'VALID'; - - -our $userStruc = {}; - -my $fileUsers = $DIRECTORY . $::SERVICE_NAME . ".csv"; - -my @resourcesData = $data->getChildElements; -foreach my $rData (@resourcesData) { - my @membersData = $rData->getChildElements; - foreach my $mData (@membersData) { - processUsers $mData; - } -} - -# USERS: first_name last_name login e-mail eppns -open FILE_USERS,">$fileUsers" or die "Cannot open $fileUsers: $! \n"; -binmode FILE_USERS, ":utf8"; - -# Print CSV header -print FILE_USERS "Surname;First Name(s);Initials;Prefixes;Title;Gender;Language;Site;Location;Budget holder;Job Title;Employee Number;Department;Telephone;Mobile Number;Fax Number;Email;Network Login Name;Mainframe;Self Service Desk;Has Attention;Attention;Comments\n"; - -# Example of one line: -# Prochazka;Michal;MP;;;;;ELIXIR-AAI-USER;;;;;;;;;michalp@ics.muni.cz;abcd@elixir-europe.org;abcd@elixir-europe.org;abcd@elixir-europe.org;;;ELIXIR - -foreach my $login (sort keys %$userStruc) { - - if ($userStruc->{$login}->{$A_USER_LASTNAME}) { - print FILE_USERS "$userStruc->{$login}->{$A_USER_LASTNAME}"; - } - print FILE_USERS ";"; - if ($userStruc->{$login}->{$A_USER_FIRSTNAME}) { - print FILE_USERS "$userStruc->{$login}->{$A_USER_FIRSTNAME}"; - } - print FILE_USERS ";"; - if ($userStruc->{$login}->{$A_USER_LASTNAME} && $userStruc->{$login}->{$A_USER_FIRSTNAME}) { - print FILE_USERS substr($userStruc->{$login}->{$A_USER_FIRSTNAME}, 0, 1) . substr($userStruc->{$login}->{$A_USER_LASTNAME}, 0, 1); - } - print FILE_USERS ";"; - print FILE_USERS ";;;;ELIXIR-AAI-USER;;;;;;;;;"; - print FILE_USERS "$userStruc->{$login}->{$A_USER_EMAIL};"; - print FILE_USERS "$login;$login;$login;"; - print FILE_USERS ";;ELIXIR\n"; -} - -close (FILE_USERS) or die "Cannot close $fileUsers: $! \n"; - -perunServicesInit::finalize; - - -############################################################################## -# Only subs definitions down there -############################################################################## - -## creates structure for users.csv file -sub processUsers { - my ($memberData) = @_; - - my %memberAttributes = attributesToHash $memberData->getAttributes; - - if ($memberAttributes{$A_USER_STATUS} eq $STATUS_VALID) { - $userStruc->{$memberAttributes{$A_USER_LOGIN}} = \%memberAttributes; - } -} diff --git a/send/topdesk b/send/topdesk deleted file mode 100755 index 5d41dfb2..00000000 --- a/send/topdesk +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -SERVICE_NAME=topdesk - -TIMEOUT="5400" #90s * 60 sec = 1.5h -TIMEOUT_KILL="60" # 60 sec to kill after timeout - -FACILITY_NAME=$1 -DESTINATION=$2 - -SERVICE_FILES_BASE_DIR="`pwd`/../gen/spool" -SERVICE_FILES_DIR="$SERVICE_FILES_BASE_DIR/$FACILITY_NAME/$SERVICE_NAME" -# We are expecting that the file generated by topdek GEN script produces topdesk.csv file -TOPDESK_FILE=$SERVICE_FILES_DIR/${SERVICE_NAME}.csv - -# Example of the command -# curl -T '/home/perun/perun-engine/gen/spool/TOPDesk/topdesk/topdesk.csv' --basic --user username:your_local_operator_password https://trait.topdesk.net/webdav/import/elixirimport.csv - -# Define SERVICE_SPECIFIC destination type in Perun system and provide just this: -# --basic --user username:your_local_operator_password https://trait.topdesk.net/webdav/import/elixirimport.csv - -# Read user name and password from configuration if it is present ( expect string "-u user:pass" ) -[ -r /etc/perun/services/$SERVICE_NAME ] && . /etc/perun/services/$SERVICE_NAME - -TRANSPORT_COMMAND="/usr/bin/curl -T $TOPDESK_FILE $USERNAME_AND_PASSWORD $DESTINATION" - -#Just safety check. This should not happen. -if [ ! -d "$SERVICE_FILES_DIR" ]; then echo '$SERVICE_FILES_DIR: '$SERVICE_FILES_DIR' is not a directory' >&2 ; exit 1; fi - -timeout -k $TIMEOUT_KILL $TIMEOUT $TRANSPORT_COMMAND - -ERR_CODE=$? - -#Error code 124 means - timed out -if [ $ERR_CODE -eq 124 ]; then - echo "Communication with slave script has timed out with return code: $ERR_CODE (Warning: this error can mask original error 124 from slave script!)" >&2 -else - if [ $ERR_CODE -ne 0 ]; then - echo "Slave script ends with return code: $ERR_CODE" >&2 - fi -fi - -exit $ERR_CODE