Skip to content

Commit 51c2044

Browse files
authored
Merge pull request #1215 from Esri/NA/issue_4784
Add user.reassign_to in nb sample
2 parents 5c1d081 + be16268 commit 51c2044

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

samples/03_org_administrators/move_existing_user_content_to_a_new_user.ipynb

Lines changed: 36 additions & 2 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,7 +257,7 @@
223257
"name": "python",
224258
"nbconvert_exporter": "python",
225259
"pygments_lexer": "ipython3",
226-
"version": "3.7.9"
260+
"version": "3.7.11"
227261
}
228262
},
229263
"nbformat": 4,

0 commit comments

Comments
 (0)