|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Access right info on pathHello,
It is possible to know the information on access right on a path, before commiting? Cheers, JClaude --------------------------------------------------------------------- To unsubscribe, e-mail: svnkit-users-unsubscribe@... For additional commands, e-mail: svnkit-users-help@... |
|
|
Re: Access right info on pathHello Jean,
> It is possible to know the information on access right on a path, before > commiting? There is no dedicated way to do that. The only way to figure out write access rights on the certain path in repository is to perform "fake" commit. You will get SVNAuthenticationException on repos.getCommitEditor(...) call or on editor.openRoot(...) one depending on the connection protocol (svn or dav). Code will look like that: // url - path you'd like to check // username, password - credentials. SVNRepository repos = SVNRepositoryFactory.create(url); repos.setAuthenticationManager( new BasicAuthenticationManager(userName, password)); 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(); } } It makes sense to check read access with repos.getDir or info call before performing "fake" commit. Also, as you are anyway going to make a commit this check may not be necessary - error processing will probably be the same both for "fake" and normal commits. Alexander Kitaev, TMate Software, http://svnkit.com/ - Java [Sub]Versioning Library! Jean-Claude Antonio wrote: > Hello, > > It is possible to know the information on access right on a path, before > commiting? > Cheers, > > JClaude > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: svnkit-users-unsubscribe@... > For additional commands, e-mail: svnkit-users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: svnkit-users-unsubscribe@... For additional commands, e-mail: svnkit-users-help@... |
|
|
Re: Access right info on pathThanks Alex!
Alexander Kitaev a écrit : > Hello Jean, > > > It is possible to know the information on access right on a path, > before > > commiting? > There is no dedicated way to do that. The only way to figure out write > access rights on the certain path in repository is to perform "fake" > commit. You will get SVNAuthenticationException on > repos.getCommitEditor(...) call or on editor.openRoot(...) one > depending on the connection protocol (svn or dav). > > Code will look like that: > > // url - path you'd like to check > // username, password - credentials. > > SVNRepository repos = SVNRepositoryFactory.create(url); > repos.setAuthenticationManager( > new BasicAuthenticationManager(userName, password)); > > 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(); > } > } > > It makes sense to check read access with repos.getDir or info call > before performing "fake" commit. Also, as you are anyway going to make > a commit this check may not be necessary - error processing will > probably be the same both for "fake" and normal commits. > > Alexander Kitaev, > TMate Software, > http://svnkit.com/ - Java [Sub]Versioning Library! > > Jean-Claude Antonio wrote: >> Hello, >> >> It is possible to know the information on access right on a path, >> before commiting? >> Cheers, >> >> JClaude >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: svnkit-users-unsubscribe@... >> For additional commands, e-mail: svnkit-users-help@... >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: svnkit-users-unsubscribe@... > For additional commands, e-mail: svnkit-users-help@... > > > --------------------------------------------------------------------- To unsubscribe, e-mail: svnkit-users-unsubscribe@... For additional commands, e-mail: svnkit-users-help@... |
|
|
Re: Access right info on pathThe above method holds a hidden assumption, which is that you have write access to the directory. This may not be true. I have a situation where a number of users will have read access to a whole directory, but each user will only have write access to a small number of files, possible just one. The call to openRoot will throw an exception as I don't have write access to the directory. I do, however, have write access to some individual file. When checking out the files, I would like to determine which file(s) the user has write access to. Is there any implicit way of doing that similar to the above? Commiting an unchanged file does not give any access violation. Hmm, maybe doing a dummy change and try to commit. If it works, I could retract the change, and know that I have write access. If not, I know that I don't. Any suggestions? Thanks. |
| Free Forum Powered by Nabble | Forum Help |