Skip to content

Commit bcd22cf

Browse files
committed
Update move_existing_user_content_to_a_new_user.ipynb
1 parent 01c96f3 commit bcd22cf

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

samples/03_org_administrators/move_existing_user_content_to_a_new_user.ipynb

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@
6969
{
7070
"cell_type": "code",
7171
"execution_count": null,
72-
"metadata": {},
72+
"metadata": {
73+
"scrolled": true
74+
},
7375
"outputs": [
7476
{
7577
"data": {
@@ -204,6 +206,38 @@
204206
" for item in folderitems:\n",
205207
" item.reassign_to(new_userid, target_folder=folder['title'])"
206208
]
209+
},
210+
{
211+
"cell_type": "markdown",
212+
"metadata": {},
213+
"source": [
214+
" "
215+
]
216+
},
217+
{
218+
"cell_type": "markdown",
219+
"metadata": {},
220+
"source": [
221+
"If the goal is reassign all the groups and items permanently then it is best to use the reassign_to method that can be found on the user itself. Instead of iterating through each folder and item, the call will be executed once and all the groups along with all the items of a user are reassigned to the indicated user. \n",
222+
"Items are transferred to the new user into a folder named <user>_<folder> where user corresponds to the old user whose items were moved and folder corresponds to the folder that was moved."
223+
]
224+
},
225+
{
226+
"cell_type": "code",
227+
"execution_count": null,
228+
"metadata": {},
229+
"outputs": [
230+
{
231+
"name": "stdout",
232+
"output_type": "stream",
233+
"text": [
234+
"True\n"
235+
]
236+
}
237+
],
238+
"source": [
239+
"olduser.reassign_to(target_username=newuser)"
240+
]
207241
}
208242
],
209243
"metadata": {
@@ -223,20 +257,7 @@
223257
"name": "python",
224258
"nbconvert_exporter": "python",
225259
"pygments_lexer": "ipython3",
226-
"version": "3.8.2"
227-
},
228-
"toc": {
229-
"base_numbering": 1,
230-
"nav_menu": {},
231-
"number_sections": true,
232-
"sideBar": true,
233-
"skip_h1_title": true,
234-
"title_cell": "Table of Contents",
235-
"title_sidebar": "Contents",
236-
"toc_cell": false,
237-
"toc_position": {},
238-
"toc_section_display": true,
239-
"toc_window_display": true
260+
"version": "3.7.11"
240261
}
241262
},
242263
"nbformat": 4,

0 commit comments

Comments
 (0)