1010from testgen .ui import bootstrap
1111from testgen .ui .assets import get_asset_path
1212from testgen .ui .components import widgets as testgen
13- from testgen .ui .services import javascript_service , user_session_service
13+ from testgen .ui .services import javascript_service
1414from testgen .ui .session import session
1515
1616
@@ -23,12 +23,14 @@ def render(log_level: int = logging.INFO):
2323 # Collapse when logging out because the sidebar takes some time to be removed from the DOM
2424 # Collapse for Catalog role since they only have access to one page
2525 initial_sidebar_state = "collapsed"
26- if session .logging_out or user_session_service . user_has_catalog_role ( )
26+ if session .auth and ( session . auth . logging_out or ( session . auth . is_logged_in and not session . auth . user_has_permission ( "view" )) )
2727 else "auto" ,
2828 )
2929
3030 application = get_application (log_level = log_level )
3131 application .logger .debug ("Starting Streamlit re-run" )
32+ if not session .auth :
33+ session .auth = application .auth_class ()
3234
3335 status_ok , message = check_basic_configuration ()
3436 if not status_ok :
@@ -41,20 +43,18 @@ def render(log_level: int = logging.INFO):
4143 session .page_args_pending_router and session .page_args_pending_router .get ("project_code" )
4244 ) or st .query_params .get ("project_code" , session .sidebar_project )
4345
44- if session .authentication_status is None and not session .logging_out :
45- user_session_service .load_user_session ()
46+ if not session .auth . is_logged_in and not session . auth .logging_out :
47+ session . auth .load_user_session ()
4648
4749 application .logo .render ()
4850
49- if session .authentication_status and not session .logging_in :
51+ if session .auth . is_logged_in and not session . auth .logging_in :
5052 with st .sidebar :
5153 testgen .sidebar (
5254 projects = Project .select_where (),
5355 current_project = session .sidebar_project ,
5456 menu = application .menu ,
5557 current_page = session .current_page ,
56- username = session .username ,
57- role = session .auth_role ,
5858 version = version_service .get_version (),
5959 support_email = settings .SUPPORT_EMAIL ,
6060 )
0 commit comments