开发者

Get permission for an SVN folder using SharpSVN

开发者 https://www.devze.com 2023-01-21 16:02 出处:网络
I have 开发者_运维知识库have a repository, for example \"http://svnserver/repository\". Users have different permissions in the folders: \"http://svnserver/repository/folder1\" or \"http://svnserver/f

I have 开发者_运维知识库have a repository, for example "http://svnserver/repository". Users have different permissions in the folders: "http://svnserver/repository/folder1" or "http://svnserver/folder2". How can I get the permission (read only or read and write) of the user logged in for a specific folder?


I don't think you can get this using Subversion, except by trying to commit and seeing if you have write access.

I have seen nothing in the protocol or the commands that shows access rights, except for error messages when you don't have access.

Why do you need this?


I would suggest trying this:

FileIOPermission f = new FileIOPermission(PermissionState.None);
f.AllLocalFiles = FileIOPermissionAccess.Read;
try
{
    f.Demand();
}
catch (SecurityException s)
{
    Console.WriteLine(s.Message);
}

As found on:

http://www.eggheadcafe.com/community/aspnet/2/10076435/how-to-check-read-write-permission-of-shared-folder-on-network-pc-for-user.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消