ArcObjects Library Reference  (GeoDatabase)    

ISQLPrivilege Interface

Provides access to members for granting and revoking privileges to database users.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Members

Description
Method Grant Grants privileges for the database user.
Method Revoke Revokes privileges for the database user.
Read-only property SQLPrivileges The database privileges.

CoClasses that implement ISQLPrivilege

CoClasses and Classes Description
ESRIFDOAddressLocator (esriLocation) A locator that uses the ESRI geocoding engine and Feature-Data-Object reference data sources.
FeatureClassName ESRI Feature Class Name object.
FeatureDatasetName ESRI Feature Dataset Name object.
GPToolboxName (esriGeoprocessing) Light-weight object referencing a geoprocessing toolbox.
LocatorName (esriLocation) Name object for a locator.
ObjectClassName ESRI Object Class Name object.
RelationshipClassName ESRI Relationship Class Name object.
SchematicDatasetName (esriSchematic) Schematic dataset name object.
SdeRasterTableName (esriDataSourcesRaster) A container for name information about an SDE Raster.
SurveyDatasetName (esriSurveyExt) SurveyDatasetName Class
TableName ESRI Table Name object.

Remarks

The ISQLPrivilege optional interface provides information about the permissions you have on a database object and also the ability to change the permissions for other users. It only applies to those datasets that are stored within an ArcSDE geodatabase. It applies to feature datasets, feature classes, tables, relationship classes, raster datasets, and raster catalogs.  ISQLPrivilege cannot be used on datasets contained within a feature dataset, as permissions are managed at the feature dataset level.

The esriSQLPrivilege enumeration defines values that can be used with ISQLPrivilege:

Enumeration esriSQLPrivilege SQL Privileges

1 - esriSelectPrivilege

Select

2 - esriUpdatePrivilege

Update

4 - esriInsertPrivilege

Insert

8 - esriDeletePrivilege

Delete

The values may be bitwise OR'd together if more than one privilege applies (note that this is equal to summing the integer values). For example, if the SQLPrivileges property returns a value of 9, this would mean that you have select and delete permission on the dataset, but not insert or update. A value of 15 indicates full privileges.

The last parameter on Grant is for specifying whether or not the user will have the ability to grant privileges to other users.

Address locators only support esriSelectPrivilege

[C#]

The esriSQLPrivilege constants must be cast to int for use in C#.


    public void ISQLPrivilege__(IDatasetName datasetName)
    {  
        //This example grants select and update privileges to a user called Scott.
        //The dataset name could be a feature dataset, in which case the Scott user
        //would receive privileges on all the contents of the feature dataset.
        //Due to withGrant being false Scott would not be able to grant similar priviledges
        //to other users.
        if (typeof(ISQLPrivilege) == datasetName)
       {
           ISQLPrivilege sqlPrivilege = datasetName as ISQLPrivilege;
           sqlPrivilege.Grant("Scott", (int)esriSQLPrivilege.esriSelectPrivilege | (int)esriSQLPrivilege.esriUpdatePrivilege, false);
       }
    }

[Visual Basic 6.0]

This example grants select and update privileges to a user called Scott. The dataset name could be a feature dataset, in which case the Scott user would receive privileges on all the contents of the feature dataset.

If TypeOf pDatasetName Is ISQLPrivilege Then
  Dim pSQLPriv As ISQLPrivilege
  Set pSQLPriv = pDatasetName
  pSQLPriv.Grant  "Scott" , esriSelectPrivilege + esriUpdatePrivilege, False
End If

See Also

IName Interface

 


Feedback Send feedback on this page