We are running VisualSVN on Windows 2012. I have been tasked with preventing the stealing of locks. I want to use a pre-unlock hook. To start, I want to compare the lock owner's name to the lock-breaking user's name. I can find the lock owner on the server with svnlook
:
svnlook lock C:\Repositories\DIT_TEST time-for-a-sandwich.txt
That gives me a little list of info that includes the owner. Cool.
I want to replicate that in SharpSVN. Here's what I have so far:
using (SvnClient client = new SvnClient())
{
StringBuilder sbLockOwner = new StringBuilder();
Collection<SvnListEventArgs> col;
if (client.GetList(new Uri("https://dit-visualsvn/svn/DIT_TEST"), out col))
{
foreach (SvnListEventArgs svnListEventArg in col)
{
sbLockOwner.Append(svnListEventArg.Lock.Owner.ToString());
}
}
}
When I try to release a lock, I get the error:
Unable to connect to a repository at URL 'https://dit-visualsvn/svn/DIT_TEST' --->
Access to '/svn/DIT_TEST' forbidden.
I have verified that my user has read/write permission for the repository and I've tried using the client.Authentication.ForceCredentials("login", "pswd");
solution. Still not allowed.
How can I get the lock owner's name with SharpSVN?
More info: If I change my code to the response on this SO, I still see that access is forbidden.