File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ import os
2+ import signal
13import structlog
24
35from conditional .util .ldap import ldap_is_eval_director
6+ from conditional .util .ldap import ldap_is_rtp
47from conditional .util .ldap import ldap_get_housing_points
58from conditional .util .ldap import ldap_get_active_members
69from conditional .util .ldap import ldap_get_intro_members
1417logger = structlog .get_logger ()
1518cache_bp = Blueprint ('cache_bp' , __name__ )
1619
20+ @cache_bp .route ('/restart' )
21+ def restart_app ():
22+ user_name = request .headers .get ('x-webauth-user' )
23+
24+ if not ldap_is_rtp (user_name ):
25+ return redirect ("/dashboard" )
26+
27+ logger .info ('api' , action = 'restart conditional' )
28+ os .kill (os .getpid (), signal .SIGINT )
29+ return "application restarted" , 200
30+
1731
1832@cache_bp .route ('/clearcache' )
1933def clear_cache ():
Original file line number Diff line number Diff line change @@ -201,6 +201,10 @@ def ldap_is_eboard(username):
201201 return _ldap_is_member_of_group (username , 'eboard' )
202202
203203
204+ def ldap_is_rtp (username ):
205+ return _ldap_is_member_of_group (username , 'rtp' )
206+
207+
204208def ldap_is_intromember (username ):
205209 return _ldap_is_member_of_group (username , 'intromembers' )
206210
You can’t perform that action at this time.
0 commit comments