471,326 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

Check user's permissions

Hi!
I need to check what sub folders a user can access with a specific
folder as set as the parent e.g. c:\temp is the parent and c:\temp\one
and c:\temp\two are the sub folders. I need to find out if user x can
access folder one or two or both. How can this be done?
/erik
Aug 8 '08 #1
3 2184
On 08/08/2008 in message
<7f**********************************@8g2000hse.go oglegroups.cominga2005
wrote:
>Hi!
I need to check what sub folders a user can access with a specific
folder as set as the parent e.g. c:\temp is the parent and c:\temp\one
and c:\temp\two are the sub folders. I need to find out if user x can
access folder one or two or both. How can this be done?
/erik
There's a brilliant class on the Code Project:

http://www.codeproject.com/KB/files/...essRights.aspx

I use it in most of my apps.

--
Jeff Gaines Damerham Hampshire UK
All those who believe in psychokinesis raise my hand.
Aug 8 '08 #2
I need to check what sub folders a user can access with a specific
folder as set as the parent e.g. c:\temp is the parent and c:\temp\one
and c:\temp\two are the sub folders. I need to find out if user x can
access folder one or two or both. How can this be done?
This is tricky business. There are classes in .NET that deal with (some of)
these issues though I've never used them myself. Ultimately you can rely on
"AccessCheck()" in the WinAPI but you need solid security know-how to use
it. The docs provide a link to an example. Why not just temporarily
impersonate the target user however and see if you can access the folder the
way you want. That's the simplest route.
Aug 8 '08 #3
Interesting article.

Although I may be wrong, I did a quick scan through the article and
never saw any CAS checks.

Most people will never have problem with CAS because most of the code
runs with full privileges but if your code is limited by CAS then the
code in the article may end up throwing an exception if CAS does not
allow access to the folder being examined.

Again, I just took a quick glance at the article so I may be wrong but
I thought I would mention it.
On Aug 8, 2:02*pm, "Jeff Gaines" <jgaines_new...@yahoo.co.ukwrote:
On 08/08/2008 in message
<7fe6d0d6-75e1-424d-b380-fe02b9b20...@8g2000hse.googlegroups.cominga2005
wrote:
Hi!
I need to check what sub folders a user can access with a specific
folder as set as the parent e.g. c:\temp is the parent and c:\temp\one
and c:\temp\two are the sub folders. I need to find out if user x can
access folder one or two or both. How can this be done?
/erik

There's a brilliant class on the Code Project:

http://www.codeproject.com/KB/files/...essRights.aspx

I use it in most of my apps.

--
Jeff Gaines Damerham Hampshire UK
All those who believe in psychokinesis raise my hand.
Aug 8 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by dan glenn | last post: by
8 posts views Thread by Bernard Lebel | last post: by
6 posts views Thread by Fred W. | last post: by
1 post views Thread by =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?= | last post: by
3 posts views Thread by gareth | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.