diff --git a/config.py.example b/config.py.example index 8e2c4b74a227b6d40dc27b8aa9cf81bb4ad3b345..a9dfd82df9beedb642444a3d7f948aca7b16f954 100644 --- a/config.py.example +++ b/config.py.example @@ -25,6 +25,7 @@ SQLITE_INIT_DATA = True #LDAP_HOST = 'rumo.fsmpi.rwth-aachen.de' LDAP_PORT = 636 +LDAP_GROUPS = ['users'] #ICAL_URL = 'https://user:password@mail.fsmpi.rwth-aachen.de/SOGo/....ics' ERROR_PAGE = 'static/500.html' RWTH_IP_RANGES = ['134.130.0.0/16', '137.226.0.0/16', '134.61.0.0/16', '192.35.229.0/24', '2a00:8a60::/32'] diff --git a/server.py b/server.py index 381d3239a4fa6f13eb5397861860ce4f571aeba8..7503ead60ecf03487bb4109c9c0f9efcce56b0fe 100644 --- a/server.py +++ b/server.py @@ -502,7 +502,12 @@ def search(): return render_template('search.html', searchtext=request.args['q'], courses=courses, lectures=lectures) def check_mod(user, groups): - return user and 'fachschaft' in groups + if not user: + return False + for group in config['LDAP_GROUPS']: + if group in groups: + return True + return False @app.route('/internal/login', methods=['GET', 'POST']) def login():