Skip to content

Users

The Flywheel SDK provides methods for managing user accounts on the site. Most user-management operations require admin permissions.

User model overview

A Flywheel user account has the following key fields:

Field Description
id The user's email address (used as the unique identifier)
firstname First name
lastname Last name
email Email address (same as id)
roles List of site-level role assignments
avatar URL of the user's avatar image

Note

User IDs in Flywheel are email addresses. Pass the email address wherever a user_id parameter is required.

User provisioning

Users are typically provisioned via single sign-on (SSO) or Lightweight Directory Access Protocol (LDAP). The SDK supplements those mechanisms and is useful for scripted onboarding, bulk modifications, or querying user state. It is not a replacement for your organization's identity provider.

Getting the current user

Any authenticated user can retrieve their own account:

Get the current authenticated user
me = fw.get_current_user()
print(me.id, me.firstname, me.lastname)

Listing all users

Listing all users requires admin permissions:

List all users (admin only)
for user in fw.get_all_users():
    print(user.id, user.firstname, user.lastname)

Getting a user by ID

Get a specific user
user = fw.get_user(user_email)
print(user.firstname, user.lastname)

Adding a user

Add a new user (admin only)
fw.add_user(
    flywheel.User(
        id=user_email,
        firstname="Jane",
        lastname="Doe",
        email=user_email,
    )
)

Modifying a user

Update a user's name fields (admin only)
fw.modify_user(user_email, {"firstname": "Jane", "lastname": "Smith"})

Deleting a user

Delete a user (admin only)
fw.delete_user(user_email)

Warning

Deleting a user removes their account from the site but does not remove their permission entries from groups and projects. Clean up their permissions separately if needed.