Change Privileges for multiple users or roles

1308
2
Jump to solution
11-03-2016 09:41 AM
SteveMaskol
New Contributor III

Through ArcObjects code in a C# executable I am creating a table in SDE and setting the user privileges. To set the user privileges I am using the geoprocessing tool ChangePrivileges. The executable runs overnight on our SDE server. It has been running successfully for years. I am in the process of upgrading the executable to 10.4.1. When I run the exe to test, it fails on the ChangePrivilges tool. I get the error "Bad login user". This is referring to the USER parameter of ChangePrivileges. I specify three names for the parameter.

gpPrivileges.user = "CITY_VIEWER,CNTY_VIEWER,GISWEB"; 

This line is part of the exe that successfully runs on our SDE server each night. I have tried altering the parameter to include only one user and that works. Has something changed with how multiple users are defined for this parameter? Are you no longer able to define multiple users or roles for this parameter? Our SDE is 10.1. It is understandable that usage of the tool in ArcObjects could have changed but I have not been able to find any documentation in support or against this.

Below, is the full code that is used to change privileges. Thanks to anyone who can provide help on setting privileges for a table with multiple users.

Geoprocessor gp = new Geoprocessor();
try
{
   X = 1;
   ChangePrivileges gpPrivileges = new ChangePrivileges();
   gpPrivileges.in_dataset = mCitySdeDbConn + @"\" + mCogParcelAttOld;
   gpPrivileges.user = "CITY_VIEWER,CNTY_VIEWER,GISWEB";
   gpPrivileges.View = "GRANT";
   gp.Execute(gpPrivileges, null);
   if (gp.MessageCount > 0)
   {
      for (int x = 0; x <= gp.MessageCount - 1; x++)
   {
      WriteOutput(gp.GetMessage(x));
   }
}
X = 0;
gp.ResetEnvironments();

0 Kudos
1 Solution

Accepted Solutions
YuanLiu
Occasional Contributor

This is because of a known issue of the Change Privileges GP tool itself since 10.3. The tool only allows to change privileges for single user since 10.3. The issue has been reported to Esri, but seems like not published yet. Is it acceptable in your workflow to run the tool for each user individually?

View solution in original post

2 Replies
YuanLiu
Occasional Contributor

This is because of a known issue of the Change Privileges GP tool itself since 10.3. The tool only allows to change privileges for single user since 10.3. The issue has been reported to Esri, but seems like not published yet. Is it acceptable in your workflow to run the tool for each user individually?

SteveMaskol
New Contributor III

Thanks for your reply. This was very helpful. I will change my code so the Change Privileges tool is called three times, once for each role. Thanks for letting me know that this is a known issue with the GP tool.

0 Kudos