Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rule for getting a user's e-mail AVU [DHS-1329] #19

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions misc/getEmailForAccount.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Call with
#
# irule -F getEmailForAccount.r "*account='mcoonen'"

irule_dummy() {
IRULE_getEmailForAccount(*account , *result);
writeLine("stdout", *result);
}

IRULE_getEmailForAccount(*account,*result) {
*userID = ""
*userEmail = ""

# Get the e-mail address given the username
foreach (*Row in SELECT META_USER_ATTR_VALUE, USER_ID WHERE USER_NAME == "*account" AND META_USER_ATTR_NAME == "email" ) {
*userEmail = *Row.META_USER_ATTR_VALUE
*userID = *Row.USER_ID
}
# If the userID is empty for this account, write rodsLog warning for missing irods account
# The value returned for this function is this the account name
if (*userID == "") {
msiWriteRodsLog("Warning: getting email address for unknown account: *account", 0);
}

# If the Display name is missing revert to the account name
if (*userEmail == "") {
*userEmail = *account
}

*result = *userEmail;
}

INPUT *account='mcoonen'
OUTPUT ruleExecOut