Skip to content

Commit 039bd49

Browse files
author
Manushi Majumdar
committed
requested changes for user profiles
1 parent e6f91bc commit 039bd49

File tree

1 file changed

+83
-35
lines changed

1 file changed

+83
-35
lines changed

samples/03_org_administrators/validate_user_profiles.ipynb

Lines changed: 83 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
{
3737
"cell_type": "code",
38-
"execution_count": 8,
38+
"execution_count": 1,
3939
"metadata": {},
4040
"outputs": [],
4141
"source": [
@@ -44,25 +44,36 @@
4444
"\n",
4545
"import pandas as pd\n",
4646
"\n",
47-
"from arcgis.gis import GIS\n",
48-
"\n",
47+
"from arcgis.gis import GIS"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": 2,
53+
"metadata": {},
54+
"outputs": [],
55+
"source": [
4956
"gis = GIS(\"home\")"
5057
]
5158
},
5259
{
5360
"cell_type": "markdown",
5461
"metadata": {},
5562
"source": [
56-
"Then, let's create a list containing strings that represent all the values that your organization requires (beyond the required attributes for a valid user profile)."
63+
"Then, let's create a list containing strings that represent all the values that your organization requires (beyond the required attributes for a valid user profile).\n",
64+
"\n",
65+
"`access_type` refers to the `User.access` property of a user and it indicates the level of access of the user: private, org, or public.\n",
66+
"\n",
67+
"While `access_type` may not be a requirement for your organization to validate a user profile, we have added it here to demonstrate how other useful properties can also be extracted for each user profile to learn more about them. "
5768
]
5869
},
5970
{
6071
"cell_type": "code",
61-
"execution_count": 2,
72+
"execution_count": 3,
6273
"metadata": {},
6374
"outputs": [],
6475
"source": [
65-
"complete_profile = ['description', 'thumbnail', 'access']"
76+
"complete_profile = ['description', 'thumbnail', 'access', 'access_type']"
6677
]
6778
},
6879
{
@@ -74,17 +85,20 @@
7485
},
7586
{
7687
"cell_type": "code",
77-
"execution_count": 3,
88+
"execution_count": 4,
7889
"metadata": {},
7990
"outputs": [],
8091
"source": [
8192
"def get_missing_profile_attrs(member):\n",
8293
" non_compliance = []\n",
8394
" for attr in complete_profile:\n",
84-
" if getattr(member, attr) == None:\n",
85-
" non_compliance.append(False)\n",
95+
" if attr=='access_type':\n",
96+
" non_compliance.append(member.access)\n",
8697
" else:\n",
87-
" non_compliance.append(True)\n",
98+
" if getattr(member, attr) == None: \n",
99+
" non_compliance.append(False)\n",
100+
" else:\n",
101+
" non_compliance.append(True)\n",
88102
" return non_compliance"
89103
]
90104
},
@@ -97,7 +111,7 @@
97111
},
98112
{
99113
"cell_type": "code",
100-
"execution_count": 4,
114+
"execution_count": 5,
101115
"metadata": {},
102116
"outputs": [],
103117
"source": [
@@ -116,7 +130,7 @@
116130
},
117131
{
118132
"cell_type": "code",
119-
"execution_count": 5,
133+
"execution_count": 6,
120134
"metadata": {},
121135
"outputs": [
122136
{
@@ -143,53 +157,66 @@
143157
" <th>description</th>\n",
144158
" <th>thumbnail</th>\n",
145159
" <th>access</th>\n",
160+
" <th>access_type</th>\n",
146161
" </tr>\n",
147162
" </thead>\n",
148163
" <tbody>\n",
149164
" <tr>\n",
150-
" <th>user001</th>\n",
165+
" <th>achapkowski_geosaurus</th>\n",
151166
" <td>False</td>\n",
152167
" <td>False</td>\n",
153168
" <td>True</td>\n",
169+
" <td>org</td>\n",
154170
" </tr>\n",
155171
" <tr>\n",
156-
" <th>viewer002</th>\n",
157-
" <td>False</td>\n",
158-
" <td>False</td>\n",
172+
" <th>amani_geosaurus</th>\n",
173+
" <td>True</td>\n",
174+
" <td>True</td>\n",
159175
" <td>True</td>\n",
176+
" <td>public</td>\n",
160177
" </tr>\n",
161178
" <tr>\n",
162-
" <th>primary_admin</th>\n",
163-
" <td>False</td>\n",
164-
" <td>False</td>\n",
179+
" <th>andrew57</th>\n",
180+
" <td>True</td>\n",
165181
" <td>True</td>\n",
182+
" <td>True</td>\n",
183+
" <td>private</td>\n",
166184
" </tr>\n",
167185
" <tr>\n",
168-
" <th>publisher001</th>\n",
186+
" <th>api_data_owner</th>\n",
169187
" <td>False</td>\n",
170188
" <td>False</td>\n",
171189
" <td>True</td>\n",
190+
" <td>org</td>\n",
191+
" </tr>\n",
192+
" <tr>\n",
193+
" <th>arcgis_python</th>\n",
194+
" <td>True</td>\n",
195+
" <td>True</td>\n",
196+
" <td>True</td>\n",
197+
" <td>public</td>\n",
172198
" </tr>\n",
173199
" </tbody>\n",
174200
"</table>\n",
175201
"</div>"
176202
],
177203
"text/plain": [
178-
" description thumbnail access\n",
179-
"user001 False False True\n",
180-
"viewer002 False False True\n",
181-
"primary_admin False False True\n",
182-
"publisher001 False False True"
204+
" description thumbnail access access_type\n",
205+
"achapkowski_geosaurus False False True org\n",
206+
"amani_geosaurus True True True public\n",
207+
"andrew57 True True True private\n",
208+
"api_data_owner False False True org\n",
209+
"arcgis_python True True True public"
183210
]
184211
},
185-
"execution_count": 5,
212+
"execution_count": 6,
186213
"metadata": {},
187214
"output_type": "execute_result"
188215
}
189216
],
190217
"source": [
191218
"user_profile_df = pd.DataFrame(data=user_profile_status, index=complete_profile).T\n",
192-
"user_profile_df"
219+
"user_profile_df.head()"
193220
]
194221
},
195222
{
@@ -201,7 +228,7 @@
201228
},
202229
{
203230
"cell_type": "code",
204-
"execution_count": 9,
231+
"execution_count": 7,
205232
"metadata": {},
206233
"outputs": [],
207234
"source": [
@@ -221,30 +248,34 @@
221248
},
222249
{
223250
"cell_type": "code",
224-
"execution_count": 10,
251+
"execution_count": 8,
225252
"metadata": {},
226253
"outputs": [
227254
{
228255
"data": {
229256
"text/html": [
230257
"<div class=\"item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
231258
" <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
259+
" <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=9f077933498c41fbb222ee95fee23102' target='_blank'>\n",
260+
" <img src='http://static.arcgis.com/images/desktopapp.png' class=\"itemThumbnail\">\n",
261+
" </a>\n",
232262
" </div>\n",
233263
"\n",
234264
" <div class=\"item_right\" style=\"float: none; width: auto; overflow: hidden;\">\n",
235-
" <b>output_org_user_profile_1547747903</b>\n",
236-
" <br/>CSV by primary_admin\n",
237-
" <br/>Last Modified: January 17, 2019\n",
265+
" <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=9f077933498c41fbb222ee95fee23102' target='_blank'><b>output_org_user_profile_1686349431</b>\n",
266+
" </a>\n",
267+
" <br/><img src='https://geosaurus.maps.arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/layers16.png' style=\"vertical-align:middle;\">CSV by MMajumdar_geosaurus\n",
268+
" <br/>Last Modified: June 09, 2023\n",
238269
" <br/>0 comments, 0 views\n",
239270
" </div>\n",
240271
" </div>\n",
241272
" "
242273
],
243274
"text/plain": [
244-
"<Item title:\"output_org_user_profile_1547747903\" type:CSV owner:primary_admin>"
275+
"<Item title:\"output_org_user_profile_1686349431\" type:CSV owner:MMajumdar_geosaurus>"
245276
]
246277
},
247-
"execution_count": 10,
278+
"execution_count": 8,
248279
"metadata": {},
249280
"output_type": "execute_result"
250281
}
@@ -253,6 +284,23 @@
253284
"gis.content.add({}, output_dir + out_file)"
254285
]
255286
},
287+
{
288+
"cell_type": "markdown",
289+
"metadata": {},
290+
"source": [
291+
"You may download this item if you wish, and if you decide to delete this item after having used it, you may run the script below by updating the `item_id` with the id of this file in your organization."
292+
]
293+
},
294+
{
295+
"cell_type": "code",
296+
"execution_count": null,
297+
"metadata": {},
298+
"outputs": [],
299+
"source": [
300+
"item = gis.content.get(item_id)\n",
301+
"item.delete()"
302+
]
303+
},
256304
{
257305
"cell_type": "markdown",
258306
"metadata": {},
@@ -283,7 +331,7 @@
283331
"name": "python",
284332
"nbconvert_exporter": "python",
285333
"pygments_lexer": "ipython3",
286-
"version": "3.9.11"
334+
"version": "3.7.16"
287335
},
288336
"toc": {
289337
"base_numbering": 1,

0 commit comments

Comments
 (0)