Role based Authentication

Hello,
I am developing a user authentication screen.
I am using config.yml based approach to implementing the logic.
reference link : Streamlit-Authenticator, Part 1: Adding an authentication component to your app

What i am looking for is that in the login screen in addition to Username and Password. A dropdown with Label “Role” to be shown(Principal or Teacher).
Based on the details provided (Username, Password, and Role). The role-based page should be shown. i.e., the view of each page is different
Is this approach possible via the config.yml approach? or some other approach is required to achieve this functionality.
PFA image.

An interesting need, a principal accessing the teachers’ page is normal, but teachers accessing the principal’s page is something.

2 Likes

@Streamlit Community,

Is this achievable through current version of streamlit? because it is more important when we are developing an application like having admin users and regular users. if admin user logs in, the pages and tabs will different than the regular users logs in. (more like role based authorization). I know streamlit is supporting the authentication.

Also whether it is possible to restrict the data with role based authorization. ex. if an user is in US, i wanted to shown him the data related to that particular country, more kind of country specific.

really appreciate the help.

Regards
Sridhar

Not sure what you need help with. That sounds like Python as usual.

if user_role == "admin":
    show_admin_UI()
else:
    show_regular_UI()

data = get_country_data(country=user_country)

Is it possible to control the dashboard screen with ip address of different countries.

You can make the control flow depend on any data available to the application.

1 Like

Hi, Did you get something related to this role based authentication?
Or you have some link or some set of code which could help me.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.