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);
}
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);
}
No comments:
Post a Comment