Change Privileges (Data Management)

Summary

Establishes or changes user access privileges to the input enterprise database datasets, stand-alone feature classes, or tables.

Usage

  • To edit enterprise geodatabase datasets, both of the following are required:

    • The View parameter must be set to Grant view privileges (GRANT in Python).
    • The Edit parameter must be set to Grant edit privileges (GRANT in Python).
    Edit privileges are dependent on the View privilege, since you cannot edit what you cannot see (view).

  • Edit privileges may be revoked, but you can still view the dataset. However, if the View privilege is revoked, the Edit privileges will automatically be revoked as well.

  • The relational database management system (RDBMS) equivalent command for the View parameter is Select.

  • The RDBMS equivalent commands for the Edit parameter are Update, Insert, and Delete. All three are granted or revoked simultaneously by the Edit parameter.

  • The parameter descriptions below use the terms user or user name. Database roles can also be used in place of user names. On RDBMS platforms that support operating system groups, the operating system group can also be specified in place of user names.

Syntax

arcpy.management.ChangePrivileges(in_dataset, user, {View}, {Edit})
ParameterExplanationData Type
in_dataset
[in_dataset,...]

The datasets, feature classes, or tables whose access privileges will be changed.

Layer; Table View; Dataset; Address Locator
user

The database user name whose privileges are being modified.

String
View
(Optional)

Establishes the user's view privileges.

  • AS_ISNo change to the user's existing view privilege. If the user has view privileges, they will continue to have view privileges. If the user doesn't have view privileges, they will continue to not have view privileges.
  • GRANTAllows user to view datasets.
  • REVOKERemoves all user privileges to view datasets.
String
Edit
(Optional)

Establishes the user's edit privileges.

  • AS_IS No change to the user's existing edit privilege. If the user has edit privileges, they will continue to have edit privileges. If the user doesn't have edit privileges, they will continue to not have edit privileges. This is the default.
  • GRANTAllows the user to edit the input datasets.
  • REVOKERemoves the user's edit privileges. The user may still view the input dataset.
String

Derived Output

NameExplanationData Type
out_dataset

The updated dataset.

Layer; Table View; Dataset

Code sample

ChangePrivileges example (stand-alone script)

The following stand-alone script demonstrates how to grant view and edit privileges to WendelClark.

# Name: GrantPrivileges_Example.py
# Description: Grants view and edit privileges to WendelClark

# Import system modules
import arcpy

# Set local variables
datasetName = "c:/Connections/gdb@production.sde/production.GDB.ctgFuseFeature"

# Execute ChangePrivileges
arcpy.ChangePrivileges_management(datasetName, "WENDELCLARK", "GRANT", "GRANT")

Environments

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics