-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #701 from stavamichal/users_emails
feat(users_emails): new scripts for getting all users mails
- Loading branch information
Showing
7 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
use perunServicesInit; | ||
use perunServicesUtils; | ||
use File::Basename; | ||
use utf8; | ||
|
||
binmode STDOUT, ":utf8"; | ||
|
||
our $SERVICE_NAME = basename($0); | ||
our $PROTOCOL_VERSION = "3.0.0"; | ||
my $SCRIPT_VERSION = "3.0.0"; | ||
|
||
perunServicesInit::init; | ||
my $DIRECTORY = perunServicesInit::getDirectory; | ||
my $data = perunServicesInit::getHashedHierarchicalData; | ||
|
||
#Constants | ||
our $A_MEMBER_MAILS; *A_MEMBER_MAILS = \'urn:perun:member:attribute-def:virt:mails'; | ||
|
||
my $service_file_name = "$DIRECTORY/$::SERVICE_NAME"; | ||
|
||
my $emailsStruc = {}; | ||
|
||
##################################### | ||
foreach my $memberId ($data->getMemberIdsForFacility()) { | ||
my $emails = $data->getMemberAttributeValue(attrName => $A_MEMBER_MAILS, member => $memberId); | ||
foreach my $email (@$emails) { | ||
$emailsStruc->{$email} = 1; | ||
} | ||
} | ||
|
||
####### FILE WITH EMAILS ###### | ||
open SERVICE_FILE,">$service_file_name" or die "Cannot open $service_file_name: $! \n"; | ||
binmode SERVICE_FILE, ":utf8"; | ||
|
||
foreach my $email (sort keys %$emailsStruc) { | ||
print SERVICE_FILE $email . "\n"; | ||
} | ||
|
||
close(SERVICE_FILE); | ||
|
||
perunServicesInit::finalize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
SERVICE_NAME="users_emails" | ||
|
||
. generic_send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
PROTOCOL_VERSION='3.0.0' | ||
|
||
function process { | ||
DST_DIR="/tmp/" | ||
|
||
### Status codes | ||
I_CHANGED=(0 "${DST_FILE} updated") | ||
E_CANNOT_COPY=(50 'Cannot copy file ${FROM_PERUN} to ${DST_DIR}/${DST_FILE}') | ||
|
||
FROM_PERUN="${WORK_DIR}/users_emails" | ||
DST_FILE="users_emails" | ||
|
||
create_lock | ||
|
||
cp "${FROM_PERUN}" "${DST_DIR}/${DST_FILE}" | ||
|
||
if [ $? -eq 0 ]; then | ||
log_msg I_CHANGED | ||
else | ||
log_msg E_CANNOT_COPY | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
perun-slave-process-users-emails (3.1.1) stable; urgency=low | ||
|
||
* New package version for perun-slave-process-users-emails | ||
|
||
-- Michal Stava <[email protected]> Fri, 10 Jun 2022 14:34:00 +0200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
perun-slave-base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
perun-slave-base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package for perun service - users_emails |