-
Notifications
You must be signed in to change notification settings - Fork 3
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 #19 from MaastrichtUniversity/hotfix/DHS-1329
Added rule for getting a user's e-mail AVU [DHS-1329]
- Loading branch information
Showing
1 changed file
with
34 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,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 |