Last active
December 21, 2015 21:55
-
-
Save dmohs/e35c68a98903902e7429 to your computer and use it in GitHub Desktop.
Login Pseudocode
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
function onLogin(user) { | |
if (user.nihAccountLink.isActive) { | |
if (user.nihAccountLink.lastLogin < _24HoursAgo && user.nihAccountLink.expireTime > _24HoursFromNow) { | |
user.nihAccountLink.expireTime = _24HoursFromNow; | |
} | |
} | |
} | |
function onNihAccountLinkSuccess(user) { | |
user.nihAccountLink.lastLogin = now; | |
user.nihAccountLink.expireTime = _30DaysFromNow; | |
if (exists(user.nihAccountLink.username, dbgapAuthorizedWhitelist)) { | |
addUserToDbgapAuthorizedGroupIfNotExists(user.firecloudUsername); | |
} else { | |
removeUserFromDbgapAuthorizedGroupIfExists(user.firecloudUsername); | |
} | |
} | |
function onPeriodicTick() { | |
// (runs at least once per day) | |
for (user in getAllDbgapAuthorizedUsers()) { | |
if (user.nihAccountLink.expireTime >= now) { | |
removeUserFromDbgapAuthorizedGroupIfExists(user.firecloudUsername); | |
} | |
} | |
} | |
function onNewWhitelist() { | |
for (user in getAllDbgapAuthorizedUsers()) { | |
if (!exists(user.nihAccountLink.username, dbgapAuthorizedWhitelist)) { | |
removeUserFromDbgapAuthorizedGroupIfExists(user.firecloudUsername); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment