Commit 09e3771f authored by Mathis Dedial's avatar Mathis Dedial
Browse files

Add before_request hook to ease development without LDAP working

parent 621bf165
......@@ -3,4 +3,5 @@ node_modules/
\ No newline at end of file
......@@ -13,4 +13,15 @@ ldap = LDAP(app)
# Bind SQLAlchemy to Flask app
def set_ldap_test_user():
Set fake LDAP user on g.user for when LDAP is not available
Enabled only if LDAP_TEST_USER is set and flask_simpleldap is not working
ldap_test_user = app.config.get('LDAP_TEST_USER')
if ldap_test_user and not hasattr(g, 'user'):
g.user = ldap_test_user
from app import views
......@@ -16,3 +16,4 @@ SQLALCHEMY_TRACK_MODIFICATIONS = False
LDAP_BASE_DN = 'OU=users,dc=example,dc=org'
LDAP_USERNAME = 'CN=user,OU=Users,DC=example,DC=org'
LDAP_PASSWORD = 'notarealpassword'
LDAP_TEST_USER = 'amivtestuser'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment