|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Testing for write access.Hi. I have a thorny problem here that I'm not sure how to solve. In a nutshell, testConnection() only seems to verify that a repository can be read, not written to, and this is causing some problems for me.
I have some tools that use SvnKit to automatically perform operations against a repository. I'm also in the process of migrating from one subversion server to another. The old server ("legacy"): runs subversion 1.3, uses a password file for authentication of both users and the automated tools. The automated tools use an "svnadmin" username. Anonymous read-only access is enabled; only writes require authentication. The new server ("modern"): runs subversion 1.4, ties into the corporate Kerberos framework for authentication for users and provides an alternate port for certificate-based client authentication for use by our tools. Anonymous read-only access is enabled; only writes require authentication. I'm attempting to make this transition as seamless as possible by having our tools try the original approach first and then fall back on certificates. The logical (to me, at least) approach for this seems to be: 1. Set up SvnKit for basic password authentication. 2. Call testRepository(). 3. If it succeeds, we're good to go. 4. If it fails, set up for certificate-based authentication on the alternate port. 5. Call testRepository(). I've written all of the necessary code and this approach works as long as I have anonymous read-only access disabled. However, when I re-enable this access the testRepository() in step (2) succeeds but future attempts by my tools to write to the repository fail. Is there any way to verify that a client has write access to the repository that doesn't involve a test commit or something? Thanks, Josh |
|
|
Re: Testing for write access.Hello Josh,
> Is there any way to verify that a client has write access to the repository > that doesn't involve a test commit or something? There is no standard way to do that. You may use test commit which is interrupted at some point, so no real commit happens. Please, try the following code to check whether repository is writable: ISVNEditor editor = null; try { editor = repos.getCommitEditor(...); editor.openRoot(-1); } catch (SVNAuthenticationException e) { // userName has no write access to URL. } catch (SVNException e) { // another error. } finally { if (editor != null) { editor.abortEdit(); } } You will get SVNAuthenticationException on repos.getCommitEditor(...) call or on editor.openRoot(...) one depending on the connection protocol (svn or dav). Alexander Kitaev, TMate Software, http://svnkit.com/ - Java [Sub]Versioning Library! josh.hamacher wrote: > Hi. I have a thorny problem here that I'm not sure how to solve. In a > nutshell, testConnection() only seems to verify that a repository can be > read, not written to, and this is causing some problems for me. > > I have some tools that use SvnKit to automatically perform operations > against a repository. I'm also in the process of migrating from one > subversion server to another. > > The old server ("legacy"): runs subversion 1.3, uses a password file for > authentication of both users and the automated tools. The automated tools > use an "svnadmin" username. Anonymous read-only access is enabled; only > writes require authentication. > > The new server ("modern"): runs subversion 1.4, ties into the corporate > Kerberos framework for authentication for users and provides an alternate > port for certificate-based client authentication for use by our tools. > Anonymous read-only access is enabled; only writes require authentication. > > I'm attempting to make this transition as seamless as possible by having our > tools try the original approach first and then fall back on certificates. > The logical (to me, at least) approach for this seems to be: > > 1. Set up SvnKit for basic password authentication. > 2. Call testRepository(). > 3. If it succeeds, we're good to go. > 4. If it fails, set up for certificate-based authentication on the > alternate port. > 5. Call testRepository(). > > I've written all of the necessary code and this approach works as long as I > have anonymous read-only access disabled. However, when I re-enable this > access the testRepository() in step (2) succeeds but future attempts by my > tools to write to the repository fail. > > Is there any way to verify that a client has write access to the repository > that doesn't involve a test commit or something? > > Thanks, > > Josh > --------------------------------------------------------------------- To unsubscribe, e-mail: svnkit-users-unsubscribe@... For additional commands, e-mail: svnkit-users-help@... |
| Free Forum Powered by Nabble | Forum Help |