User management
Guide explains how to manipulate user and team members using Supervisely SDK and API
Introduction
In this tutorial you will learn how to work with User and manage team members using Supervisely SDK and API.
📗 Everything you need to reproduce this tutorial is on GitHub: source code and demo data.
How to debug this tutorial
Step 1. Prepare ~/supervisely.env file with credentials. Learn more here.
Step 2. Clone repository with source code and demo data and create Virtual Environment.
git clone https://github.com/supervisely-ecosystem/automation-with-python-sdk-and-api
cd automation-with-python-sdk-and-api
./create_venv.shStep 3. Open repository directory in Visual Studio Code.
code -r .Step 4. change ✅ IDs ✅ in local.env file by copying the IDs from Supervisely instance.
Copy your TEAM ID from context menu of the team.
CONTEXT_TEAMID=8 # ⬅️ change it
You can find your user ID and login at
Start->Team memberspageCONTEXT_USERID=7 # ⬅️ change it CONTEXT_USERLOGIN="my_username" # ⬅️ change it
Step 5. Start debugging examples/user-automation/main.py
User automation
Import libraries
Init API client
Init API for communicating with Supervisely Instance. First, we load environment variables with credentials:
Get your IDs and username from environment
List available roles on Supervisely instance
Print all roles that are available on Supervisely instance.
Output:
Get UserInfo about yourself
Output:
Get UserInfo by ID
Get general information about user by ID.
Note: requires admin permission if requested ID is not equal to user id
Output:
List all team users with corresponding roles
Output:
Methods that require admin permisssion
List all registered users
Print all registered users on Supervisely instance.
Output:
Get UserInfo by login
Get general information about user by name.
Output:
List all user teams with corresponding roles
Print user teams, with user's role in them.
Output:
Create new user
Output:
Update user info
Change user's name and password.
Output:
Disable/Enable user
Invite user to team
Output:
Change user role in team
Output:
Remove user from team
Output:
Last updated
Was this helpful?