Check user's permissions

  • Thread starter Thread starter inga2005
  • Start date Start date
I

inga2005

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
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top