In relation with this post Control VisualSVN Server from C#
I'm trying to manage user rights on specifics folders.
For the management on the repository itself everything is working fine.
But as soon as I try to change the "Object" parameter for a ManagementBaseObject
instead of the ManagementObject
of the repository it raise an exception.
I know that there is a new way to do the same in newer version of the server (with path in replacement of the referenced object)
//ManagementBase object related to the folder is not null and is already retrieved at this step
ManagementClass userClass = new ManagementClass("root\\VisualSVN", "VisualSVN_User", null);
ManagementClass authzClass = new ManagementClass("root\\VisualSVN", "VisualSVN_SecurityDescriptor", null);
ManagementClass permClass = new ManagementClass("root\\VisualSVN", "VisualSVN_PermissionEntry", null);
ManagementObject userObject = VisualSVN_User.instances[str].Mo;
ManagementObject permObject = permClass.CreateInstance();
permObject.SetPropertyValue("Account", userObject);
permObject.SetPropertyValue("AccessLevel", 2);
ManagementBaseObject inParams = authzClass.GetMethodParameters("SetSecurity");
inParams["Object"] = entry;
inParams["Permissions"] = new object[] { permObject };
ManagementBaseObject outParams = authzClass.InvokeMethod("SetSecurity", inParams, null); //raise exception.
Thanks for any help