Hi Pavel, I am looking to automate the granting of previleges for a user on SVN repositories by using C#. I am using the below piece of code.
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 = userClass.CreateInstance(); userObject.SetPropertyValue("Name","user1"); ManagementObject permObject = permClass.CreateInstance(); permObject.SetPropertyValue("Account", userObject); permObject.SetPropertyValue("AccessLevel", 2); ManagementObject repo = new ManagementObject( "VisualSVN_Repository.Name='Repo1'"); ManagementBaseObject inParams = authzClass.GetMethodParameters("SetSecurity"); inParams["Object"] = repo; inParams["Permissions"] = new object[] { permObject }; ManagementBaseObject outParams = authzClass.InvokeMethod("SetSecurity", inParams, null); But this code is working fine while granting permissions for the first user. When the permissions are granted for the second user on the same repository, the first user previleges are removed. Could you please me in resolving the issue. Thanks and Regards, Satya On Thursday, April 5, 2012 7:48:38 PM UTC+5:30, VisualSVN Team wrote: > Hello Sam, > > VisualSVN Server can be managed via WMI (Windows Management > Instrumentation) interface. > > MOF file which describes the VisualSVN Server interface resides in the > %VISUALSVN_SERVER%\WMI on the computer where VisualSVN Server is > installed. Using this file as a reference you can write a script in a > variety of languages to manage VisualSVN Server. > > Please check the MSDN article: > http://msdn.microsoft.com/en-us/library/aa384642 > > I'm including the following samples for your reference: > > * This C# code will create a Subversion user 'user1' with password > 'secret'. > > [[ > ManagementClass userClass = new ManagementClass("root\\VisualSVN", > "VisualSVN_User", null); > > // Obtain in-parameters for the method > ManagementBaseObject inParams = > userClass.GetMethodParameters("Create"); > > // Add the input parameters. > inParams["Name"] = "user1"; > inParams["Password"] = "secret"; > > // Execute the method and obtain the return values. > ManagementBaseObject outParams = > userClass.InvokeMethod("Create", inParams, null); > ]] > > * This C# code will create a new repository 'Repo1'. > > [[ > ManagementClass repoClass = new ManagementClass("root\\VisualSVN", > "VisualSVN_Repository", null); > > // Obtain in-parameters for the method > ManagementBaseObject inParams = > repoClass.GetMethodParameters("Create"); > > // Add the input parameters. > inParams["Name"] = "Repo1"; > > // Execute the method and obtain the return values. > ManagementBaseObject outParams = > repoClass.InvokeMethod("Create", inParams, null); > ]] > > Thank you. > > -- > With best regards, > Pavel Lyalyakin > VisualSVN Team > > -- You received this message because you are subscribed to the Google Groups "VisualSVN" group. To view this discussion on the web visit https://groups.google.com/d/msg/visualsvn/-/KxddK01maHwJ. To post to this group, send email to visualsvn@googlegroups.com. To unsubscribe from this group, send email to visualsvn+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/visualsvn?hl=en.