List Info

Thread: Access right info on path




Access right info on path
user name
2008-01-02 04:51:36
Hello,

It is possible to know the information on access right on a
path, before 
commiting?
Cheers,

JClaude


------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: Access right info on path
user name
2008-01-03 12:13:19
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-unsubscribesvnkit.com
> For additional commands, e-mail: svnkit-users-helpsvnkit.com
> 
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: Access right info on path
user name
2008-01-04 04:04:21
Thanks 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-unsubscribesvnkit.com
>> For additional commands, e-mail:
svnkit-users-helpsvnkit.com
>>
>>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
> For additional commands, e-mail: svnkit-users-helpsvnkit.com
>
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: Access right info on path
user name
2008-05-28 03:38:56

Alexander Kitaev-3 wrote:
> 
> 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.
> 
> 

The 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.
-- 
View this message in context: http://www.nabble.com/Access-right-info-
on-path-tp14576435p17507729.html
Sent from the SVNKit - Users mailing list archive at
Nabble.com.


------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )