You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
| Labels |[Github](basics/labels.ipynb)|[](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/labels.ipynb)|
17
17
| Ontologies |[Github](basics/ontologies.ipynb)|[](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/ontologies.ipynb)|
18
18
| Projects |[Github](basics/projects.ipynb)|[](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/projects.ipynb)|
19
+
| User Management |[Github](basics/user_management.ipynb)|[](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/user_management.ipynb)|
"source": "# If you don't want to give google access to drive you can skip this cell\n# and manually set `API_KEY` below.\n\nCOLAB = \"google.colab\" in str(get_ipython())\nif COLAB:\n !pip install colab-env -qU\n from colab_env import envvar_handler\n envvar_handler.envload()\n\nAPI_KEY = os.environ.get(\"LABELBOX_API_KEY\")\nif not os.environ.get(\"LABELBOX_API_KEY\"):\n API_KEY = getpass(\"Please enter your labelbox api key\")\n if COLAB:\n envvar_handler.add_env(\"LABELBOX_API_KEY\", API_KEY)"
42
+
},
43
+
{
44
+
"cell_type": "markdown",
45
+
"id": "raising-nightlife",
46
+
"metadata": {},
47
+
"source": [
48
+
"* You have to specifically enable experimental features to use this functionality. Notice the \n",
49
+
"`enable_experimental = True`\n",
50
+
" * enables users to send invites and checking the number of seats available via the sdk"
"source": "# Please provide a dummy email here:\n# Preferrably one you can access. If you have a google account you can do email+1@<domain>.com\nDUMMY_EMAIL = \"< SET THIS >\"\n# This should be set to an account that you wan't to change the permissions for.\n# You could invite a new user, accept the invite and use that account if you don't want to effect any active users\nDUMMY_USER_ACCOUNT_ID = \"ckneh4n8c9qvq0706uwwg5i16\""
68
+
},
69
+
{
70
+
"cell_type": "markdown",
71
+
"id": "central-performer",
72
+
"metadata": {},
73
+
"source": [
74
+
"### Roles\n",
75
+
"* When inviting a new user to an organization, there are various roles to select from.\n",
76
+
"* All available roles to your org can be accessed via `client.get_roles()`"
77
+
]
78
+
},
79
+
{
80
+
"cell_type": "code",
81
+
"execution_count": 6,
82
+
"id": "later-dealing",
83
+
"metadata": {},
84
+
"outputs": [
85
+
{
86
+
"name": "stdout",
87
+
"output_type": "stream",
88
+
"text": [
89
+
"LABELER : cjlvi914y1aa20714372uvzjv\n",
90
+
"REVIEWER : cjlvi919b1aa50714k75euii5\n",
91
+
"TEAM_MANAGER : cjlvi919q1aa80714b7z3xuku\n",
92
+
"ADMIN : cjlvi91a41aab0714677xp87h\n",
93
+
"NONE : cjmb6xy80f5vz0780u3mw2rj4\n"
94
+
]
95
+
}
96
+
],
97
+
"source": "roles = client.get_roles()\nfor name, role in roles.items():\n print(role.name, \":\", role.uid)"
98
+
},
99
+
{
100
+
"cell_type": "markdown",
101
+
"id": "superb-exploration",
102
+
"metadata": {},
103
+
"source": [
104
+
"* Above we printed out all of the roles available to the current org.\n",
105
+
"* Notice the `NONE`. That is for project level roles"
106
+
]
107
+
},
108
+
{
109
+
"cell_type": "markdown",
110
+
"id": "romantic-martin",
111
+
"metadata": {},
112
+
"source": [
113
+
"### Create\n",
114
+
"* Users are created by sending an invite\n",
115
+
"* An email will be sent to them and they will be asked to join your organization"
116
+
]
117
+
},
118
+
{
119
+
"cell_type": "markdown",
120
+
"id": "harmful-state",
121
+
"metadata": {},
122
+
"source": [
123
+
"#### Organization Level Permissions\n",
124
+
"* Invite a new labeler with labeling permissions on all projects"
125
+
]
126
+
},
127
+
{
128
+
"cell_type": "code",
129
+
"execution_count": 7,
130
+
"id": "analyzed-partition",
131
+
"metadata": {},
132
+
"outputs": [
133
+
{
134
+
"data": {
135
+
"text/plain": [
136
+
"InviteLimit(remaining=2, used=3, limit=5)"
137
+
]
138
+
},
139
+
"execution_count": 6,
140
+
"metadata": {},
141
+
"output_type": "execute_result"
142
+
}
143
+
],
144
+
"source": "# First make sure that you have enough seats:\norganization.invite_limit()"
"source": "user = client._get_single(User, DUMMY_USER_ACCOUNT_ID)\n\n# Give the user organization level permissions\nuser.update_org_role(roles[\"LABELER\"])\nprint(user.org_role())\n# Restore project level permissions\nuser.update_org_role(roles[\"NONE\"])\nprint(user.org_role())\n# Make the user a labeler for the current project\nuser.upsert_project_role(project, roles[\"LABELER\"])\nprint(user.org_role())"
243
+
},
244
+
{
245
+
"cell_type": "code",
246
+
"execution_count": 13,
247
+
"id": "liquid-beast",
248
+
"metadata": {},
249
+
"outputs": [],
250
+
"source": "# Remove the user from a project (Same as setting the project role to `roles.NONE`)\nuser.remove_from_project(project)"
251
+
},
252
+
{
253
+
"cell_type": "markdown",
254
+
"id": "portuguese-harvard",
255
+
"metadata": {},
256
+
"source": [
257
+
"### Delete"
258
+
]
259
+
},
260
+
{
261
+
"cell_type": "markdown",
262
+
"id": "adjacent-partnership",
263
+
"metadata": {},
264
+
"source": [
265
+
"* Invites can only be deleted from the ui at this time. \n",
266
+
"* Deleting invites can be done in the members tab of the web app."
267
+
]
268
+
},
269
+
{
270
+
"cell_type": "markdown",
271
+
"id": "desperate-shield",
272
+
"metadata": {},
273
+
"source": [
274
+
"* Delete the User\n",
275
+
"* Make sure you want to remove the user from the org:\n",
0 commit comments