import streamlit as st from auth import get_fullname_for_user, get_role_for_user def build_sidebar(): if st.session_state.get("authentication_status") != True: return authenticator = st.session_state.get("authenticator") username = st.session_state.get("username") if not authenticator or not username: return role = get_role_for_user(username) fullname = get_fullname_for_user(username) with st.sidebar: st.logo("app/images/GMN_Logo_neu_rgb.png", size="small") st.write(f"**{fullname}** ({role})") col1, col2 = st.columns(2) with col1: if st.button("Logout", use_container_width=True): authenticator.logout("Logout", "unrendered") st.rerun() with col2: if st.button("Home", use_container_width=True): st.switch_page("pages/home.py") st.divider() st.markdown("## MenĂ¼") st.page_link("pages/Benutzer.py", label="Benutzer anlegen") # Damit die leere Sidebar komplett verschwindet nach dem Logout def hide_sidebar_if_logged_out(): if st.session_state.get("authentication_status") != True: st.markdown(""" """, unsafe_allow_html=True)