in gatekeeper.py [0:0]
def index():
# TODO(): implement authentication mechanism
user = "GateKeeper"
log.info("Accessed by: %s" % user)
form = OffboardForm()
user_info = None
if request.method == "POST":
user_id = form.data["USER_ID"]
try:
user_is_valid = ldap_client.is_valid_user(user_id)
if user_is_valid:
user_info = ldap_client.get_user_info(user_id)
user_info["active"] = ldap_client.is_active_user(user_id)
default_ooo_msg = ("Hello. I no longer work here. Please resend your message to %s. "
"Thank you" % (user_info["manager"]))
form.OOO_MSG_TEXT.data = default_ooo_msg
else:
flash("WARNING: %s is not a valid LDAP user." % user_id)
return redirect(url_for('index'))
except AttributeError:
flash("WARNING: %s is not a valid LDAP user." % user_id)
return redirect(url_for('index'))
return render_template("index.html",
form=form,
users=json.dumps(ldap_users),
user=user,
user_info=user_info,
ldap_fields=config["ldap"]["fields"],
google_admin_actions=GOOGLE_ADMIN_ACTIONS,
google_gmail_actions=GOOGLE_GMAIL_ACTIONS,
google_calendar_actions=GOOGLE_CALENDAR_ACTIONS,
pagerduty_actions=PAGERDUTY_ACTIONS,
duo_actions=DUO_ACTIONS)