Change Privileges (Data Management)

Summary

Establishes or changes user access privileges on 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.
    • The Edit parameter must be set to Grant edit privileges.
    Edit privileges are dependent on the view privilege, since you cannot edit what you cannot see (view).

  • If edit privileges are revoked, you can still view the dataset. However, if view privileges are revoked, edit privileges are automatically 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 username. Database roles can also be used in place of usernames. On RDBMS platforms that support operating system groups, the operating system group can also be specified in place of usernames.

  • For datasets that are registered as branch versioned, privileges and access are controlled at the portal level. This is managed by sharing items in the organization and the portal user privileges.

Parameters

LabelExplanationData Type
Input Dataset

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

Layer; Table View; Dataset; Address Locator
User

The database username whose privileges will be modified.

String
View (Select)
(Optional)

Specifies the user's view privileges.

  • Do not change to view privilegesNo changes will be made to the user's existing view privileges. 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.
  • Grant view privilegesThe user will be allowed to view the datasets.
  • Revoke view privilegesThe user's view privileges will be removed.
String
Edit (Update/Insert/Delete)
(Optional)

Specifies the user's edit privileges.

  • Do not change edit privileges No changes will be made to the user's existing edit privileges. 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.
  • Grant edit privilegesThe user will be allowed to edit the input datasets.
  • Revoke edit privilegesThe user's edit privileges will be removed. The user can still view the input dataset.
String

Derived Output

LabelExplanationData Type
Updated Dataset

The updated dataset.

Layer; Table View; Dataset

arcpy.management.ChangePrivileges(in_dataset, user, {View}, {Edit})
NameExplanationData 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 username whose privileges will be modified.

String
View
(Optional)

Specifies the user's view privileges.

  • AS_ISNo changes will be made to the user's existing view privileges. 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.
  • GRANTThe user will be allowed to view the datasets.
  • REVOKEThe user's view privileges will be removed.
String
Edit
(Optional)

Specifies the user's edit privileges.

  • AS_IS No changes will be made to the user's existing edit privileges. 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.
  • GRANTThe user will be allowed to edit the input datasets.
  • REVOKEThe user's edit privileges will be removed. The user can 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"

# Run ChangePrivileges
arcpy.management.ChangePrivileges(datasetName, "WENDELCLARK", "GRANT", "GRANT")

Environments

Licensing information

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

Related topics