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
1
3
import structlog
2
4
3
5
from conditional .util .ldap import ldap_is_eval_director
6
+ from conditional .util .ldap import ldap_is_rtp
4
7
from conditional .util .ldap import ldap_get_housing_points
5
8
from conditional .util .ldap import ldap_get_active_members
6
9
from conditional .util .ldap import ldap_get_intro_members
14
17
logger = structlog .get_logger ()
15
18
cache_bp = Blueprint ('cache_bp' , __name__ )
16
19
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
+
17
31
18
32
@cache_bp .route ('/clearcache' )
19
33
def clear_cache ():
Original file line number Diff line number Diff line change @@ -201,6 +201,10 @@ def ldap_is_eboard(username):
201
201
return _ldap_is_member_of_group (username , 'eboard' )
202
202
203
203
204
+ def ldap_is_rtp (username ):
205
+ return _ldap_is_member_of_group (username , 'rtp' )
206
+
207
+
204
208
def ldap_is_intromember (username ):
205
209
return _ldap_is_member_of_group (username , 'intromembers' )
206
210
You can’t perform that action at this time.
0 commit comments