Exemplo n.º 1
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'))