Links
🧙♂

Users

Personalise your app
When you share your app with specific users, you can get information about their Databutton user by using
import databutton as db
user = db.user.get()
The user object looks like this
class User(BaseModel):
user: str
email: str

Make your app personal

import databutton as db
import streamlit as st
user = db.user.get()
st.write(f"Hello, {user.name}")

Role-based access control

You can utilize Databutton storage in harmony with db.user.get() role-based access in your app.
Example: Admin access
import databutton as db
import streamlit as st
# user_json looks like this
# {
# }
users_json = db.storage.json.get('users')
user = db.user.get()
if user.email not in users_json['admins']:
st.write('This is only available to admins!')
st.stop()
st.write(f"Hello, {user.name}")