TransWikia.com

SDE FeatureClass Granting and Revoking Privilege with ArcObjects

Geographic Information Systems Asked by furier on December 10, 2020

How can I with ArcObjects GRANT or REVOKE Privileges like SELECT, UPDATE on SDE FeatureClasses to/from Roles?

The equivalent in normal Oracle would be something like this:

GRANT SELECT ON SCHEMA.TABLE TO SOME_ROLE;
REVOKE SELECT ON SCHEMA.TABLE FROM SOME_ROLE;

I can’t seem to find the interface to perform this task, and it may not exists?

My dream would be to have an Interface like this:

public interface IPrivilegeManager
{
    void Grant(string privilegeName, string schemaOwnerName, string featureClassName, string roleName);
    void Revoke(string privilegeName, string schemaOwnerName, string featureClassName, string roleName);
}

Related Q: For a SDE FeatureClasses list all Roles that have been Granted any Privileges on it, and which Privileges each Role have on it

One Answer

You can obtain the name object for the given feature class and cast it to ISQLPrivilege, which allows you to enumerate, grant and revoke permissions.

E.g.:

var name = ((IDataset) featureClass).FullName;
var sqlPrivilege = name as ISQLPrivilege;
if (sqlPrivilege != null)
{
    sqlPrivilege.Grant("USER_OR_ROLE_NAME", (int) esriSQLPrivilege.esriSelectPrivilege, false);
}

Correct answer by Petr Krebs on December 10, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP