I am doing this in a Windows form via C# and VisualStudio
Two Questions.
Question 1 : Return a list Top Level Folders from a given repository.
I started with getting the repository the User has permission to access. I was able to do that with the following code:
Code: Select all
VaultRepositoryInfo[] vri = ServerOperations.ProcessCommandListRepositories();
List<string> repos = null;
foreach ( VaultRepositoryInfo vrio in vri )
{
repos.Add(vrio.RepName);
Console.Writeline(vrio.RepName);
}
This collected and then wrote out to the Console all of the repositories the user has access to. So far - so good.
Now
I want to list the folders inside the Repository. A full list is ok - but even
better would be only the top level folders the user has access to.
We call each of the top level folders in a repository "Projects" and it is only the top level "Projects" I wish to list... preferably just the ones they have access to. In your GUI, you limit the repositories, but not the folders. So in your GUI, if I had access to repository AAA and there were 7 folders but I was only granted access to repository AAA folder 3 I would still see repository AAA and all folders 1-7. Really, I would prefer to ONLY see repository AAA and folder 3. When using
Code: Select all
ServerOperations.ProcessCommandListFolder("[b][color=#FF4000]????[/color][/b]", true).Folders;
what is the default folder path for a repository so I can list all the top level folders? Is it "$" or "$/"...or am I using the wrong method entirely?
Questions
1a. How do I get a list of top level folders from a repository?
1b. Can I limit the list of top level folders to only the ones the user has permission to access? If so, how?
Question 2: List Repositories for a different user.
I am logged in as administrator AAA. I have full access to all repositories and all top level folders and everything else available in Vault.
a. What if I want to pass a different username and get the repositories for that user? Can I do that without logging in as that user? Say I have a listbox of users, I select one and I want to see the repositories they have permission to see and the folders under it. Can I pass the AD username and get access to it?
Code: Select all
ServerOperations.client.LoginOptions.User = GlobalUser;
ServerOperations.client.LoginOptions.Password = GlobalPassword;
ServerOperations.Login();
VaultRepositoryInfo[] vri = ServerOperations.ProcessCommandListRepositories();
// Switch user code here
I can get my own userid with this bit of code:
Code: Select all
System.DirectoryServices.AccountManagement.UserPrincipal.Current.SamAccountName;
But I don't know how to switch the Vault User to that login name. Is it possible?