### This script creates a spreadsheet with key informationa about each user.
### It expands on createUserListCSV.py by adding a field detailing the groups
### each user is a member of.

# Requires admin role.
import csv, time
from agoTools.admin import Admin
from agoTools.utilities import Utilities

username = '******'
password = '******'
outputFile = 'c:/temp/users.csv'

agoAdmin = Admin(username=username, password=password)
agoUtilities = Utilities(username=username, password=password)

print('Getting users.')
users = agoAdmin.getUsers()
roles = agoAdmin.getRoles()
# Make a dictionary of the roles so we can convert custom roles from their ID to their associated name.
roleLookup = {}
for role in roles:
    roleLookup[role["id"]] = role['name']

# Get the users' groups.
print('Getting each user\'s groups.')
for user in users:
    user['groups'] = []
    groups = agoUtilities.getUserGroups(user['username'])
    for group in groups:
        user['groups'].append(group['title'].encode('utf-8'))
Пример #2
0
#### Update web map version to 1.7x
#### Allows for opening new web maps in ArcGIS Explorer
#### Intended use is if you need to use AGX to create queries for iOS devices

import sys
sys.path.append(
    'c:/scripts')  # Directory where utilities.py is located.  Change as needed

from agoTools.utilities import Utilities

agoUtilities = Utilities(
    '<username>')  # Replace <username> with your username.

webmapId = '<WEB MAP ID>'  # Replace with web map ID

agoUtilities.updatewebmapversionAGX(webmapId)
#### Update the URL for registered map services or web applications

from agoTools.utilities import Utilities

agoUtilities = Utilities(<username>) # Replace <username> with your username.

itemId = '<ITEM ID>'    # Replace with item ID
oldUrl = '<http://oldserver.com/app>'    # Replace with old URL
newUrl = '<http://newserver.com/app>'    # Replace with new URL

agoUtilities.updateItemUrl(itemId, oldUrl, newUrl)	
Пример #4
0
#### Update web map version to 1.7x
#### Allows for opening new web maps in ArcGIS Explorer
#### Intended use is if you need to use AGX to create queries for iOS devices

import sys
sys.path.append('c:/scripts')  # Directory where utilities.py is located.  Change as needed

from agoTools.utilities import Utilities

agoUtilities = Utilities('<username>') # Replace <username> with your username.

webmapId = '<WEB MAP ID>'    # Replace with web map ID

agoUtilities.updatewebmapversionAGX(webmapId)
### This script creates a spreadsheet with key informationa about each user.
### It expands on createUserListCSV.py by adding a field detailing the groups
### each user is a member of.

# Requires admin role.
import csv, time
from agoTools.admin import Admin
from agoTools.utilities import Utilities

username = '******'
password = '******'
outputFile = 'c:/temp/users.csv'

agoAdmin = Admin(username=username, password=password)
agoUtilities = Utilities(username=username, password=password)

print('Getting users.')
users = agoAdmin.getUsers()
roles = agoAdmin.getRoles()
# Make a dictionary of the roles so we can convert custom roles from their ID to their associated name.
roleLookup = {}
for role in roles:
    roleLookup[role["id"]] = role['name']

# Get the users' groups.
print('Getting each user\'s groups.')
for user in users:
    user['groups'] = []
    groups = agoUtilities.getUserGroups(user['username'])
    for group in groups:
        user['groups'].append(group['title'].encode('utf-8'))
#### Update map service urls in webmaps

from agoTools.utilities import Utilities
agoUtilities = Utilities(<username>) # Replace <username> with your username.

webmapId = '<WEBMAP ID>'    # Replace with web map ID
oldUrl = '<http://myserver.com/arcgis/rest/services/old/MapServer>'    # Replace with old map service URL
newUrl = '<http://myserver.com/arcgis/rest/services/new/MapServer>'    # Replace with new map service URL

agoUtilities.updateWebmapService(webmapId, oldUrl, newUrl)