HOW TO
Members of an organization can be deleted by users with the privilege to delete members, or by the administrator of the group or organization through the My Organization tab on the Portal for ArcGIS page. This can also be done using the command line utility for bulk remove, such as when it is necessary to delete a large number of members. For more information, refer to the following web help document: Portal for ArcGIS: Manage members, under the 'Delete member' section.
Using ArcGIS API for Python, inactive members can also be removed depending on a specified duration of inactivity. This article describes the steps to do this.
from arcgis.gis import GIS from IPython.display import display import os,sys, time # Loop user to get last login source = GIS("https://domain.server.com/portal/home", "-------", "--------") sourceusers = source.users.search(max_users=1000) sourceusers ignore_list = ['system_publisher', 'esri_nav', 'esri_livingatlas', 'esri_boundaries', 'esri_demographics'] for user in sourceusers: if not user.username in ignore_list: #print(user) print(user.username) print(user.lastLogin) # Specify users inactivity time if user.lastLogin == -1: print("deleting user: " + user.username) #user.delete() print("-----------------------")
Note: Edit the code segment under the comment, Specify users inactivity time, to set the date of last login. The numbers used are the epoch timestamp. The following is a sample code snippet that searches for users last logged in before 4 September 2017, using the epoch timestamp.
if user.lastLogin < 1504487841:
Note: The Epoch timestamp is the number of seconds that have elapsed since January 1, 1970, excluding leap seconds.
Get help from ArcGIS experts
Download the Esri Support App