esri / ago-tools Goto Github PK
View Code? Open in Web Editor NEWA Python package to assist with administering ArcGIS Online Organizations.
License: Apache License 2.0
A Python package to assist with administering ArcGIS Online Organizations.
License: Apache License 2.0
I'm trying to test the migrateAccount() function prior to moving our Org to enterprise logins. Having a problem getting it to run.
Given the script:
from agoTools.admin import Admin
agolAdmin = Admin('pdx.admin')
agolAdmin.migrateAccount('CSMike_demo_cofp', 'mike.quetel')
I'm getting the following runtime error:
C:\Tools>python migrate.py
Password:
Copying all items from CSMike_demo_cofp to mike.quetel...
Traceback (most recent call last):
File "migrate.py", line 3, in <module>
agolAdmin.migrateAccount('CSMike_demo_cofp', 'mike.quetel')
File "C:\Python27\ArcGIS10.4\lib\site-packages\agoTools\admin.py", line 353, in migrateAccount
self.reassignAllUser1ItemsToUser2(self, userFrom, userTo)
TypeError: reassignAllUser1ItemsToUser2() takes exactly 3 arguments (4 given)
C:\Tools>
Would appreciate any assistance in the correct usage as it must be something simple I'm missing. Thanks in advance!
At some point the ownerFolder
property showed up in an item's description. The __getItemFolder__
in utilities.py
function can probably be removed altogether, but at the least it should be retooled to make a simple request to the item's description endpoint rather than looping through all of a user's content to find a matching ID.
Attempting to run app in browser yields 500 - Internal Server Error
There is a problem with the resource you are looking for, and it cannot be displayed.
http://bosdemo2.esri.com/Apps/AGOLCat/
I ran this script against a feature layer in our AGOL account that is being fed into our Open Data site. Once I ran the script, the layer completly disappeared from our open data site. I don't know why this is. Any thoughts/ideas?
Add a new function that adds users to a group as org_admin and also sets the group to accept contributions from group admins only.
Inputs: existing groupID and a list of users
Uses: undocumented addUser operation
Returns: nothing (or report?)
Currently are looping through list of users and adding individually; however, it's likely the undocumented addUsers operation supports passing multiple users at once.
Hi I tried using AGOLCat.py and found that attributes (i.e. name, and size) are populated for some but not all items listed in the ouput. Can someone advise as to why this might be? Thanks - great tool with great potential for assisting AGOL admin... Meg
Does this library support updating a file geodatabase item by uploading a new zip file of a file geodatabase
The script does not function for services of Type WMS to an ArcGIS Online or Portal for ArcGIS environment. This script executes perfectly for "Map Service" type, but not "WMS" type
CSV Line 1:
title,url,tags,type,id,thumbnail,description,snippet,extent,spatialReference,accessInformation,licenseInfo,culture
CSV Line 2:
WMS_Service,https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WMSServer?request=GetCapabilities&service=WMS,testtag,WMS,,,WMS,,,,,,
When executed directly, the script returns "0 items added". Watching network traffic, the script never executes the "addItem" call to the Portal sharing API.
Delegation order came through for Denise Elston to issue aeration permits. We now need her added to be an Authorized Issuer"
Hi there,
I have come across a problem whereby only the original user who setup the ArcGIS Online organisation account can run the registerItems.py script (I have only tested this with this specific script). Other users added following on from this do not seem be allowed run the script, even if they are assigned an 'Administrator' role. I have tested this with two separate organisation accounts and come across the same problem. The following is the error I get (it's the same error that you get when the username/password/portal parameter is wrong):
However, I am definitely using the correct credentials and the users have Administrator roles. Has anyone encountered this problem or is this a requirement?
Kind regards,
Michael
Separate addNewUsersToGroups into listNewUsers and addUsersToGroups
Input: daysToCheck
Returns: list of new users in the last 'daysToCheck' days
Issue when running AGOLCat.py from the command line as shown in the sample with -size True
for ArcGIS Online organization.
I believe \u2014
maps to the em dash.
Create a list of all users in a particular role or roles
input: role or roles
returns: list of users matching the provided role(s)
I need to update the sourceURL for a lot of registered layers. Is that currently supported by the api?
The sample updateRegisteredUrlForServiceOrApp.py updates the url that is assigned to the layer by ArcGIS at time of registration, not the layer's sourceURL (a ArcGIs Server service). Any help is much appreciated. Thanks!
Would there be a way to add an enhancement to the get users script or a new script to specify a group and pull the users just from that group?
Thanks!
The full name of a user might have unicode characters. These are not handled correctly at the moment.
dataWriter.writerow([user['fullName'], user['email'], user['username'], user['role'], time.strftime("%Y-%m-%d",time.gmtime(user['created']/1000))])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)
The full name of a user might contain a delimiter character (such as a comma) so a csv.QUOTE_NONNUMERIC may be more appropriate.
It's cumbersome to initialize a new Utilities
class (requiring username
and password
) when you've already initialized an Admin
class (or vice versa). Rethink how these modules are organized and how authentication should be handled.
Two ideas:
token
parameter to be used for authenticating the classUser
class initialization from the Admin and Utilities classes and instead add a token
parameter to all functionsHello,
I'm trying to migrate to enterprise logins and was testing the migrateAccounts sample. When I try using either a single account or a csv file I get the error:
TypeError: reassignAllUser1ItemsToUser2() takes exactly 3 arguments (4 given)
Our enterprise logins are structured like '@city.kingston.on.ca_' (not sure if this is consistent across all enterprise login usernames or specific to us). I wondered whether the issue was coming from the '@' symbol, so I tried to use re.escape to properly format the username:
userTo = re.escape('')
myAgol.migrateAccount('', userTo)
but I'm getting the same error. I've tried lots of different combinations of escape characters and quotes but haven't landed on the right one yet. Any ideas?
Thanks,
Chris
This will make it easier for people to track major changes and download the repo for usage.
RegisterItems.py and corresponding function in admin.py:
I don't know if this is because of the way I am running it, but the registerItems function in the admin script errors out if I don't have all of the optional fields in my csv file, including one field not mentioned, "id".
Once I add all these fields (I don't have to actually populate them), the script runs as expected. Could you add this information to the readme notes?
Hi there,
I came across a problem whereby we had a folder that contained the character 'ΓΊ'. This then threw an error as below:
It doesn't matter if no folder is selected, this error is still thrown. By the looks of it, ASCII characters are only supported for folder names. For language support it might be worth expanding this to include other characters.
Kind regards,
Michael
When attempting to log in with the Admin command when using an enterprise account, I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/******/agoTools/admin.py", line 16, in __init__
self.user = User(username, portal, password)
File "/Users/******/agoTools/__init__.py", line 19, in __init__
self.token = self.__getToken__(self.portalUrl, self.username, self.password)
File "/Users/******/agoTools/__init__.py", line 30, in __getToken__
response = urllib.urlopen(url + '/sharing/rest/generateToken?', parameters).read()
KeyError: 'token'
There are no issues logging in with a non-enterprise account. This was done on OSX, have tried from Windows as well.
Separate addNewUsersToGroups into getNewUsers and addUsersToGroups
Currently, if the roles
parameter is not supplied when the getUsers
function is called, then the default list of roles if applied. Due to the impending custom roles in ArcGIS Online, this set of defaults should be removed.
The new behavior should be: if roles
is not passed, then all users are added rather than testing them against a set of defaults.
Thanks @tschwartzman!
Suggest moving usage examples/scripts from the README to individual .py files in an "Examples" folder. There are quite a few examples now and I think we've outgrown having them in the README.
It would be helpful if there was a method to batch register items from some sort of CSV formatted input. Given, for example, columns for NAME, URL, TAGS, have these registered with the portal.
Does anyone know the code to add Last Login to the createUserListCSV.py by chance? 'Last Login' did not work.
Thank you
Add a getItems function (similar to getUsers). One use case is to be able to easily create a spreadsheet of all items with views and other information that can be turned into a PivotTable and used to summarize activity in an organization.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.